当前位置: 首页>>代码示例>>Python>>正文


Python Collector.symbols方法代码示例

本文整理汇总了Python中collector.Collector.symbols方法的典型用法代码示例。如果您正苦于以下问题:Python Collector.symbols方法的具体用法?Python Collector.symbols怎么用?Python Collector.symbols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在collector.Collector的用法示例。


在下文中一共展示了Collector.symbols方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_enhance_sibling_symbols

# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import symbols [as 别名]
    def test_enhance_sibling_symbols(self):
        c = Collector()
        aeabi_drsub = {
            collector.ADDRESS: "0000009c",
            collector.SIZE: 8,
            collector.TYPE: collector.TYPE_FUNCTION,
        }
        aeabi_dsub = {
            collector.ADDRESS: "000000a4",
            collector.SIZE: 4,
            collector.TYPE: collector.TYPE_FUNCTION,
        }
        adddf3 = {
            collector.ADDRESS: "000000a8",
            collector.SIZE: 123,
            collector.TYPE: collector.TYPE_FUNCTION,
        }

        c.symbols = {int(f[collector.ADDRESS], 16): f for f in [aeabi_drsub, aeabi_dsub, adddf3]}
        c.enhance_sibling_symbols()

        self.assertFalse(aeabi_drsub.has_key(collector.PREV_FUNCTION))
        self.assertEqual(aeabi_dsub, aeabi_drsub.get(collector.NEXT_FUNCTION))

        self.assertEqual(aeabi_drsub, aeabi_dsub.get(collector.PREV_FUNCTION))
        self.assertEqual(adddf3, aeabi_dsub.get(collector.NEXT_FUNCTION))

        self.assertEqual(aeabi_dsub, adddf3.get(collector.PREV_FUNCTION))
        self.assertFalse(adddf3.has_key(collector.NEXT_FUNCTION))
开发者ID:kevincon,项目名称:puncover,代码行数:31,代码来源:collector_tests.py

示例2: test_stack_usage_line2

# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import symbols [as 别名]
 def test_stack_usage_line2(self):
     line = "puncover.c:8:43:dynamic_stack2	16	dynamic"
     c = Collector()
     c.symbols = {"123": {
         "base_file": "puncover.c",
         "line": 8,
     }}
     self.assertTrue(c.parse_stack_usage_line(line))
开发者ID:kevincon,项目名称:puncover,代码行数:10,代码来源:collector_tests.py

示例3: test_stack_usage_line

# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import symbols [as 别名]
 def test_stack_usage_line(self):
     line = "puncover.c:14:40:0	16	dynamic,bounded"
     c = Collector()
     c.symbols = {"123": {
         "base_file": "puncover.c",
         "line": 14,
     }}
     self.assertTrue(c.parse_stack_usage_line(line))
     self.assertEqual(16, c.symbols["123"]["stack_size"])
     self.assertEqual("dynamic,bounded", c.symbols["123"]["stack_qualifiers"])
开发者ID:kevincon,项目名称:puncover,代码行数:12,代码来源:collector_tests.py

示例4: test_enhance_function_size_from_assembly

# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import symbols [as 别名]
    def test_enhance_function_size_from_assembly(self):
        c = Collector()
        c.symbols = { int("0000009c", 16) : {
            collector.ADDRESS: "0000009c",
            collector.ASM: """
$t():
  9c:	f081 4100 	eor.w	r1, r1, #2147483648	; 0x80000000
  a0:	e002      	b.n	a8 <__adddf3>
  a2:	bf00      	nop
            """.split("\n")
        }}

        s = c.symbol_by_addr("9c")
        self.assertFalse(s.has_key(collector.SIZE))
        c.enhance_function_size_from_assembly()
        self.assertEqual(8, s[collector.SIZE])
开发者ID:kevincon,项目名称:puncover,代码行数:18,代码来源:collector_tests.py

示例5: test_derive_file_elements

# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import symbols [as 别名]
    def test_derive_file_elements(self):
        c = Collector()
        s1 = {collector.PATH: "/Users/behrens/Documents/projects/pebble/puncover/pebble/build/../src/puncover.c"}
        s2 = {collector.PATH: "/Users/thomas/work/arm-eabi-toolchain/build/gcc-final/arm-none-eabi/thumb2/libgcc/../../../../../gcc-4.7-2012.09/libgcc/config/arm/ieee754-df.S"}
        s3 = {collector.PATH: "src/puncover.c"}
        c.symbols = {
            1: s1,
            2: s2,
            3: s3,
        }

        c.derive_folders()
        self.assertEqual("/Users/behrens/Documents/projects/pebble/puncover/pebble/src/puncover.c", s1[collector.PATH])
        self.assertIsNotNone(s1[collector.FILE])

        self.assertEqual("/Users/thomas/work/arm-eabi-toolchain/gcc-4.7-2012.09/libgcc/config/arm/ieee754-df.S", s2[collector.PATH])
        self.assertIsNotNone(s2[collector.FILE])

        self.assertEqual("src/puncover.c", s3[collector.PATH])
        self.assertIsNotNone(s3[collector.FILE])
开发者ID:kevincon,项目名称:puncover,代码行数:22,代码来源:collector_tests.py

示例6: test_enhance_call_tree_from_assembly_line

# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import symbols [as 别名]
    def test_enhance_call_tree_from_assembly_line(self):
        c = Collector()
        f1 = "f1"
        f2 = {collector.ADDRESS: "00000088"}
        f3 = {collector.ADDRESS: "00000930"}
        c.symbols = {int(f2[collector.ADDRESS], 16): f2, int(f3[collector.ADDRESS], 16): f3}

        with patch.object(c, "add_function_call") as m:
            c.enhance_call_tree_from_assembly_line(f1, " 89e:	e9d3 0100 	ldrd	r0, r1, [r3]")
            self.assertFalse(m.called)
        with patch.object(c, "add_function_call") as m:
            c.enhance_call_tree_from_assembly_line(f1, "934:	f7ff bba8 	b.w	88 <jump_to_pbl_function>")
            m.assert_called_with(f1,f2)
        with patch.object(c, "add_function_call") as m:
            c.enhance_call_tree_from_assembly_line(f1, "8e4:	f000 f824 	bl	930 <app_log>")
            m.assert_called_with(f1,f3)

        with patch.object(c, "add_function_call") as m:
            c.enhance_call_tree_from_assembly_line(f1, "6c6:	d202      	bcs.n	88 <__aeabi_ddiv+0x6e>")
            m.assert_called_with(f1,f2)

        with patch.object(c, "add_function_call") as m:
            c.enhance_call_tree_from_assembly_line(f1, " 805bbac:	2471 0805 b64b 0804 b3c9 0804 b459 0804     q$..K.......Y...")
            self.assertFalse(m.called)
开发者ID:kevincon,项目名称:puncover,代码行数:26,代码来源:collector_tests.py


注:本文中的collector.Collector.symbols方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。