Thread: Symbolic debugging

  1. #1
    Amateur
    Join Date
    Sep 2003
    Posts
    228

    Symbolic debugging

    Does anyone know how symbolic debuggers bind the names with the variable and functions and how the compiler create them?

  2. #2
    .
    Join Date
    Nov 2003
    Posts
    307
    Symbolic debuggers run in a separate process space and
    create a child process for the code bering debugged. The debugger calls ReadProcessMemory and WriteProcess memory in the child process to find values. It also keeps track of the user stack pointers, so that you can display the entry points on the stack. Most debuggers, except kd, cannot do kernel mode symbol translation and tracking. For each stack frame pushed or popped, the debugger has to re-translate all of the symbols as a new function call comes into or leaves scope.

    Each code segment has an optional symbol table (not there in production code) which has the names of the symbols and their addresses. Depending on the debugger & compiler, the symbol table either uses the external file and line numbers or it stores that information internally in a global symbol table.

    The debugger translates the PC register (program counter) of the child to find which symbols & line of code are in scope. This is why the debugger can't resolve some symbols even though you think they should be in scope. It hasn't seen a reference to that symbol yet, so it has not bothered to translate it.

    In other words:
    $DATA$ segment has symbols associated with the starting point in memory for each entry in the symbol list.

    $CODE$ segment has symbols & addresses for each entry point and line of code in each function.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 06-01-2009, 07:54 PM
  2. Dev-C++: Problems with Breakpoint Debugging
    By Thileepan_Bala in forum C Programming
    Replies: 1
    Last Post: 01-17-2008, 10:48 AM
  3. Problem in debugging in Eclipse
    By Bargi in forum Linux Programming
    Replies: 1
    Last Post: 08-21-2007, 09:53 AM
  4. Debugging book recommendation
    By dagans in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 09-13-2005, 07:35 PM
  5. Going out of scope
    By nickname_changed in forum C++ Programming
    Replies: 9
    Last Post: 10-12-2003, 06:27 PM