diff options
| author | Mark Wielaard <[email protected]> | 2018-06-22 22:44:51 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2018-06-29 10:22:51 +0200 |
| commit | 2ee84b2ca8b2da2bc4ad5663babfa25d97aa85b4 (patch) | |
| tree | 4d0858c6896050b169d77d7211b8f4d94109a209 /tests | |
| parent | e3b2060bb6a687587500c8d6c74145ef1d320c5c (diff) | |
libdw: Add dwarf_next_lines to read .debug_line tables without CUs.
It is sometimes useful to read .debug_line tables on their own without
having an associated CU DIE. DWARF5 line tables are self-contained.
Adjust dwarf_begin_elf to accept ELF files with just a .debug_line.
Add a new function dwarf_next_lines that returns the Dwarf_Files and
Dwarf_Lines while iterating over just the .debug_lines section. Since
we parse and cache the information it also will try to match the CU
a table is associated with. This is only necessary for DWARF4 line
tables (we will need at least the compilation dir from the CU) and
won't be done for DWARF5 line tables. It also isn't an error if there
is no associated CU (but will mean for DWARF4 line tables the dir list
and the file paths might not be complete).
A typical way to call this new function is:
Dwarf_Off off, next_off = 0;
Dwarf_CU *cu = NULL;
Dwarf_Files *files;
size_t nfiles;
Dwarf_Lines *lines;
size_t nlines;
int res;
while ((res = dwarf_next_lines (dbg, off = next_off, &next_off, &cu,
&files, &nfiles, &lines, &nlines)) == 0)
{
/* ... handle files and lines ... */
}
if (res < 0)
printf ("BAD dwarf_next_lines: %s\n", dwarf_errmsg (-1));
See libdw.h for the full documentation. For more examples on how to use
the function see the new testcases next-files and next-lines.
Also adjust the file paths for line tables missing a comp_dir.
They are no longer made "absolute" by prepending a slash '/' in front
of them. This really was not useful and didn't happen in any of the
testcases. They are now just kept relative.
Make eu-readelf --debug-dump=decodedline use dwarf_next_lines instead
of iterating over the CUs to show the (decoded) line tables. This allows
it to show decoded line tables even if there is no .debug_info section.
New tests have been added that mimic the get-files and get-lines tests
but use dwarf_next_lines instead of iterating over all CUs. They produce
identical output (modulo the CU information). Also add a new test file
that contains only a .debug_line section.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 14 | ||||
| -rw-r--r-- | tests/Makefile.am | 7 | ||||
| -rw-r--r-- | tests/next-files.c | 93 | ||||
| -rw-r--r-- | tests/next-lines.c | 144 | ||||
| -rwxr-xr-x | tests/run-next-files.sh | 165 | ||||
| -rwxr-xr-x | tests/run-next-lines.sh | 116 | ||||
| -rw-r--r-- | tests/testfile-only-debug-line.bz2 | bin | 0 -> 2514 bytes |
7 files changed, 538 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index c4942860..8eb63316 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,17 @@ +2018-06-25 Mark Wielaard <[email protected]> + + * next-files.c: New file. + * next-lines.c: Likewise. + * run-next-files.sh: New test. + * run-next-lines.sh: Likewise. + * testfile-only-debug-line.bz2: New test file. + * Makefile.am (check_PROGRAMS): Add next-files and next-lines. + (TESTS): Add run-next-files.sh and run-next-lines.sh. + (EXTRA_DIST): Add run-next-files.sh, run-next-lines.sh and + testfile-only-debug-line.bz2. + (next_lines_LDADD): New variable. + (next_files_LDADD): Likewise. + 2018-06-16 Yonghong Song <[email protected]> * run-reloc-bpf.sh: New test. diff --git a/tests/Makefile.am b/tests/Makefile.am index bdb82fc0..7b29fd83 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -38,7 +38,8 @@ endif check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \ showptable update1 update2 update3 update4 test-nlist \ - show-die-info get-files get-lines get-pubnames \ + show-die-info get-files next-files get-lines next-lines \ + get-pubnames \ get-aranges allfcts line2addr addrscopes funcscopes \ show-abbrev hash newscn ecp dwflmodtest \ find-prologues funcretval allregs rdwrmmap \ @@ -77,6 +78,7 @@ backtrace-child-biarch$(EXEEXT): backtrace-child.c TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \ update1 update2 update3 update4 \ run-show-die-info.sh run-get-files.sh run-get-lines.sh \ + run-next-files.sh run-next-lines.sh \ run-get-pubnames.sh run-get-aranges.sh run-allfcts.sh \ run-show-abbrev.sh run-line2addr.sh hash \ newscn run-strip-test.sh run-strip-test2.sh \ @@ -173,6 +175,7 @@ endif EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \ run-show-die-info.sh run-get-files.sh run-get-lines.sh \ + run-next-files.sh run-next-lines.sh testfile-only-debug-line.bz2 \ run-get-pubnames.sh run-get-aranges.sh \ run-show-abbrev.sh run-strip-test.sh \ run-strip-test2.sh run-ecp-test.sh run-ecp-test2.sh \ @@ -470,7 +473,9 @@ show_die_info_LDADD = $(libdw) $(libelf) get_pubnames_LDADD = $(libdw) $(libelf) show_abbrev_LDADD = $(libdw) $(libelf) get_lines_LDADD = $(libdw) $(libelf) +next_lines_LDADD = $(libdw) $(libelf) get_files_LDADD = $(libdw) $(libelf) +next_files_LDADD = $(libdw) $(libelf) get_aranges_LDADD = $(libdw) $(libelf) allfcts_LDADD = $(libdw) $(libelf) line2addr_LDADD = $(libdw) $(argp_LDADD) diff --git a/tests/next-files.c b/tests/next-files.c new file mode 100644 index 00000000..9de5c8b0 --- /dev/null +++ b/tests/next-files.c @@ -0,0 +1,93 @@ +/* A variant of get-files test that uses dwarf_next_lines. + Copyright (C) 2002, 2004, 2005, 2007, 2014, 2018 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <inttypes.h> +#include <libelf.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <unistd.h> + + +int +main (int argc, char *argv[]) +{ + int result = 0; + int cnt; + + for (cnt = 1; cnt < argc; ++cnt) + { + int fd = open (argv[cnt], O_RDONLY); + + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable\n", argv[cnt]); + result = 1; + if (fd != -1) + close (fd); + continue; + } + + Dwarf_Off off; + Dwarf_Off next_off = 0; + Dwarf_CU *cu = NULL; + Dwarf_Files *files; + size_t nfiles; + int res; + while ((res = dwarf_next_lines (dbg, off = next_off, &next_off, &cu, + &files, &nfiles, NULL, NULL)) == 0) + { + printf ("off = %" PRIu64 "\n", off); + + const char *const *dirs; + size_t ndirs; + if (dwarf_getsrcdirs (files, &dirs, &ndirs) != 0) + { + printf ("%s: cannot get include directories\n", argv[cnt]); + result = 1; + break; + } + + if (dirs[0] == NULL) + puts (" dirs[0] = (null)"); + else + printf (" dirs[0] = \"%s\"\n", dirs[0]); + for (size_t i = 1; i < ndirs; ++i) + printf (" dirs[%zu] = \"%s\"\n", i, dirs[i]); + + for (size_t i = 0; i < nfiles; ++i) + printf (" file[%zu] = \"%s\"\n", i, + dwarf_filesrc (files, i, NULL, NULL)); + } + + if (res < 0) + { + printf ("dwarf_next_lines failed: %s\n", dwarf_errmsg (-1)); + result = 1; + } + + dwarf_end (dbg); + close (fd); + } + + return result; +} diff --git a/tests/next-lines.c b/tests/next-lines.c new file mode 100644 index 00000000..cfb74cde --- /dev/null +++ b/tests/next-lines.c @@ -0,0 +1,144 @@ +/* A variant of get-lines that uses dwarf_next_lines. + Copyright (C) 2002, 2004, 2018 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <fcntl.h> +#include <inttypes.h> +#include <libelf.h> +#include ELFUTILS_HEADER(dw) +#include <stdio.h> +#include <string.h> +#include <unistd.h> + + +int +main (int argc, char *argv[]) +{ + int result = 0; + int cnt; + + for (cnt = 1; cnt < argc; ++cnt) + { + int fd = open (argv[cnt], O_RDONLY); + + Dwarf *dbg = dwarf_begin (fd, DWARF_C_READ); + if (dbg == NULL) + { + printf ("%s not usable: %s\n", argv[cnt], dwarf_errmsg (-1)); + close (fd); + continue; + } + + Dwarf_Off off; + Dwarf_Off next_off = 0; + Dwarf_CU *cu = NULL; + Dwarf_Lines *lb; + size_t nlb; + int res; + while ((res = dwarf_next_lines (dbg, off = next_off, &next_off, &cu, + NULL, NULL, &lb, &nlb)) == 0) + { + printf ("off = %" PRIu64 "\n", off); + printf (" %zu lines\n", nlb); + + for (size_t i = 0; i < nlb; ++i) + { + Dwarf_Line *l = dwarf_onesrcline (lb, i); + if (l == NULL) + { + printf ("%s: cannot get individual line\n", argv[cnt]); + result = 1; + break; + } + + Dwarf_Addr addr; + if (dwarf_lineaddr (l, &addr) != 0) + addr = 0; + const char *file = dwarf_linesrc (l, NULL, NULL); + int line; + if (dwarf_lineno (l, &line) != 0) + line = 0; + + printf ("%" PRIx64 ": %s:%d:", (uint64_t) addr, + file ?: "???", line); + + /* Getting the file path through the Dwarf_Files should + result in the same path. */ + Dwarf_Files *files; + size_t idx; + if (dwarf_line_file (l, &files, &idx) != 0) + { + printf ("%s: cannot get file from line (%zd): %s\n", + argv[cnt], i, dwarf_errmsg (-1)); + result = 1; + break; + } + const char *path = dwarf_filesrc (files, idx, NULL, NULL); + if ((path == NULL && file != NULL) + || (path != NULL && file == NULL) + || (strcmp (file, path) != 0)) + { + printf ("%s: line %zd srcline (%s) != file srcline (%s)\n", + argv[cnt], i, file ?: "???", path ?: "???"); + result = 1; + break; + } + + int column; + if (dwarf_linecol (l, &column) != 0) + column = 0; + if (column >= 0) + printf ("%d:", column); + + bool is_stmt; + if (dwarf_linebeginstatement (l, &is_stmt) != 0) + is_stmt = false; + bool end_sequence; + if (dwarf_lineendsequence (l, &end_sequence) != 0) + end_sequence = false; + bool basic_block; + if (dwarf_lineblock (l, &basic_block) != 0) + basic_block = false; + bool prologue_end; + if (dwarf_lineprologueend (l, &prologue_end) != 0) + prologue_end = false; + bool epilogue_begin; + if (dwarf_lineepiloguebegin (l, &epilogue_begin) != 0) + epilogue_begin = false; + + printf (" is_stmt:%s, end_seq:%s, bb:%s, prologue:%s, epilogue:%s\n", + is_stmt ? "yes" : "no", end_sequence ? "yes" : "no", + basic_block ? "yes" : "no", prologue_end ? "yes" : "no", + epilogue_begin ? "yes" : "no"); + } + } + + if (res < 0) + { + printf ("dwarf_next_lines failed: %s\n", dwarf_errmsg (-1)); + result = 1; + } + + dwarf_end (dbg); + close (fd); + } + + return result; +} diff --git a/tests/run-next-files.sh b/tests/run-next-files.sh new file mode 100755 index 00000000..7a3b6d0f --- /dev/null +++ b/tests/run-next-files.sh @@ -0,0 +1,165 @@ +#! /bin/sh +# Variant of run-get-files that uses dwarf_next_lines. +# Copyright (C) 2018 Red Hat, Inc. +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 + +testrun_compare ${abs_builddir}/next-files testfile testfile2 <<\EOF +off = 0 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" + file[0] = "???" + file[1] = "/home/drepper/gnu/new-bu/build/ttt/m.c" +off = 75 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" + file[0] = "???" + file[1] = "/home/drepper/gnu/new-bu/build/ttt/b.c" + file[2] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h" + file[3] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h" + file[4] = "/usr/include/bits/types.h" + file[5] = "/usr/include/bits/sched.h" + file[6] = "/usr/include/bits/pthreadtypes.h" + file[7] = "/usr/include/stdio.h" + file[8] = "/usr/include/libio.h" + file[9] = "/usr/include/wchar.h" + file[10] = "/usr/include/_G_config.h" + file[11] = "/usr/include/gconv.h" +off = 480 + dirs[0] = "/home/drepper/gnu/new-bu/build/ttt" + file[0] = "???" + file[1] = "/home/drepper/gnu/new-bu/build/ttt/f.c" +off = 0 + dirs[0] = "/shoggoth/drepper" + file[0] = "???" + file[1] = "/shoggoth/drepper/b.c" + file[2] = "/home/geoffk/objs/laurel-000912-branch/lib/gcc-lib/powerpc-unknown-linux-gnu/2.96-laurel-000912/include/stddef.h" + file[3] = "/home/geoffk/objs/laurel-000912-branch/lib/gcc-lib/powerpc-unknown-linux-gnu/2.96-laurel-000912/include/stdarg.h" + file[4] = "/shoggoth/drepper/<built-in>" + file[5] = "/usr/include/bits/types.h" + file[6] = "/usr/include/stdio.h" + file[7] = "/usr/include/libio.h" + file[8] = "/usr/include/_G_config.h" +off = 418 + dirs[0] = "/shoggoth/drepper" + file[0] = "???" + file[1] = "/shoggoth/drepper/f.c" +off = 485 + dirs[0] = "/shoggoth/drepper" + file[0] = "???" + file[1] = "/shoggoth/drepper/m.c" +EOF + +# see tests/testfile-dwarf-45.source +testfiles testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo +testfiles testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo + +testrun_compare ${abs_builddir}/next-files testfile-splitdwarf-4 testfile-hello4.dwo testfile-world4.dwo <<\EOF +off = 0 + dirs[0] = "/home/mark/src/elfutils/tests" + dirs[1] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include" + file[0] = "???" + file[1] = "/home/mark/src/elfutils/tests/hello.c" + file[2] = "/home/mark/src/elfutils/tests/hello.h" + file[3] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h" +off = 612 + dirs[0] = "/home/mark/src/elfutils/tests" + dirs[1] = "/usr/include" + file[0] = "???" + file[1] = "/home/mark/src/elfutils/tests/world.c" + file[2] = "/home/mark/src/elfutils/tests/hello.h" + file[3] = "/usr/include/stdlib.h" +off = 0 + dirs[0] = "/home/mark/src/elfutils/tests" + dirs[1] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include" + file[0] = "???" + file[1] = "/home/mark/src/elfutils/tests/hello.c" + file[2] = "/home/mark/src/elfutils/tests/hello.h" + file[3] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h" +off = 0 + dirs[0] = "/home/mark/src/elfutils/tests" + dirs[1] = "/usr/include" + file[0] = "???" + file[1] = "/home/mark/src/elfutils/tests/world.c" + file[2] = "/home/mark/src/elfutils/tests/hello.h" + file[3] = "/usr/include/stdlib.h" +EOF + +# No problem with dirs[0] for DWARF5 line tables. +testrun_compare ${abs_builddir}/next-files testfile-splitdwarf-5 testfile-hello5.dwo testfile-world5.dwo <<\EOF +off = 0 + dirs[0] = "/home/mark/src/elfutils/tests" + dirs[1] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include" + file[0] = "/home/mark/src/elfutils/tests/hello.c" + file[1] = "/home/mark/src/elfutils/tests/hello.c" + file[2] = "/home/mark/src/elfutils/tests/hello.h" + file[3] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h" +off = 655 + dirs[0] = "/home/mark/src/elfutils/tests" + dirs[1] = "/usr/include" + file[0] = "/home/mark/src/elfutils/tests/world.c" + file[1] = "/home/mark/src/elfutils/tests/world.c" + file[2] = "/home/mark/src/elfutils/tests/hello.h" + file[3] = "/usr/include/stdlib.h" +off = 0 + dirs[0] = "/home/mark/src/elfutils/tests" + dirs[1] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include" + file[0] = "/home/mark/src/elfutils/tests/hello.c" + file[1] = "/home/mark/src/elfutils/tests/hello.c" + file[2] = "/home/mark/src/elfutils/tests/hello.h" + file[3] = "/opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/9.0.0/include/stddef.h" +off = 0 + dirs[0] = "/home/mark/src/elfutils/tests" + dirs[1] = "/usr/include" + file[0] = "/home/mark/src/elfutils/tests/world.c" + file[1] = "/home/mark/src/elfutils/tests/world.c" + file[2] = "/home/mark/src/elfutils/tests/hello.h" + file[3] = "/usr/include/stdlib.h" +EOF + +# Created from testfile using +# cp testfile testfile-only-debug-line +# eu-strip -g --keep-section .debug_line +# +# Note how the comp dir cannot be retrieved and some files become relative. +testfiles testfile-only-debug-line +testrun_compare ${abs_builddir}/next-files testfile-only-debug-line <<\EOF +off = 0 + dirs[0] = (null) + file[0] = "???" + file[1] = "m.c" +off = 75 + dirs[0] = (null) + file[0] = "???" + file[1] = "b.c" + file[2] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h" + file[3] = "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h" + file[4] = "/usr/include/bits/types.h" + file[5] = "/usr/include/bits/sched.h" + file[6] = "/usr/include/bits/pthreadtypes.h" + file[7] = "/usr/include/stdio.h" + file[8] = "/usr/include/libio.h" + file[9] = "/usr/include/wchar.h" + file[10] = "/usr/include/_G_config.h" + file[11] = "/usr/include/gconv.h" +off = 480 + dirs[0] = (null) + file[0] = "???" + file[1] = "f.c" +EOF + +exit 0 diff --git a/tests/run-next-lines.sh b/tests/run-next-lines.sh new file mode 100755 index 00000000..84aee1c7 --- /dev/null +++ b/tests/run-next-lines.sh @@ -0,0 +1,116 @@ +#! /bin/sh +# Variant of run-get-lines that uses dwarf_next_lines. +# Copyright (C) 2018 Red Hat, Inc. +# This file is part of elfutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# elfutils is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. $srcdir/test-subr.sh + +testfiles testfile testfile2 testfilenolines + +testrun_compare ${abs_builddir}/next-lines testfile testfile2 <<\EOF +off = 0 + 5 lines +804842c: /home/drepper/gnu/new-bu/build/ttt/m.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048432: /home/drepper/gnu/new-bu/build/ttt/m.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804844d: /home/drepper/gnu/new-bu/build/ttt/m.c:7:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048458: /home/drepper/gnu/new-bu/build/ttt/m.c:8:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804845a: /home/drepper/gnu/new-bu/build/ttt/m.c:8:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +off = 75 + 4 lines +804845c: /home/drepper/gnu/new-bu/build/ttt/b.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804845f: /home/drepper/gnu/new-bu/build/ttt/b.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048464: /home/drepper/gnu/new-bu/build/ttt/b.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048466: /home/drepper/gnu/new-bu/build/ttt/b.c:6:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +off = 480 + 4 lines +8048468: /home/drepper/gnu/new-bu/build/ttt/f.c:3:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804846b: /home/drepper/gnu/new-bu/build/ttt/f.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048470: /home/drepper/gnu/new-bu/build/ttt/f.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048472: /home/drepper/gnu/new-bu/build/ttt/f.c:5:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +off = 0 + 4 lines +10000470: /shoggoth/drepper/b.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +1000047c: /shoggoth/drepper/b.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +10000480: /shoggoth/drepper/b.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +10000490: /shoggoth/drepper/b.c:6:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +off = 418 + 4 lines +10000490: /shoggoth/drepper/f.c:3:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +1000049c: /shoggoth/drepper/f.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004a0: /shoggoth/drepper/f.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004b0: /shoggoth/drepper/f.c:5:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +off = 485 + 5 lines +100004b0: /shoggoth/drepper/m.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004cc: /shoggoth/drepper/m.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004e8: /shoggoth/drepper/m.c:7:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +100004f4: /shoggoth/drepper/m.c:8:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +10000514: /shoggoth/drepper/m.c:8:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +EOF + +# - lines.c +# int ft; +# +# int +# main (int argc, char **argv) +# { +# return ft - 42; +# } +# +# - nolines.c +# int ft = 42; +# +# gcc -g -c lines.c +# gcc -g -c nolines.c +# gcc -g -o testfilenolines lines.o nolines.o + +testrun_compare ${abs_builddir}/next-lines testfilenolines <<\EOF +off = 0 + 4 lines +400474: /home/mark/src/tests/lines.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +40047f: /home/mark/src/tests/lines.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +400488: /home/mark/src/tests/lines.c:7:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +40048a: /home/mark/src/tests/lines.c:7:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +off = 59 + 0 lines +EOF + +# See run-next-files. +# Note no, comp_dir, so all paths are relative. +testfiles testfile-only-debug-line +testrun_compare ${abs_builddir}/next-lines testfile-only-debug-line <<\EOF +off = 0 + 5 lines +804842c: m.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048432: m.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804844d: m.c:7:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048458: m.c:8:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804845a: m.c:8:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +off = 75 + 4 lines +804845c: b.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804845f: b.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048464: b.c:6:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048466: b.c:6:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +off = 480 + 4 lines +8048468: f.c:3:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +804846b: f.c:4:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048470: f.c:5:0: is_stmt:yes, end_seq:no, bb:no, prologue:no, epilogue:no +8048472: f.c:5:0: is_stmt:yes, end_seq:yes, bb:no, prologue:no, epilogue:no +EOF + +exit 0 diff --git a/tests/testfile-only-debug-line.bz2 b/tests/testfile-only-debug-line.bz2 Binary files differnew file mode 100644 index 00000000..a931bcd4 --- /dev/null +++ b/tests/testfile-only-debug-line.bz2 |
