This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] [asan] Refactor DescribeAddressIfStack to allow reuse for debugging API
ClosedPublic

Authored by kubamracek on Jul 16 2014, 1:05 PM.

Details

Summary

Refactoring the DescribeAddressIfStack function in asan_report.cc to be able to reuse it for http://reviews.llvm.org/D4527. The plan is to use the newly extracted functions in this manner:

const char *frame_descr = t->GetFrameNameByAddr(addr, &offset, &frame_pc);
InternalMmapVector <StackVarDescr> vars(16);
ParseFrameDescription(frame_descr, vars);
for (uptr i = 0; i < vars.size(); i++) {
... do stuff ...
}

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 11525.Jul 16 2014, 1:05 PM
kubamracek retitled this revision from to [compiler-rt] [asan] Refactor DescribeAddressIfStack to allow reuse for debugging API.
kubamracek updated this object.
kubamracek edited the test plan for this revision. (Show Details)
kubamracek added reviewers: kcc, glider.
kubamracek added a subscriber: Unknown Object (MLST).
samsonov added a subscriber: samsonov.
samsonov added inline comments.
lib/asan/asan_report.h
36

Consider the following interface instead:

bool ParseFrameDescription(const char *frame_descr, InternalMmapVector<StackVarDescr> *vars);

Note that I passed "vars" by pointer here - we generally don't use non-const references as output parameters in sanitizer runtimes.

kubamracek updated this revision to Diff 11533.Jul 16 2014, 2:12 PM
kubamracek updated this object.

Updated the interface to use InternalMmapVector instead.

samsonov edited edge metadata.Jul 16 2014, 2:18 PM

Please upload the patches with more context.

lib/asan/asan_report.cc
351

While you're here, please initialize the variables in declaration

uptr beg = (uptr)internal_simple_stroll(p, &p, 10);
...
410

You should probably return from the function here.

kubamracek updated this revision to Diff 11536.Jul 16 2014, 2:30 PM
kubamracek edited edge metadata.
samsonov accepted this revision.Jul 16 2014, 3:30 PM
samsonov edited edge metadata.

LGTM modulo nit below.

lib/asan/asan_report.cc
358

Again, please make sure this is supported by MSVC.

This revision is now accepted and ready to land.Jul 16 2014, 3:30 PM
kubamracek updated this revision to Diff 11544.Jul 16 2014, 4:28 PM
kubamracek edited edge metadata.

Changed the struct initializer to an explicit variable, which is present in other parts of ASan code, so it should be MSVC-safe.

kubamracek closed this revision.Jul 16 2014, 5:26 PM

Landed in r213215.