This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Address to symbol conversion problem
- From: "Gerrit van Niekerk" <gerritvn at gpvno dot co dot za>
- To: gdb at sourceware dot org
- Date: Fri, 11 Jan 2008 17:04:29 +0200
- Subject: Address to symbol conversion problem
- Reply-to: gerritvn at gpvno dot co dot za,gpvno at telkomsa dot net
I am using DJGPP to compile a program for running on a DOS target. The program has a GDB remote
stub using TCP/IP. In WindowsXP I use EXE2COFF in order to get symbols for Mingw GDB in WinXP for
remote debugging on the DOS target. All this works fine, except that address to symbol conversions
give wrong results. Symbol to address conversions work correctly.
How can I fix this problem?
The following demonstrates the problem. The function breakpoint() in i386-stub.c is called from
main() in Merlin.c. A "backtrace" command gives completely wrong results as do a "step" as can be
seen below. The "step" should return to main(), which it does, but GDB displays FrontScreen() which
is wrong. Putting a breakpoint at FrontScreen() works fine.
C:\Develop\domino\PVCSWO~1\Working>mgdb m700sdpg
GNU gdb 6.7.50.20071127
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) target remote 192.168.0.2:2000
Remote debugging using 192.168.0.2:2000
breakpoint () at i386-stub.c:1056
1056 }
(gdb) s
FrontScreen () at Merlin.c:1292
1292 }
(gdb) info source
Current source file is Merlin.c
Compilation directory is c:/Develop/domino/pvcsworkarea/Working
Located in c:/Develop/domino/pvcsworkarea/Working/Merlin.c
Contains 1824 lines.
Source language is c.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
(gdb) info address main
Symbol "main" is a function at address 0x32267.
(gdb) info symbol 0x32267
EnterString + 673 in section .text
(gdb) info address FrontScreen
Symbol "FrontScreen" is a function at address 0x31754.
(gdb) p $eip
$1 = (void (*)()) 0x33167 <FrontScreen+3>
(gdb) p /x $eip
$2 = 0x33167
(gdb) info symbol 0x33167
FrontScreen + 3 in section .text
(gdb) b FrontScreen
Breakpoint 1 at 0x3175a: file Merlin.c, line 239.
(gdb) c
Continuing.
Breakpoint 1, FrontScreen () at Merlin.c:239
239 if(msg_display[0] != NULL)
(gdb) p $eip
$3 = (void (*)()) 0x3175a <FrontScreen+6>
(gdb) info symbol 0x3175a
GetMenuSelection + 823 in section .text
(gdb)--
Gerrit van Niekerk
GP van Niekerk Ondernemings BK
Roosstraat 211, Meyerspark, 0184, South Africa
Tel: +27(12)8036501 Fax SA: 0866 413 555
Cell: +27(73)6891370
Fax Int'l: +1(206)2034139
Email: gerritvn@gpvno.co.za
Web: http://www.gpvno.co.za