can gdb support record of execution of function? - Unix

This is a discussion on can gdb support record of execution of function? - Unix ; Hi, Can gdb record the executed function names, but not only backtrace? Such as: main() { a(); b(); c(); breakpoint. } Then when it stops on breakpoint, I can issue a command to print it has executed from a() to ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: can gdb support record of execution of function?

  1. can gdb support record of execution of function?

    Hi,

    Can gdb record the executed function names, but not only backtrace?
    Such as:

    main()
    {
    a();
    b();
    c();

    breakpoint.
    }

    Then when it stops on breakpoint, I can issue a command to print it
    has executed from a() to c(), which can't be got by backtrace.

    Thanks.
    Bin


  2. Re: can gdb support record of execution of function?

    Bin Chen writes:

    > Can gdb record the executed function names, but not only backtrace?


    No (at least not yet).

    > main()
    > {
    > a();
    > b();
    > c();
    >
    > breakpoint.
    > }
    >
    > Then when it stops on breakpoint, I can issue a command to print it
    > has executed from a() to c(), which can't be got by backtrace.


    Usually this is done by using various logging techniques.

    There is also a concept of "reverse debugging", which would allow
    you to go back and see that c() was called, and go back further to
    see that b() was also called, etc.

    There is even a debugger that implements it: http://undo-software.com/

    There is also talk of adding such functionality to gdb:
    http://sourceware.org/gdb/news/reversible.html
    but it's not there yet.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

+ Reply to Thread