site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=1wxh2X83kZsy7bynPb5GnJrTltvNcumkiCxqM4LuGnU=; b=ImSUysWBggqT0B/p07C24hKEATVBOul86hruyb/o6oU5WAf9n+nfImrp5xkTkFGPN3 I0f5YdKANRZa21WNkvvGIT3vbrFOvoY22Kdi/BtL9acDtpKvhgE3ugSF8NO099xZf9IS jWF1Hqz0GDzu5ph9fDwQbw0J5LJLFfWhpZ/pY= 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),%ebx 0x00001117: mov $0x0,%eax 0x0000111c: mov 0x1121(,%ebx,4),%edx 0x00001123: jmp 0x1129 0x00001125: add %al,(%eax) 0x00001127: add %al,(%eax) 0x00001129: call 0x1148 0x0000112e: push %eax 0x0000112f: mov %esp,%ebx 0x00001131: push $0x4 0x00001133: push %ebx 0x00001134: push $0x1 0x00001136: push $0x0 0x00001138: mov $0x4,%eax 0x0000113d: int $0x80 0x0000113f: push %eax 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Ben L. Titzer