This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Call function but step by step?


On Sun, 06 Nov 2011 10:46:58 +0100, phoeagon wrote:
> eh, i wonder if this feature exists or if it's appropriate to add.
>  that is to call a function explicitly (just like "call func" command)
> but instead of executing the function all at once, the cursor stops at
> the entry (as if the function is called at the point and we used step
> in to trace into it) and wait for further commands (which can be, say,
> step or next, which is very useful)...

It is a common practice:

(gdb) break new_block
Breakpoint 2 at 0x7d44fb: file mdebugread.c, line 4867.
(gdb) p new_block(0)

Breakpoint 2, new_block (type=FUNCTION_BLOCK) at mdebugread.c:4867
4867	  struct block *retval = xzalloc (sizeof (struct block));
The program being debugged stopped while in a function called from GDB.
Evaluation of the expression containing the function
(new_block) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb) bt
#0  new_block (type=FUNCTION_BLOCK) at mdebugread.c:4867
#1  <function called from gdb>
#2  main (argc=1, argv=0x7fffffffdfe8) at gdb.c:30
(gdb) next
4869	  if (type == FUNCTION_BLOCK)


Regards,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]