Left: | ||
Right: |
OLD | NEW |
---|---|
1 // Copyright (c) 2011 Google Inc. | 1 // Copyright (c) 2011 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 } | 76 } |
77 | 77 |
78 void Module::AddFunction(Function *function) { | 78 void Module::AddFunction(Function *function) { |
79 // FUNC lines must not hold an empty name, so catch the problem early if | 79 // FUNC lines must not hold an empty name, so catch the problem early if |
80 // callers try to add one. | 80 // callers try to add one. |
81 assert(!function->name.empty()); | 81 assert(!function->name.empty()); |
82 | 82 |
83 // FUNCs are better than PUBLICs as they come with sizes, so remove an extern | 83 // FUNCs are better than PUBLICs as they come with sizes, so remove an extern |
84 // with the same address if present. | 84 // with the same address if present. |
85 Extern ext(function->address); | 85 Extern ext(function->address); |
86 ExternSet::iterator it_ext = externs_.lower_bound(&ext); | 86 ExternSet::iterator it_ext = externs_.find(&ext); |
87 if (it_ext != externs_.end() && | 87 if (it_ext == externs_.end() && architecture_ == "arm") { |
88 (*it_ext)->address < function->address + function->size) { | 88 // ARM THUMB functions are offset by 1 byte. ARM64 does not have THUMB. |
Mark Mentovai
2015/02/03 22:34:42
You don’t actually know it’s THUMB here, you’re ju
Lei Zhang (chromium)
2015/02/03 22:50:08
From the libc-2.19.so sample, all the THUMB code w
| |
89 Extern arm_thumb_ext(function->address + 1); | |
90 it_ext = externs_.find(&arm_thumb_ext); | |
91 } | |
92 if (it_ext != externs_.end()) { | |
89 delete *it_ext; | 93 delete *it_ext; |
90 externs_.erase(it_ext); | 94 externs_.erase(it_ext); |
91 } | 95 } |
96 #if _DEBUG | |
97 { | |
98 // There should be no other PUBLIC symbols that overlaps with the function. | |
Mark Mentovai
2015/02/03 22:34:42
overlap
Lei Zhang (chromium)
2015/02/03 22:50:08
Done.
| |
99 Extern debug_ext(function->address); | |
100 ExternSet::iterator it_debug = externs_.lower_bound(&ext); | |
101 assert(it_debug == externs_.end() || | |
102 (*it_debug)->address >= function->address + function->size); | |
103 } | |
104 #endif | |
92 | 105 |
93 std::pair<FunctionSet::iterator,bool> ret = functions_.insert(function); | 106 std::pair<FunctionSet::iterator,bool> ret = functions_.insert(function); |
94 if (!ret.second && (*ret.first != function)) { | 107 if (!ret.second && (*ret.first != function)) { |
95 // Free the duplicate that was not inserted because this Module | 108 // Free the duplicate that was not inserted because this Module |
96 // now owns it. | 109 // now owns it. |
97 delete function; | 110 delete function; |
98 } | 111 } |
99 } | 112 } |
100 | 113 |
101 void Module::AddFunctions(vector<Function *>::iterator begin, | 114 void Module::AddFunctions(vector<Function *>::iterator begin, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 | 308 |
296 stream << endl; | 309 stream << endl; |
297 } | 310 } |
298 } | 311 } |
299 } | 312 } |
300 | 313 |
301 return true; | 314 return true; |
302 } | 315 } |
303 | 316 |
304 } // namespace google_breakpad | 317 } // namespace google_breakpad |
OLD | NEW |