| OLD | NEW |
| 1 // -*- mode: c++ -*- | 1 // -*- mode: c++ -*- |
| 2 | 2 |
| 3 // Copyright (c) 2010 Google Inc. All Rights Reserved. | 3 // Copyright (c) 2010 Google Inc. All Rights Reserved. |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 class MockDIEHandler: public DIEHandler { | 61 class MockDIEHandler: public DIEHandler { |
| 62 public: | 62 public: |
| 63 MOCK_METHOD3(ProcessAttributeUnsigned, | 63 MOCK_METHOD3(ProcessAttributeUnsigned, |
| 64 void(DwarfAttribute, DwarfForm, uint64)); | 64 void(DwarfAttribute, DwarfForm, uint64)); |
| 65 MOCK_METHOD3(ProcessAttributeSigned, | 65 MOCK_METHOD3(ProcessAttributeSigned, |
| 66 void(DwarfAttribute, DwarfForm, int64)); | 66 void(DwarfAttribute, DwarfForm, int64)); |
| 67 MOCK_METHOD3(ProcessAttributeReference, | 67 MOCK_METHOD3(ProcessAttributeReference, |
| 68 void(DwarfAttribute, DwarfForm, uint64)); | 68 void(DwarfAttribute, DwarfForm, uint64)); |
| 69 MOCK_METHOD4(ProcessAttributeBuffer, | 69 MOCK_METHOD4(ProcessAttributeBuffer, |
| 70 void(DwarfAttribute, DwarfForm, const char *, uint64)); | 70 void(DwarfAttribute, DwarfForm, const uint8_t *, uint64)); |
| 71 MOCK_METHOD3(ProcessAttributeString, | 71 MOCK_METHOD3(ProcessAttributeString, |
| 72 void(DwarfAttribute, DwarfForm, const string &)); | 72 void(DwarfAttribute, DwarfForm, const string &)); |
| 73 MOCK_METHOD3(ProcessAttributeSignature, | 73 MOCK_METHOD3(ProcessAttributeSignature, |
| 74 void(DwarfAttribute, DwarfForm, uint64)); | 74 void(DwarfAttribute, DwarfForm, uint64)); |
| 75 MOCK_METHOD0(EndAttributes, bool()); | 75 MOCK_METHOD0(EndAttributes, bool()); |
| 76 MOCK_METHOD2(FindChildHandler, DIEHandler *(uint64, DwarfTag)); | 76 MOCK_METHOD2(FindChildHandler, DIEHandler *(uint64, DwarfTag)); |
| 77 MOCK_METHOD0(Finish, void()); | 77 MOCK_METHOD0(Finish, void()); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 class MockRootDIEHandler: public RootDIEHandler { | 80 class MockRootDIEHandler: public RootDIEHandler { |
| 81 public: | 81 public: |
| 82 MOCK_METHOD3(ProcessAttributeUnsigned, | 82 MOCK_METHOD3(ProcessAttributeUnsigned, |
| 83 void(DwarfAttribute, DwarfForm, uint64)); | 83 void(DwarfAttribute, DwarfForm, uint64)); |
| 84 MOCK_METHOD3(ProcessAttributeSigned, | 84 MOCK_METHOD3(ProcessAttributeSigned, |
| 85 void(DwarfAttribute, DwarfForm, int64)); | 85 void(DwarfAttribute, DwarfForm, int64)); |
| 86 MOCK_METHOD3(ProcessAttributeReference, | 86 MOCK_METHOD3(ProcessAttributeReference, |
| 87 void(DwarfAttribute, DwarfForm, uint64)); | 87 void(DwarfAttribute, DwarfForm, uint64)); |
| 88 MOCK_METHOD4(ProcessAttributeBuffer, | 88 MOCK_METHOD4(ProcessAttributeBuffer, |
| 89 void(DwarfAttribute, DwarfForm, const char *, uint64)); | 89 void(DwarfAttribute, DwarfForm, const uint8_t *, uint64)); |
| 90 MOCK_METHOD3(ProcessAttributeString, | 90 MOCK_METHOD3(ProcessAttributeString, |
| 91 void(DwarfAttribute, DwarfForm, const string &)); | 91 void(DwarfAttribute, DwarfForm, const string &)); |
| 92 MOCK_METHOD3(ProcessAttributeSignature, | 92 MOCK_METHOD3(ProcessAttributeSignature, |
| 93 void(DwarfAttribute, DwarfForm, uint64)); | 93 void(DwarfAttribute, DwarfForm, uint64)); |
| 94 MOCK_METHOD0(EndAttributes, bool()); | 94 MOCK_METHOD0(EndAttributes, bool()); |
| 95 MOCK_METHOD2(FindChildHandler, DIEHandler *(uint64, DwarfTag)); | 95 MOCK_METHOD2(FindChildHandler, DIEHandler *(uint64, DwarfTag)); |
| 96 MOCK_METHOD0(Finish, void()); | 96 MOCK_METHOD0(Finish, void()); |
| 97 MOCK_METHOD5(StartCompilationUnit, bool(uint64, uint8, uint8, uint64, uint8)); | 97 MOCK_METHOD5(StartCompilationUnit, bool(uint64, uint8, uint8, uint64, uint8)); |
| 98 MOCK_METHOD2(StartRootDIE, bool(uint64, DwarfTag)); | 98 MOCK_METHOD2(StartRootDIE, bool(uint64, DwarfTag)); |
| 99 }; | 99 }; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 die_dispatcher.EndDIE(0x435150ceedccda18LL); | 178 die_dispatcher.EndDIE(0x435150ceedccda18LL); |
| 179 die_dispatcher.EndDIE(0x7d08242b4b510cf2LL); | 179 die_dispatcher.EndDIE(0x7d08242b4b510cf2LL); |
| 180 } | 180 } |
| 181 | 181 |
| 182 // The dispatcher should pass attribute values through to the die | 182 // The dispatcher should pass attribute values through to the die |
| 183 // handler accurately. | 183 // handler accurately. |
| 184 TEST(Dwarf2DIEHandler, PassAttributeValues) { | 184 TEST(Dwarf2DIEHandler, PassAttributeValues) { |
| 185 MockRootDIEHandler mock_root_handler; | 185 MockRootDIEHandler mock_root_handler; |
| 186 DIEDispatcher die_dispatcher(&mock_root_handler); | 186 DIEDispatcher die_dispatcher(&mock_root_handler); |
| 187 | 187 |
| 188 const char buffer[10] = { 0x24, 0x24, 0x35, 0x9a, 0xca, | 188 const uint8_t buffer[10] = { |
| 189 0xcf, 0xa8, 0x84, 0xa7, 0x18 }; | 189 0x24, 0x24, 0x35, 0x9a, 0xca, 0xcf, 0xa8, 0x84, 0xa7, 0x18 |
| 190 }; |
| 190 string str = "\xc8\x26\x2e\x0d\xa4\x9c\x37\xd6\xfb\x1d"; | 191 string str = "\xc8\x26\x2e\x0d\xa4\x9c\x37\xd6\xfb\x1d"; |
| 191 | 192 |
| 192 // Set expectations. | 193 // Set expectations. |
| 193 { | 194 { |
| 194 InSequence s; | 195 InSequence s; |
| 195 | 196 |
| 196 // We'll like the compilation unit header. | 197 // We'll like the compilation unit header. |
| 197 EXPECT_CALL(mock_root_handler, | 198 EXPECT_CALL(mock_root_handler, |
| 198 StartCompilationUnit(0x8d42aed77cfccf3eLL, 0x89, 0xdc, | 199 StartCompilationUnit(0x8d42aed77cfccf3eLL, 0x89, 0xdc, |
| 199 0x2ecb4dc778a80f21LL, 0x66)) | 200 0x2ecb4dc778a80f21LL, 0x66)) |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // Stop the traversal abruptly, so that there will still be | 516 // Stop the traversal abruptly, so that there will still be |
| 516 // handlers on the stack when the dispatcher is destructed. | 517 // handlers on the stack when the dispatcher is destructed. |
| 517 | 518 |
| 518 // No EndDIE call... | 519 // No EndDIE call... |
| 519 } | 520 } |
| 520 // No EndDIE call... | 521 // No EndDIE call... |
| 521 } | 522 } |
| 522 // No EndDIE call... | 523 // No EndDIE call... |
| 523 } | 524 } |
| 524 } | 525 } |
| OLD | NEW |