Re: GDB Trace functions calls when executing a program
Yubin Ruan <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <20180308014408.GA6094@HP> |
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