Index: compiler-rt/trunk/lib/asan/asan_descriptions.h =================================================================== --- compiler-rt/trunk/lib/asan/asan_descriptions.h +++ compiler-rt/trunk/lib/asan/asan_descriptions.h @@ -132,12 +132,14 @@ uptr tid; uptr offset; uptr frame_pc; + uptr access_size; const char *frame_descr; - void Print(uptr access_size = 1) const; + void Print() const; }; -bool GetStackAddressInformation(uptr addr, StackAddressDescription *descr); +bool GetStackAddressInformation(uptr addr, uptr access_size, + StackAddressDescription *descr); struct GlobalAddressDescription { uptr addr; @@ -145,12 +147,14 @@ static const int kMaxGlobals = 4; __asan_global globals[kMaxGlobals]; u32 reg_sites[kMaxGlobals]; + uptr access_size; u8 size; - void Print(uptr access_size = 1, const char *bug_type = "") const; + void Print(const char *bug_type = "") const; }; -bool GetGlobalAddressInformation(uptr addr, GlobalAddressDescription *descr); +bool GetGlobalAddressInformation(uptr addr, uptr access_size, + GlobalAddressDescription *descr); bool DescribeAddressIfGlobal(uptr addr, uptr access_size, const char *bug_type); // General function to describe an address. Will try to describe the address as Index: compiler-rt/trunk/lib/asan/asan_descriptions.cc =================================================================== --- compiler-rt/trunk/lib/asan/asan_descriptions.cc +++ compiler-rt/trunk/lib/asan/asan_descriptions.cc @@ -192,7 +192,8 @@ } // Stack descriptions -bool GetStackAddressInformation(uptr addr, StackAddressDescription *descr) { +bool GetStackAddressInformation(uptr addr, uptr access_size, + StackAddressDescription *descr) { AsanThread *t = FindThreadByStackAddress(addr); if (!t) return false; @@ -206,6 +207,7 @@ } descr->offset = access.offset; + descr->access_size = access_size; descr->frame_pc = access.frame_pc; descr->frame_descr = access.frame_descr; @@ -264,8 +266,8 @@ bool DescribeAddressIfStack(uptr addr, uptr access_size) { StackAddressDescription descr; - if (!GetStackAddressInformation(addr, &descr)) return false; - descr.Print(access_size); + if (!GetStackAddressInformation(addr, access_size, &descr)) return false; + descr.Print(); return true; } @@ -295,20 +297,22 @@ Printf("%s", str.data()); } -bool GetGlobalAddressInformation(uptr addr, GlobalAddressDescription *descr) { +bool GetGlobalAddressInformation(uptr addr, uptr access_size, + GlobalAddressDescription *descr) { descr->addr = addr; int globals_num = GetGlobalsForAddress(addr, descr->globals, descr->reg_sites, ARRAY_SIZE(descr->globals)); descr->size = globals_num; + descr->access_size = access_size; return globals_num != 0; } bool DescribeAddressIfGlobal(uptr addr, uptr access_size, const char *bug_type) { GlobalAddressDescription descr; - if (!GetGlobalAddressInformation(addr, &descr)) return false; + if (!GetGlobalAddressInformation(addr, access_size, &descr)) return false; - descr.Print(access_size, bug_type); + descr.Print(bug_type); return true; } @@ -316,8 +320,7 @@ Printf("Address %p is located in the %s area.\n", addr, ShadowNames[kind]); } -void GlobalAddressDescription::Print(uptr access_size, - const char *bug_type) const { +void GlobalAddressDescription::Print(const char *bug_type) const { for (int i = 0; i < size; i++) { DescribeAddressRelativeToGlobal(addr, access_size, globals[i]); if (0 == internal_strcmp(bug_type, "initialization-order-fiasco") && @@ -328,7 +331,7 @@ } } -void StackAddressDescription::Print(uptr access_size) const { +void StackAddressDescription::Print() const { Decorator d; char tname[128]; Printf("%s", d.Location()); @@ -431,16 +434,16 @@ bool isStackMemory = false; if (shouldLockThreadRegistry) { ThreadRegistryLock l(&asanThreadRegistry()); - isStackMemory = GetStackAddressInformation(addr, &data.stack); + isStackMemory = GetStackAddressInformation(addr, access_size, &data.stack); } else { - isStackMemory = GetStackAddressInformation(addr, &data.stack); + isStackMemory = GetStackAddressInformation(addr, access_size, &data.stack); } if (isStackMemory) { data.kind = kAddressKindStack; return; } - if (GetGlobalAddressInformation(addr, &data.global)) { + if (GetGlobalAddressInformation(addr, access_size, &data.global)) { data.kind = kAddressKindGlobal; return; } @@ -457,14 +460,14 @@ } GlobalAddressDescription global_descr; - if (GetGlobalAddressInformation(addr, &global_descr)) { - global_descr.Print(access_size, bug_type); + if (GetGlobalAddressInformation(addr, access_size, &global_descr)) { + global_descr.Print(bug_type); return; } StackAddressDescription stack_descr; - if (GetStackAddressInformation(addr, &stack_descr)) { - stack_descr.Print(access_size); + if (GetStackAddressInformation(addr, access_size, &stack_descr)) { + stack_descr.Print(); return; }