GDB breakpoint at address
GDB breakpoint at address
- Subject: GDB breakpoint at address
- From: "Ben L. Titzer" <email@hidden>
- Date: Wed, 03 Aug 2011 17:46:26 -0700
I am generating very simple Mach-O binaries by hand without symbol
information and trying to debug them with gdb by setting breakpoints
at various addresses. However, the breakpoints I set do not fire,
though I am certain those addresses are being executed (program runs
to completion, I can put in illegal instructions and they trap in gdb,
my program makes system calls that output to stdout, etc).
When I debug other binaries (e.g. generated by gcc), I am able to set
breakpoints at various addresses and they fire in gdb no problem.
Even though my binaries load and run correctly, producing the correct
output, gdb breakpoints don't work. If I explicitly insert an int3
instruction, a gdb breakpoint does occur.
I have a feeling that I am missing some step that is required by gdb,
such as setting an attribute or adding an extra section to my binary,
but I don't know what.
uname -a
Darwin goro 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16
PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386
I've attached a sample gdb session.
-------------------
% gdb /tmp/add01
GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...
(gdb) break *0x1114
Breakpoint 1 at 0x1114
(gdb) run
Starting program: /private/tmp/add01
Program exited with code 04.
(gdb) disass 0x1114 0x1140
Dump of assembler code from 0x1114 to 0x1140:
0x00001114: mov (%esp),ëx
0x00001117: mov $0x0,êx
0x0000111c: mov 0x1121(,ëx,4),íx
0x00001123: jmp 0x1129
0x00001125: add %al,(êx)
0x00001127: add %al,(êx)
0x00001129: call 0x1148
0x0000112e: push êx
0x0000112f: mov %esp,ëx
0x00001131: push $0x4
0x00001133: push ëx
0x00001134: push $0x1
0x00001136: push $0x0
0x00001138: mov $0x4,êx
0x0000113d: int $0x80
0x0000113f: push êx
End of assembler dump.
(gdb) break *0x1148
Breakpoint 2 at 0x1148
(gdb) run
Starting program: /private/tmp/add01
Program exited with code 04.
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00001114
2 breakpoint keep y 0x00001148
(gdb)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden