Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jan 98 12:44:13 EST
From:      luoqi@watermarkgroup.com (Luoqi Chen)
To:        current@freebsd.org
Subject:   gdb addressing off by 0x20
Message-ID:  <9801121744.AA19905@watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
Has anyone else noticed this? When I debug a program with gdb, I have to
specify x+0x20 if I want to get data at address x. For example,

% gdb /bin/sh
GDB is free software and you are welcome to 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.
GDB 4.16 (i386-unknown-freebsd),
Copyright 1996 Free Software Foundation, Inc...(no debugging symbols found)...
(gdb) info target
Symbols from "/bin/sh".
Local exec file:
        `/bin/sh', file type a.out-i386-freebsd.
        Entry point: 0x1020
        0x00001020 - 0x0004a020 is .text
        0x0004b000 - 0x0004e000 is .data
        0x0004e000 - 0x000565d0 is .bss
(gdb) x/10i 0x1020			<-- entry point, should show valid
0x1020: int3				<-- op codes, but garbage instead
0x1021: addb   %al,0x4900000(%esi)
0x1027: addb   %al,(%eax)
0x1029: xorb   %al,(%eax)
0x102b: addb   %dl,%al
0x102d: testl  %eax,(%eax)
0x102f: addb   %al,(%eax)
0x1031: addb   %al,(%eax)
0x1033: addb   %ah,(%eax)
0x1035: adcb   %al,(%eax)
(gdb) x/10i 0x1040
0x1040: pushl  %ebp
0x1041: movl   %esp,%ebp
0x1043: pushl  %esi
0x1044: pushl  %ebx
0x1045: leal   0x4(%ebp),%ebx
0x1048: leal   0x4(%ebx),%ecx
0x104b: leal   0x8(%ebx),%edx
0x104e: cmpl   $0x0,0x4(%ebx)
0x1052: je     0x105d
0x1054: movl   (%edx),%eax

I am running UP kernel cvsupped Sat(1/10) morning.

-lq



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9801121744.AA19905>