[PATCH] D69549: [Symbolizers] On Darwin compute function offset when possible.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 15:08:57 PST 2019


delcypher marked an inline comment as done.
delcypher added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp:32
   Dl_info info;
   int result = dladdr((const void *)addr, &info);
   if (!result) return false;
----------------
yln wrote:
> delcypher wrote:
> > yln wrote:
> > > If we fail to dladdr, `stack->info.function_offset` will not be assigned.
> > > What is the initial value? garbage? `0x0`, or `kUnknown = ~(uptr)0`?
> > > 
> > > What do we want here? I think `0x0` would be a good choice.
> > > Would it be possible to construct a test case for this code path to pin down the behavior?
> > > 
> > The initial value is `kUnknown`. See `sanitizer_symbolizer.cpp`.
> > 
> > ```lang=c++
> > AddressInfo::AddressInfo() {
> >   internal_memset(this, 0, sizeof(AddressInfo));
> >   function_offset = kUnknown;
> > }
> > ```
> > 
> > I don't know a way of writing a test case such that `dladdr()` fails. Perhaps stripping the binary would do it?
> Got it, thanks for explaining.  Let's ignore this test case for this change.
I tried stripping the binary. It prevents us from getting the name of the function but it seems that `dladdr` is still able to determine where the start of the function is.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69549/new/

https://reviews.llvm.org/D69549





More information about the llvm-commits mailing list