[PATCH] D12153: Support inline functions symbolization in Addr2Line symbolizer.

Yury Gribov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 14:19:59 PDT 2015


ygribov added inline comments.

================
Comment at: lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc:198
@@ +197,3 @@
+  bool ReachedEndOfOutput(const char *buffer, uptr length) override {
+    const size_t kTerminatorLen = 8; // sizeof(output_terminator_)
+    // Skip, if we read just kTerminatorLen bytes, because Addr2Line output
----------------
m.ostepenko wrote:
> samsonov wrote:
> > m.ostepenko wrote:
> > > ygribov wrote:
> > > > I wonder if there's a way to avoid magic const.
> > > We can use strlen, but this will lead to recalculation on each functon call. Or maybe use "??\n??:0\n" as it to compute kTerminatorLen.
> > Consider just making output_terminator_ a function-static - it's not used anywhere else in this class anyway.
> Yes, this is an option, but if follow approach Yura suggested (do not accumulate effective_len, but recompute it in TrimOutputBuffer each time), we'll need output_terminator_ in TrimOutputBuffer either to find meaningful buffer length.
This seems to work at least GCC 4.9:
  struct XXX {
    static constexpr const char s[] = "??\n??:0\n";
    size_t f() {
      return sizeof(s);
    }
  };


http://reviews.llvm.org/D12153





More information about the llvm-commits mailing list