aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@codesourcery.com>2011-10-04 14:25:40 +0000
committerCarlos O'Donell <carlos@codesourcery.com>2011-10-04 14:25:40 +0000
commit4eee63bce83d1df7e6b6fa1a3c52b2db80a7529d (patch)
treec0506e91d9c291a7f37ac7320c15c0eb86178b04
parentcb6be26b8b0a1bf6bb4da1eb5841119d73220fd5 (diff)
downloadgdb-4eee63bce83d1df7e6b6fa1a3c52b2db80a7529d.zip
gdb-4eee63bce83d1df7e6b6fa1a3c52b2db80a7529d.tar.gz
gdb-4eee63bce83d1df7e6b6fa1a3c52b2db80a7529d.tar.bz2
binutils/
2011-10-04 Paul Woegerer <paul_woegerer@mentor.com> Carlos O'Donell <carlos@codesourcery.com> * dwarf.c (display_debug_lines_decoded): Index directory_table with directory_index from file_table entry. binutils/testsuite/ 2011-10-04 Carlos O'Donell <carlos@codesourcery.com> * binutils-all/dw2-decodedline.S: New file. * binutils-all/objdump.WL: New file. * binutils-all/objdump.exp: Update copyright year. New test case for -WL.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/dwarf.c7
-rw-r--r--binutils/testsuite/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/dw2-decodedline.S16
-rw-r--r--binutils/testsuite/binutils-all/objdump.WL15
-rw-r--r--binutils/testsuite/binutils-all/objdump.exp27
6 files changed, 74 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 9d1850e..9f10a2b 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-04 Paul Woegerer <paul_woegerer@mentor.com>
+ Carlos O'Donell <carlos@codesourcery.com>
+
+ * dwarf.c (display_debug_lines_decoded): Index directory_table with
+ directory_index from file_table entry.
+
2011-09-30 Cary Coutant <ccoutant@google.com>
* binutils/dwarf.h (dwarf_section_display_enum): Add missing enum
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 1ee0e33..f4b7f73 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2961,9 +2961,10 @@ display_debug_lines_decoded (struct dwarf_section *section,
}
else
{
- if (do_wide || strlen ((char *) directory_table[0]) < 76)
- printf (_("CU: %s/%s:\n"), directory_table[0],
- file_table[0].name);
+ unsigned int ix = file_table[0].directory_index;
+ const char *directory = ix ? (char *)directory_table[ix - 1] : ".";
+ if (do_wide || strlen (directory) < 76)
+ printf (_("CU: %s/%s:\n"), directory, file_table[0].name);
else
printf ("%s:\n", file_table[0].name);
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 068733e..24fa5c5 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-04 Carlos O'Donell <carlos@codesourcery.com>
+
+ * binutils-all/dw2-decodedline.S: New file.
+ * binutils-all/objdump.WL: New file.
+ * binutils-all/objdump.exp: Update copyright year.
+ New test case for -WL.
+
2011-09-28 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* binutils-all/elfedit-4.d: Give test a unique name.
diff --git a/binutils/testsuite/binutils-all/dw2-decodedline.S b/binutils/testsuite/binutils-all/dw2-decodedline.S
new file mode 100644
index 0000000..3656e62
--- /dev/null
+++ b/binutils/testsuite/binutils-all/dw2-decodedline.S
@@ -0,0 +1,16 @@
+ .file "dw2-decodedline.c"
+ .file 1 "dw2-decodedline.c"
+ .file 2 "directory/file1.c"
+ .text
+.globl f1
+ .type f1, %function
+f1:
+ .loc 2 1 0
+ nop
+ .size f1, .-f1
+.globl main
+ .type main, %function
+main:
+ .loc 1 2 0
+ nop
+ .size main, .-main
diff --git a/binutils/testsuite/binutils-all/objdump.WL b/binutils/testsuite/binutils-all/objdump.WL
new file mode 100644
index 0000000..3846f4f
--- /dev/null
+++ b/binutils/testsuite/binutils-all/objdump.WL
@@ -0,0 +1,15 @@
+
+.*dw2-decodedline.o: file format .*
+
+Decoded dump of debug contents of section \.debug_line:
+
+CU: \./dw2-decodedline\.c:
+File name Line number Starting address
+
+directory/file1\.c:
+file1\.c 1 .*
+
+
+\./dw2-decodedline\.c:\[\+\+\]
+dw2-decodedline\.c 2 .*
+
diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp
index d5879aa..ef5f246 100644
--- a/binutils/testsuite/binutils-all/objdump.exp
+++ b/binutils/testsuite/binutils-all/objdump.exp
@@ -1,5 +1,5 @@
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2007, 2008, 2009
+# 2003, 2004, 2007, 2008, 2009, 2011
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -202,6 +202,31 @@ if { ![is_elf_format] } then {
}
}
+# Test objdump -WL on a file that contains line information for multiple files and search directories.
+
+if { ![binutils_assemble $srcdir/$subdir/dw2-decodedline.S tmpdir/dw2-decodedline.o] } then {
+ fail "objdump decoded line"
+}
+
+if [is_remote host] {
+ set decodedline_testfile [remote_download host tmpdir/dw2-decodedline.o]
+} else {
+ set decodedline_testfile tmpdir/dw2-decodedline.o
+}
+
+set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -WL $decodedline_testfile" "" "/dev/null" "objdump.out"]
+
+if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "objdump -WL (reason: unexpected output)"
+ send_log $got
+ send_log "\n"
+}
+
+if { [regexp_diff objdump.out $srcdir/$subdir/objdump.WL] } then {
+ fail "objdump -WL"
+} else {
+ pass "objdump -WL"
+}
# Options which are not tested: -a -d -D -R -T -x -l --stabs
# I don't see any generic way to test any of these other than -a.