From: Yubin Ruan <ablacktshirt@gmail.com>
To: Satya Prakash Prasad <satyaprakash.prasad@gmail.com>
Cc: gdb-info@sourceware.org, gdb-faq@sourceware.org, gdb@sourceware.org
Subject: Re: GDB Trace functions calls when executing a program
Date: Wed, 07 Mar 2018 01:44:00 -0000 [thread overview]
Message-ID: <20180308014408.GA6094@HP> (raw)
In-Reply-To: <CACX5wchUEWN3fB6WKSrd7bSjuPLO6Mfw=20s-yqFNUQZ-v4ojQ@mail.gmail.com>
On Wed, Feb 28, 2018 at 08:49:17PM +0530, Satya Prakash Prasad wrote:
> Please let me know if in GDB there is a way to print function names when
> program is executing - this is to just track / trace the code flow.
>
> Generally in projects which has thousands of lines of code - it is very
> difficult to trace a flow. The first is to decide where to put a breakpoint
> for analysis. But to know the place to put breakpoint we need to know where
> to enable it - I mean it should be within a function of a flow.
>
> So can we just enable some command and let the program when running using
> gdb - gdb can simply print functions name as it executes them.
>
> Is the same possible?
Do you have access to the source? If so, why not simply add a print at the
very beginning of every function call:
print("function called: %s\n", __FUNC__);
I know that strace can be used to trace system calls, but not normal function
calls. Maybe try LTTng: https://lttng.org/
Yubin
next prev parent reply other threads:[~2018-03-07 1:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 15:19 Satya Prakash Prasad
2018-03-07 1:44 ` Yubin Ruan [this message]
2018-03-07 6:17 ` Satya Prakash Prasad
2018-03-07 6:46 ` Jonah Graham
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=20180308014408.GA6094@HP \
--to=ablacktshirt@gmail.com \
--cc=gdb-faq@sourceware.org \
--cc=gdb-info@sourceware.org \
--cc=gdb@sourceware.org \
--cc=satyaprakash.prasad@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