This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix a buglet in maintenance_translate_address()


Attached patch fixes a buglet I noticed in maintenance_translate_address().

To observe the buglet:

echo "int main() { return 0; }" | gcc -g -xc -
gdb -ex 'set prompt (top) ' --args gdb ./a.out

(top) run
(gdb) break main
Breakpoint 1 at 0x40046c: file <stdin>, line 1.
(gdb) run

Breakpoint 1, main () at <stdin>:1
1       <stdin>: No such file or directory.
        in <stdin>
(gdb) p &main
$1 = (int (*)()) 0x400468 <main>
(gdb) maint translate-address no-such-section 0x400468

Program received signal SIGSEGV, Segmentation fault.
0x00000000004c879a in matching_obj_sections (obj_first=0xa57688, obj_second=0x3256290) at ../../src/gdb/symtab.c:726
726       if (first->owner == NULL || second->owner == NULL)
(top) p first
$1 = (asection *) 0xa58740
(top) p first.owner
$2 = (bfd *) 0xa44e30
(top) p second.owner
Cannot access memory at address 0x2aaaadf090d8

Committed as obvious.

Paul Pluzhnikov

2008-11-18  Paul Pluzhnikov  <>

	* maint.c (maintenance_translate_address): Fix a buglet.
Index: maint.c
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.69
diff -u -p -u -r1.69 maint.c
--- maint.c	18 Nov 2008 21:31:26 -0000	1.69
+++ maint.c	18 Nov 2008 22:45:23 -0000
@@ -473,7 +473,7 @@ maintenance_translate_address (char *arg
-      if (!sect)
+      if (!objfile)
 	error (_("Unknown section %s."), arg);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]