Skip to content
  • David Johnson's avatar
    Add libdwdebug, a semi-generic debugging library. · b8c70d52
    David Johnson authored
    As the name implies, dwdebug can "parse" DWARF debug info from ELF
    object files, but it is supposed to be much more than that.  The
    design includes what I would call a pretty standard set of debugger
    objects -- targets, address spaces, debugfiles, symtabs, symbols, etc.
    
    Then, of course, you can attach debugfiles (populated by the DWARF
    backend) to address spaces, which are themselves associated with targets.
    
    I only prototyped one target for testing, and that's a Linux userspace
    ptrace-based target.  Right now it just can read/write memory.
    
    As usual for an early project, the APIs are incomplete, probably subject
    to massive changes, etc.
    
    There are two demo programs at the moment.  targetdumpval will load up
    a linux ptrace target (attaches to a running process) and can dump a
    memory value on every debugging event.
    
    dumpdebuginfo loads DWARF debug data from an ELF object file into
    symtabs and symbols, then dumps it to the screen.  If you run it on the
    Linux kernel (vmlinux), it will generate output of ~300MB and take
    quite some time.  If you redirect to /dev/null, it'll take about 5 seconds.
    
    Nothing has been optimized; I'm sure there's a lot of memory wastage in the
    parsing/symtab population processes; the DWARF expression and location list
    "evaluators" are missing (I just hacked enough expression evaluation in to
    get us started)...
    b8c70d52