|
Project Information
Members
|
Python modules for Software Development ToolsPyDevTools is a suite of python modules for the rapid prototyping of software development tools. Currently, the project include modules for:
Please, report a new issue for bugs, or desired features. (possibly, attaching the target ELF file to reproduce the issue). E-mail the project owner for any feedback, or for joining the project. Large part of the modules has been developed for internal applications at CSR (copyright owner). CSR allowed to release the whole project under the BSD license. Installeasy_install BinTools Dwarf Dump$ ./dwarfdump.py ../test/test
[...]
<1><137> subprogram
external: True
name: dummy_a
decl_file: a/test.c
decl_line: 10
prototyped: True
low_pc: 0x08048403
high_pc: 0x08048410
frame_base:
<0x1f:0x20> DW_OP_breg4:+4
<0x20:0x22> DW_OP_breg4:+8
<0x22:0x2c> DW_OP_breg5:+8
<1><158> variable
name: my_static_var
decl_file: a/test.c
decl_line: 4
type: 79
location: DW_OP_addr:+134520852
.debug_line: line number info for a single cu
a/test.c [ 6,0] 0x080483e4 - is_stmt
a/test.c [ 7,0] 0x080483ea - is_stmt
a/test.c [ 8,0] 0x08048401 - is_stmt
a/test.c [ 10,0] 0x08048403 - is_stmt
a/test.c [ 11,0] 0x08048409 - is_stmt
[...]DWARF Viewer./dwarfviewer.py ../test/test
DWARF Queryclass TestDwarfQuery(TestCase):
def setUp(self):
self.dwarf = DWARF('../test/test')
def test_loc_by_addr(self):
loc = self.dwarf.get_loc_by_addr(0x8048475)
self.assertEqual(loc, ('/home/emilmont/Workspace/dbg/test/main.c', 36, 0))
def test_loc_by_sym(self):
loc = self.dwarf.get_loc_by_sym('main')
self.assertEqual(loc, ('/home/emilmont/Workspace/dbg/test/main.c', 54, 0))
loc = self.dwarf.get_loc_by_sym('temp')
self.assertEqual(loc, ('/home/emilmont/Workspace/dbg/test/main.c', 15, 0))
def test_addr_by_sym(self):
addr = self.dwarf.get_addr_by_sym('main')
self.assertEqual(addr, 0x80484ac)
def test_addr_by_loc(self):
addr = self.dwarf.get_addr_by_loc('a/test.c', 10)
self.assertEqual(addr, 0x8048403)ELF>>> from bintools.elf import ELF
>>> elf = ELF('../test/test')
>>> for s in elf.sect_dict['.text'].get_symbols():
... print s.get_name()
...
__do_global_dtors_aux
frame_dummy
__do_global_ctors_aux
my_static_func
f3
f2
__libc_csu_fini
_start
__libc_csu_init
f1
dummy_a
__i686.get_pc_thunk.bx
main
dummy_b
[...]
|