本文整理汇总了Python中collector.Collector.parse_assembly_text方法的典型用法代码示例。如果您正苦于以下问题:Python Collector.parse_assembly_text方法的具体用法?Python Collector.parse_assembly_text怎么用?Python Collector.parse_assembly_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collector.Collector
的用法示例。
在下文中一共展示了Collector.parse_assembly_text方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_derive_filename_from_assembly
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import parse_assembly_text [as 别名]
def test_derive_filename_from_assembly(self):
c = Collector()
c.parse_assembly_text("""
000008a8 <uses_doubles2.constprop.0>:
uses_doubles2():
/Users/behrens/Documents/projects/pebble/puncover/pebble/build/../src/puncover.c:19
8a8: b508 push {r3, lr}
""")
s = c.symbol_by_addr("8a8")
self.assertEqual("/Users/behrens/Documents/projects/pebble/puncover/pebble/build/../src/puncover.c", s[collector.PATH])
self.assertEqual("puncover.c", s[collector.BASE_FILE])
self.assertEqual(19, s[collector.LINE])
示例2: test_parses_assembly_and_stops_after_function
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import parse_assembly_text [as 别名]
def test_parses_assembly_and_stops_after_function(self):
assembly = """
000034fc <window_raw_click_subscribe>:
$t():
34fc: b40f push {r0, r1, r2, r3}
34fe: 4901 ldr r1, [pc, #4] ; (3504 <window_raw_click_subscribe+0x8>)
3500: f7fc bdc2 b.w 88 <jump_to_pbl_function>
$d():
3504: 000004c4 .word 0x000004c4
3508: 00040000 .word 0x00040000
350c: 000b008d .word 0x000b008d
00003510 <.LC1>:
.LC1():
3510: 69727073 .word 0x69727073
3514: 42736574 .word 0x42736574
3518: 31647269 .word 0x31647269
351c: 0036 .short 0x0036
"""
c = Collector()
self.assertEqual(2, c.parse_assembly_text(assembly))
self.assertTrue(c.symbols.has_key(0x000034fc))
self.assertEqual(c.symbols[0x000034fc]["name"], "window_raw_click_subscribe")
# print "\n".join(c.symbols["000034fc"]["asm"])
self.assertEqual(len(c.symbols[0x000034fc]["asm"]), 8)
示例3: test_enhances_caller
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import parse_assembly_text [as 别名]
def test_enhances_caller(self):
assembly = """
00000098 <pbl_table_addr>:
8e4: f000 f824 bl 930 <app_log>
00000930 <app_log>:
$t():
"""
c = Collector()
self.assertEqual(2, c.parse_assembly_text(assembly))
self.assertTrue(c.symbols.has_key(0x00000098))
self.assertTrue(c.symbols.has_key(0x00000930))
pbl_table_addr = c.symbols[0x00000098]
app_log = c.symbols[0x00000930]
self.assertFalse(pbl_table_addr.has_key("callers"))
self.assertFalse(pbl_table_addr.has_key("callees"))
self.assertFalse(app_log.has_key("callers"))
self.assertFalse(app_log.has_key("callees"))
c.enhance_call_tree()
self.assertEqual(pbl_table_addr["callers"], [])
self.assertEqual(pbl_table_addr["callees"], [app_log])
self.assertEqual(app_log["callers"], [pbl_table_addr])
self.assertEqual(app_log["callees"], [])
示例4: test_parses_assembly_and_ignores_c
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import parse_assembly_text [as 别名]
def test_parses_assembly_and_ignores_c(self):
assembly = """
00000098 <pbl_table_addr>:
/path/to.c:8
pbl_table_addr():
98: a8a8a8a8 .word 0xa8a8a8a8
"""
c = Collector()
self.assertEqual(1, c.parse_assembly_text(assembly))
self.assertTrue(c.symbols.has_key(0x00000098))
self.assertEqual(c.symbols[0x00000098]["name"], "pbl_table_addr")
self.assertEqual(len(c.symbols[0x00000098]["asm"]), 2)
self.assertEqual(c.symbols[0x00000098]["asm"][0], "pbl_table_addr():")
示例5: test_enhances_assembly
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import parse_assembly_text [as 别名]
def test_enhances_assembly(self):
assembly = """
00000098 <pbl_table_addr>:
pbl_table_addr():
568: f7ff ffca bl 98
"""
c = Collector()
self.assertEqual(1, c.parse_assembly_text(assembly))
self.assertTrue(c.symbols.has_key(0x00000098))
self.assertEqual(c.symbols[0x00000098]["name"], "pbl_table_addr")
self.assertEqual(c.symbols[0x00000098]["asm"][1], " 568:\tf7ff ffca \tbl\t98")
c.enhance_assembly()
self.assertEqual(c.symbols[0x00000098]["asm"][1], " 568:\tf7ff ffca \tbl\t98 <pbl_table_addr>")
示例6: test_parses_assembly2
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import parse_assembly_text [as 别名]
def test_parses_assembly2(self):
assembly = """
00000098 <pbl_table_addr.constprop.0>:
pbl_table_addr():
98: a8a8a8a8 .word 0xa8a8a8a8
0000009c <__aeabi_dmul>:
__aeabi_dmul():
9c: b570 push {r4, r5, r6, lr}
"""
c = Collector()
self.assertEqual(2, c.parse_assembly_text(assembly))
self.assertTrue(c.symbols.has_key(0x0000009c))
self.assertEqual(c.symbols[0x0000009c]["name"], "__aeabi_dmul")
self.assertTrue(c.symbols.has_key(0x00000098))
self.assertEqual(c.symbols[0x00000098]["name"], "pbl_table_addr")