public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: phoeagon <phoeagon@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Call function but step by step?
Date: Sun, 06 Nov 2011 09:54:00 -0000	[thread overview]
Message-ID: <20111106095409.GA31422@host1.jankratochvil.net> (raw)
In-Reply-To: <CAKYApDAwbqwbD4NPjAEb9=i6Ee-6Cf4F2CL5r4yLq_Nsoe_+jw@mail.gmail.com>

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

      reply	other threads:[~2011-11-06  9:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-06  9:47 phoeagon
2011-11-06  9:54 ` Jan Kratochvil [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111106095409.GA31422@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=phoeagon@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).