summaryrefslogtreecommitdiffstats
path: root/lldb/lit
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/lit')
-rw-r--r--lldb/lit/SymbolFile/Breakpad/Inputs/line-table-discontinuous-file-ids.syms8
-rw-r--r--lldb/lit/SymbolFile/Breakpad/Inputs/line-table-edgecases.syms7
-rw-r--r--lldb/lit/SymbolFile/Breakpad/Inputs/line-table-missing-file.syms7
-rw-r--r--lldb/lit/SymbolFile/Breakpad/Inputs/line-table.syms17
-rw-r--r--lldb/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test13
-rw-r--r--lldb/lit/SymbolFile/Breakpad/line-table-edgecases.test21
-rw-r--r--lldb/lit/SymbolFile/Breakpad/line-table-missing-file.test17
-rw-r--r--lldb/lit/SymbolFile/Breakpad/line-table.test45
8 files changed, 135 insertions, 0 deletions
diff --git a/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-discontinuous-file-ids.syms b/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-discontinuous-file-ids.syms
new file mode 100644
index 00000000000..f19d5374056
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-discontinuous-file-ids.syms
@@ -0,0 +1,8 @@
+MODULE Linux x86_64 761550E08086333960A9074A9CE2895C0 a.out
+INFO CODE_ID E05015768680393360A9074A9CE2895C
+FILE 1 /tmp/a.c
+FILE 3 /tmp/c.c
+FUNC b0 10 0 func
+b0 1 1 1
+b1 1 2 1
+b2 1 2 3
diff --git a/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-edgecases.syms b/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-edgecases.syms
new file mode 100644
index 00000000000..069b79cc57d
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-edgecases.syms
@@ -0,0 +1,7 @@
+MODULE Linux x86_64 761550E08086333960A9074A9CE2895C0 a.out
+INFO CODE_ID E05015768680393360A9074A9CE2895C
+FILE 0 /tmp/a.c
+a0 1 1 0
+FUNC b0 10 0 func
+FUNC c0 10 0 func2
+c0 2 2 0
diff --git a/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-missing-file.syms b/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-missing-file.syms
new file mode 100644
index 00000000000..635716c6b06
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/Inputs/line-table-missing-file.syms
@@ -0,0 +1,7 @@
+MODULE Linux x86_64 761550E08086333960A9074A9CE2895C0 a.out
+INFO CODE_ID E05015768680393360A9074A9CE2895C
+FILE 0 /tmp/a.c
+FUNC b0 10 0 func
+b0 1 1 0
+b1 1 2 0
+b2 1 2 1
diff --git a/lldb/lit/SymbolFile/Breakpad/Inputs/line-table.syms b/lldb/lit/SymbolFile/Breakpad/Inputs/line-table.syms
new file mode 100644
index 00000000000..e608eb8033e
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/Inputs/line-table.syms
@@ -0,0 +1,17 @@
+MODULE Linux x86_64 761550E08086333960A9074A9CE2895C0 a.out
+INFO CODE_ID E05015768680393360A9074A9CE2895C
+FILE 0 /tmp/a.c
+FILE 1 /tmp/c.c
+FILE 2 /tmp/d.c
+FUNC b0 10 0 func
+b0 1 1 0
+b1 1 2 0
+b2 1 2 1
+b4 1 3 1
+FUNC c0 10 0 func2
+c0 2 1 1
+c2 2 2 0
+FUNC d0 10 0 func3
+d0 2 1 2
+FUNC e0 10 0 func4
+e0 2 2 2
diff --git a/lldb/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test b/lldb/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test
new file mode 100644
index 00000000000..3b48f4f3c5a
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/line-table-discontinuous-file-ids.test
@@ -0,0 +1,13 @@
+# Test that we handle files which has gaps in the FILE record IDs.
+
+# RUN: yaml2obj %S/Inputs/basic-elf.yaml > %T/line-table-discontinuous-file-ids.out
+# RUN: %lldb %T/line-table-discontinuous-file-ids.out \
+# RUN: -o "target symbols add -s line-table-discontinuous-file-ids.out %S/Inputs/line-table-discontinuous-file-ids.syms" \
+# RUN: -s %s -o exit | FileCheck %s
+
+image dump line-table a.c
+# CHECK-LABEL: Line table for /tmp/a.c
+# CHECK-NEXT: 0x00000000004000b0: /tmp/a.c:1
+# CHECK-NEXT: 0x00000000004000b1: /tmp/a.c:2
+# CHECK-NEXT: 0x00000000004000b2: /tmp/c.c:2
+# CHECK-NEXT: 0x00000000004000b3:
diff --git a/lldb/lit/SymbolFile/Breakpad/line-table-edgecases.test b/lldb/lit/SymbolFile/Breakpad/line-table-edgecases.test
new file mode 100644
index 00000000000..3a097725a97
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/line-table-edgecases.test
@@ -0,0 +1,21 @@
+# Test handling of breakpad files with some unusual or erroneous constructs. The
+# input contains a LINE record which does not belong to any function as well as
+# a FUNC record without any LINE records.
+
+# RUN: yaml2obj %S/Inputs/basic-elf.yaml > %T/line-table-edgecases.out
+# RUN: %lldb %T/line-table-edgecases.out \
+# RUN: -o "target symbols add -s line-table-edgecases.out %S/Inputs/line-table-edgecases.syms" \
+# RUN: -s %s -o exit | FileCheck %s
+
+# Test that line table for func2 was parsed properly:
+image dump line-table a.c
+# CHECK-LABEL: Line table for /tmp/a.c
+# CHECK-NEXT: 0x00000000004000c0: /tmp/a.c:2
+# CHECK-NEXT: 0x00000000004000c2:
+# CHECK-EMPTY:
+
+# Looking up an address inside func should still work even if it does not result
+# in a line entry.
+image lookup -a 0x4000b2 -v
+# CHECK-LABEL: image lookup -a 0x4000b2 -v
+# CHECK: Summary: line-table-edgecases.out`func + 2
diff --git a/lldb/lit/SymbolFile/Breakpad/line-table-missing-file.test b/lldb/lit/SymbolFile/Breakpad/line-table-missing-file.test
new file mode 100644
index 00000000000..0c0fb3f8ea8
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/line-table-missing-file.test
@@ -0,0 +1,17 @@
+# Test that we do something reasonable if a LINE record references a
+# non-existing FILE record.
+# Right now, "something reasonable" means creating a line entry with an empty
+# file.
+
+# RUN: yaml2obj %S/Inputs/basic-elf.yaml > %T/line-table-missing-file.out
+# RUN: %lldb %T/line-table-missing-file.out \
+# RUN: -o "target symbols add -s line-table-missing-file.out %S/Inputs/line-table-missing-file.syms" \
+# RUN: -s %s -o exit | FileCheck %s
+
+image dump line-table a.c
+# CHECK-LABEL: Line table for /tmp/a.c
+# CHECK-NEXT: 0x00000000004000b0: /tmp/a.c:1
+# CHECK-NEXT: 0x00000000004000b1: /tmp/a.c:2
+# CHECK-NEXT: 0x00000000004000b2: :2
+# CHECK-NEXT: 0x00000000004000b3:
+# CHECK-EMPTY:
diff --git a/lldb/lit/SymbolFile/Breakpad/line-table.test b/lldb/lit/SymbolFile/Breakpad/line-table.test
new file mode 100644
index 00000000000..f5661cf7ee9
--- /dev/null
+++ b/lldb/lit/SymbolFile/Breakpad/line-table.test
@@ -0,0 +1,45 @@
+# RUN: yaml2obj %S/Inputs/basic-elf.yaml > %T/line-table.out
+# RUN: %lldb %T/line-table.out -o "target symbols add -s line-table.out %S/Inputs/line-table.syms" \
+# RUN: -s %s -o exit | FileCheck %s
+
+# We create a compile unit for each function. The compile unit name is the first
+# line table entry in that function.
+# This symbol file contains a single function in the "compile unit" a.c. This
+# function has two line table sequences.
+image dump line-table a.c
+# CHECK-LABEL: Line table for /tmp/a.c
+# CHECK-NEXT: 0x00000000004000b0: /tmp/a.c:1
+# CHECK-NEXT: 0x00000000004000b1: /tmp/a.c:2
+# CHECK-NEXT: 0x00000000004000b2: /tmp/c.c:2
+# CHECK-NEXT: 0x00000000004000b3:
+# CHECK-EMPTY:
+# CHECK-NEXT: 0x00000000004000b4: /tmp/c.c:3
+# CHECK-NEXT: 0x00000000004000b5:
+# CHECK-EMPTY:
+
+# Single compile unit for c.c with a single line sequence.
+image dump line-table c.c
+# CHECK-LABEL: Line table for /tmp/c.c
+# CHECK-NEXT: 0x00000000004000c0: /tmp/c.c:1
+# CHECK-NEXT: 0x00000000004000c2: /tmp/a.c:2
+# CHECK-NEXT: 0x00000000004000c4:
+# CHECK-EMPTY:
+
+# There are two compile units called "d.c". Hence, two line tables.
+image dump line-table d.c
+# CHECK-LABEL: Line table for /tmp/d.c
+# CHECK-NEXT: 0x00000000004000d0: /tmp/d.c:1
+# CHECK-NEXT: 0x00000000004000d2:
+# CHECK-EMPTY:
+# CHECK-LABEL: Line table for /tmp/d.c
+# CHECK-NEXT: 0x00000000004000e0: /tmp/d.c:2
+# CHECK-NEXT: 0x00000000004000e2:
+# CHECK-EMPTY:
+
+image lookup -a 0x4000b2 -v
+# CHECK-LABEL: image lookup -a 0x4000b2 -v
+# CHECK: Summary: line-table.out`func + 2
+
+breakpoint set -f c.c -l 2
+# CHECK-LABEL: breakpoint set -f c.c -l 2
+# CHECK: Breakpoint 1: where = line-table.out`func + 2, address = 0x00000000004000b2
OpenPOWER on IntegriCloud