summaryrefslogtreecommitdiff
path: root/lib/ubsan/ubsan_diag.cc
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-10-20 21:29:46 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-10-20 21:29:46 +0000
commit9b5f95f5fe1a24be4dfb7436b64cb0e0f8c00535 (patch)
treefbae7a194cba4874ec6393403f354075d5b50914 /lib/ubsan/ubsan_diag.cc
parent49d29ed950f9e309a7b755b2a0601ed483ce3ade (diff)
downloadcompiler-rt-9b5f95f5fe1a24be4dfb7436b64cb0e0f8c00535.tar.gz
compiler-rt-9b5f95f5fe1a24be4dfb7436b64cb0e0f8c00535.tar.bz2
compiler-rt-9b5f95f5fe1a24be4dfb7436b64cb0e0f8c00535.tar.xz
Runtime support for the indirect function call checker.
Differential Revision: http://llvm-reviews.chandlerc.com/D1339 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193060 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan/ubsan_diag.cc')
-rw-r--r--lib/ubsan/ubsan_diag.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ubsan/ubsan_diag.cc b/lib/ubsan/ubsan_diag.cc
index e4ca4e4a..968e7790 100644
--- a/lib/ubsan/ubsan_diag.cc
+++ b/lib/ubsan/ubsan_diag.cc
@@ -26,12 +26,21 @@ Location __ubsan::getCallerLocation(uptr CallerLoc) {
return Location();
uptr Loc = StackTrace::GetPreviousInstructionPc(CallerLoc);
+ return getFunctionLocation(Loc, 0);
+}
+
+Location __ubsan::getFunctionLocation(uptr Loc, const char **FName) {
+ if (!Loc)
+ return Location();
AddressInfo Info;
if (!getSymbolizer()->SymbolizeCode(Loc, &Info, 1) ||
!Info.module || !*Info.module)
return Location(Loc);
+ if (FName && Info.function)
+ *FName = Info.function;
+
if (!Info.file)
return ModuleLocation(Info.module, Info.module_offset);