當前位置: 首頁>>代碼示例>>Python>>正文


Python Collector.parse_assembly_text方法代碼示例

本文整理匯總了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])
開發者ID:kevincon,項目名稱:puncover,代碼行數:14,代碼來源:collector_tests.py

示例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)
開發者ID:kevincon,項目名稱:puncover,代碼行數:29,代碼來源:collector_tests.py

示例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"], [])
開發者ID:kevincon,項目名稱:puncover,代碼行數:29,代碼來源:collector_tests.py

示例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():")
開發者ID:kevincon,項目名稱:puncover,代碼行數:15,代碼來源:collector_tests.py

示例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>")
開發者ID:kevincon,項目名稱:puncover,代碼行數:16,代碼來源:collector_tests.py

示例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")
開發者ID:kevincon,項目名稱:puncover,代碼行數:18,代碼來源:collector_tests.py


注:本文中的collector.Collector.parse_assembly_text方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。