Left: | ||
Right: |
OLD | NEW |
---|---|
1 // Copyright (c) 2010 Google Inc. | 1 // Copyright (c) 2010 Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 EXPECT_EQ(0x10U, function->size); | 67 EXPECT_EQ(0x10U, function->size); |
68 EXPECT_EQ(0U, function->parameter_size); | 68 EXPECT_EQ(0U, function->parameter_size); |
69 ASSERT_EQ((size_t) 1, function->lines.size()); | 69 ASSERT_EQ((size_t) 1, function->lines.size()); |
70 Module::Line *line = &function->lines[0]; | 70 Module::Line *line = &function->lines[0]; |
71 EXPECT_EQ(0xfde4abbed390c394LL, line->address); | 71 EXPECT_EQ(0xfde4abbed390c394LL, line->address); |
72 EXPECT_EQ(0x10U, line->size); // derived from EndFunction | 72 EXPECT_EQ(0x10U, line->size); // derived from EndFunction |
73 EXPECT_TRUE(line->file == file); | 73 EXPECT_TRUE(line->file == file); |
74 EXPECT_EQ(174823314, line->number); | 74 EXPECT_EQ(174823314, line->number); |
75 } | 75 } |
76 | 76 |
77 TEST(StabsToModule, Externs) { | |
78 Module m("name", "os", "arch", "id"); | |
79 StabsToModule h(&m); | |
80 | |
81 // Feed in a few Extern symbols. | |
82 EXPECT_TRUE(h.Extern("_foo", 0xffff)); | |
83 EXPECT_TRUE(h.Extern("__Z21dyldGlobalLockAcquirev", 0xaaaa)); | |
jimb
2011/03/02 22:08:00
Isn't this the first dependency on mangling syntax
Ted Mielczarek
2011/03/03 18:36:49
You are correct. I did want to test that, since it
Ted Mielczarek
2011/03/03 19:37:12
Oh, no, actually, your existing tests have functio
| |
84 h.Finalize(); | |
85 | |
86 // Now check to see what has been added to the Module. | |
87 vector<Module::Extern *> externs; | |
88 m.GetExterns(&externs, externs.end()); | |
89 ASSERT_EQ((size_t) 2, externs.size()); | |
90 Module::Extern *extern1 = externs[0]; | |
91 EXPECT_STREQ("dyldGlobalLockAcquire()", extern1->name.c_str()); | |
92 EXPECT_EQ((Module::Address)0xaaaa, extern1->address); | |
93 Module::Extern *extern2 = externs[1]; | |
94 EXPECT_STREQ("foo", extern2->name.c_str()); | |
95 EXPECT_EQ((Module::Address)0xffff, extern2->address); | |
96 } | |
97 | |
77 TEST(StabsToModule, DuplicateFunctionNames) { | 98 TEST(StabsToModule, DuplicateFunctionNames) { |
78 Module m("name", "os", "arch", "id"); | 99 Module m("name", "os", "arch", "id"); |
79 StabsToModule h(&m); | 100 StabsToModule h(&m); |
80 | 101 |
81 // Compilation unit with one function, mangled name. | 102 // Compilation unit with one function, mangled name. |
82 EXPECT_TRUE(h.StartCompilationUnit("compilation-unit", 0xf2cfda36ecf7f46cLL, | 103 EXPECT_TRUE(h.StartCompilationUnit("compilation-unit", 0xf2cfda36ecf7f46cLL, |
83 "build-directory")); | 104 "build-directory")); |
84 EXPECT_TRUE(h.StartFunction("funcfoo", | 105 EXPECT_TRUE(h.StartFunction("funcfoo", |
85 0xf2cfda36ecf7f46dLL)); | 106 0xf2cfda36ecf7f46dLL)); |
86 EXPECT_TRUE(h.EndFunction(0)); | 107 EXPECT_TRUE(h.EndFunction(0)); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 // fallback size is something plausible | 237 // fallback size is something plausible |
217 | 238 |
218 // function size from function end | 239 // function size from function end |
219 // function size from next function start | 240 // function size from next function start |
220 // function size from cu end | 241 // function size from cu end |
221 // function size from next cu start | 242 // function size from next cu start |
222 // fallback size is something plausible | 243 // fallback size is something plausible |
223 | 244 |
224 // omitting functions outside the compilation unit's address range | 245 // omitting functions outside the compilation unit's address range |
225 // zero-line, one-line, many-line functions | 246 // zero-line, one-line, many-line functions |
OLD | NEW |