Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    GDB Backtrace internal working??

    i am using GDB and i have come across the command bt or backtrace
    i found it very interesting and tried the internet for more information about it
    but all i could get is what would be the output of the command.
    can anyone of you please explain the INTERNAL WORKING OF BACKTRACE
    what all happens in the kernel when this command is called..

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    So basically, gdb is a very complicated frontend for a system call called [b]ptrace[b]. If you run the command "man ptrace", you can learn more about this.

    Anyway, ptrace allows a superior process to monitor the execution of an inferior one. This is what gdb does: it traces the application that you've told it about.

    Therefore, the way that I imagine "bt" works is that gdb keeps an internal count of what functions are invoked, and just prints them when you call "bt". The cool part here is not what happens when "bt" is invoked, but rather how gdb monitors the calling and returning from functions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts