Skip to content

Instantly share code, notes, and snippets.

@clsn
Created August 17, 2012 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clsn/3379853 to your computer and use it in GitHub Desktop.
Save clsn/3379853 to your computer and use it in GitHub Desktop.
gdb mystery...
[mark@dev ~]$ cat A.c
#include <string.h>
int
main() {
}
[mark@dev ~]$ cc -g -c -o A32.o A.c
[mark@dev ~]$ cc -g -c -o A64.o +DD64 A.c
[mark@dev ~]$ cc -g -o A32 A32.o
[mark@dev ~]$ cc -g -o A64 +DD64 A64.o
[mark@dev ~]$ gdb ./A32
HP gdb 6.1 for HP Itanium (32 or 64 bit) and target HP-UX 11iv2 and 11iv3.
Copyright 1986 - 2009 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 6.1 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
..
(gdb) stop in main
Breakpoint 1 at 0x40007e0:0: file A.c, line 4 from /home/mark/./A32.
(gdb) run
Starting program: /home/mark/./A32
Breakpoint 1, main () at A.c:4
4 }
(gdb) p memcmp("A","A",1)
$1 = 0
(gdb) c
Continuing.
Program exited normally.
(gdb) exit
[mark@dev ~]$ gdb ./A64
HP gdb 6.1 for HP Itanium (32 or 64 bit) and target HP-UX 11iv2 and 11iv3.
Copyright 1986 - 2009 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 6.1 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
..
(gdb) stop in main
Breakpoint 1 at 0x4000000000000ae0:0: file A.c, line 4 from /home/mark/./A64.
(gdb) run
Starting program: /home/mark/./A64
Breakpoint 1, main () at A.c:4
4 }
(gdb) p memcmp("A","A",1)
$1 = 1
(gdb) c
Continuing.
Program exited normally.
(gdb) exit
[mark@dev ~]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment