diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-12-18 09:57:34 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-12-18 09:57:34 +0000 |
commit | f37c45c20d82aead845bebe52abf68024ed48286 (patch) | |
tree | 21576380216e8e7e8506b97b7f8b40ab3d6c47a2 /compiler-rt/lib/ubsan | |
parent | 7e45562ad038040418774e830deb7210f78a4426 (diff) | |
download | bcm5719-llvm-f37c45c20d82aead845bebe52abf68024ed48286.tar.gz bcm5719-llvm-f37c45c20d82aead845bebe52abf68024ed48286.zip |
[Sanitizer] Expose StackTrace::GetPreviousInstructionPc() to get PC of call instruction from return address
llvm-svn: 170424
Diffstat (limited to 'compiler-rt/lib/ubsan')
-rw-r--r-- | compiler-rt/lib/ubsan/ubsan_diag.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cc b/compiler-rt/lib/ubsan/ubsan_diag.cc index 517ce6b68b3..a726f4b55d9 100644 --- a/compiler-rt/lib/ubsan/ubsan_diag.cc +++ b/compiler-rt/lib/ubsan/ubsan_diag.cc @@ -24,13 +24,11 @@ Location __ubsan::getCallerLocation(uptr CallerLoc) { if (!CallerLoc) return Location(); - // Adjust to find the call instruction. - // FIXME: This is not portable. - --CallerLoc; + uptr Loc = StackTrace::GetPreviousInstructionPc(CallerLoc); AddressInfo Info; - if (!SymbolizeCode(CallerLoc, &Info, 1) || !Info.module || !*Info.module) - return Location(CallerLoc); + if (!SymbolizeCode(Loc, &Info, 1) || !Info.module || !*Info.module) + return Location(Loc); if (!Info.function) return ModuleLocation(Info.module, Info.module_offset); |