This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/11760] New: Can't patch binary with gdb 7.1 on Mac OS X
- From: "collberg at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 28 Jun 2010 01:18:41 -0000
- Subject: [Bug gdb/11760] New: Can't patch binary with gdb 7.1 on Mac OS X
- Reply-to: sourceware-bugzilla at sourceware dot org
I'm unable to successfully patch a binary using gdb, on
Mac OS X. Depending on the exact commands, the
results are slightly different, but they never "work" -
gdb never produces a correctly patched runnable binary.
Example:
=========================================
#include<stdio.h>
int main (int argc, char *argv[]) {
int x = 6*argc;
if (argc>1)
printf("This is a test, %i\n", x);
else
printf("And here's another one, %i\n", x);
return 0;
}
=========================================
gcc -g -o test test.c
=========================================
> ~/bin/gdb -write test
GNU gdb (GDB) 7.1
This GDB was configured as "x86_64-apple-darwin10".
(gdb) break main
Breakpoint 1 at 0x100000eb7: file test.c, line 5.
(gdb) run
Breakpoint 1, main (argc=1, argv=0x7fff5fbff670) at test.c:5
5 int x = 6*argc;
(gdb) step
6 if (argc>1)
(gdb) x/i $pc
=> 0x100000ec6 <main+30>: cmpl $0x1,-0x14(%rbp)
(gdb)
0x100000eca <main+34>: jle 0x100000ee2 <main+58>
(gdb) set {unsigned char}0x0000000100000c4f = 0x7f
(gdb) cont
Continuing.
And here's another one, 6
Program exited normally.
(gdb) quit
unable to write unknown load command 0x22
warning: cannot close ".../test": File in wrong format
======================================
--
Summary: Can't patch binary with gdb 7.1 on Mac OS X
Product: gdb
Version: 7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gdb
AssignedTo: unassigned at sourceware dot org
ReportedBy: collberg at gmail dot com
CC: gdb-prs at sourceware dot org
GCC host triplet: Mac OS X 10.6.3
GCC target triplet: Mac OS X 10.6.3
http://sourceware.org/bugzilla/show_bug.cgi?id=11760
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.