www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/26/05:56:44

Date: Fri, 26 Aug 94 18:57:11 +1000
From: junaid AT monu6 DOT cc DOT monash DOT edu DOT au (Mr A. Walker)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: gdb calling functions

	Well i have an extra dribble of information regarding gdb calling
functions in the debugee program.

	If you stop at some point in you program (ie at a breakpoint)
and do a 'info reg' to dump the register values, then do a 'print func()'
all is fine.
	A further 'info reg' shows the registers in the same state as before
the user function call.
	Now if a 'ni' to step to the next instruction i 
is executed, then the eip goes into the nether regions, in my case the
program resumes e       execution high up in the stack region!
	A few more ni and the   program eventually causes a segv, after
executing garbage in the stack. 
	Why is this so?  I can only guess;
1) The  call to func() is executed properlly, but the return address is
wrong because the calling stack hasnt been set up properly by gdb.
'info reg' shows the pre-call registers (after the call!).
2) go32 messes up after the call to func() and apon resumption of the next
debugee instruction.

	BTW how can you refer to a register    value as a gdb expression?
How to debug gdb?

	Finally, on little 'feature'; info reg prints the first colum
in hex, and the second in decimal.  A few of the second   column are again
in hex??!

	Junaid

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019