> On Nov. 22, 2014, 11:20 nachm., Thomas Lübking wrote:
> > kdecore/io/kdebug.cpp, line 717
> > <https://git.reviewboard.kde.org/r/121213/diff/1/?file=329504#file329504line717>
> >
> >     Why do you need to sharpen the match?
> 
> René J.V. Bertin wrote:
>     Because otherwise the symbol to be demangled is left with a trailing 
> space, which causes the demangle to fail. Wanna know how I know?
> 
> Thomas Lübking wrote:
>     Don't know about the GCC behavior on trailing spaces, but one should 
> probably have some "while (in.at(mangledNameEnd) == ' ') --mangledNameEnd;" 
> loop?
> 
> René J.V. Bertin wrote:
>     One could, but why? The start is found with a string, I don't see why the 
> end wouldn't be, given that that loop of yours will always loop just once ...
> 
> Thomas Lübking wrote:
>     ... or not at all or thrice - depending on how the mangler feels today.
>     
>     What I mean is that if untrimmed strings are a problem for demangling, 
> one should seek to get rid of all the whitespace generically - i don't care 
> about whether seeking for a string or char, this context is hardly 
> performance critical.
> 
> René J.V. Bertin wrote:
>     this particular bit of whitespace has nothing to do with the mangler or 
> how it feels today. It's formatting done by the backtrace function, which 
> clearly always puts a space-padded `+` rather than one without padding as 
> under Linux.
>     Frankly, in general I'd agree with you, but here I don't see any reason 
> to make the code more complex than it is.

backtrace() is provided by glibc resp. the apple (darwin) libc (i hope).
-> What provides /usr/include/execinfo.h on OSX?
That's what is needed to be detected (I assume this would affect *all* BSD 
variants?)

> I don't see any reason to make the code more complex than it is.

If we're dealing w/ unspecified output and need to sanitize it, we may have to 
do this generically if we must consider random toolchains aside gcc+glibc.
I know that you only care about OSX, but actually OSX is just a good testcase 
to see whether the code is "correct" or just happens to work.

- Do you compile with gcc or clang?
- Did you check whether the glibc backtrace() output is actually stripped?
- What if we compile glibc w/ llvm and glibc backtrace() fires padded " + " 
which llvm __cxa_demangle() cannot handle? (ok, rethorical question ;-)


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121213/#review70796
-----------------------------------------------------------


On Nov. 24, 2014, 6:37 nachm., René J.V. Bertin wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121213/
> -----------------------------------------------------------
> 
> (Updated Nov. 24, 2014, 6:37 nachm.)
> 
> 
> Review request for KDE Software on Mac OS X and kdelibs.
> 
> 
> Repository: kdelibs
> 
> 
> Description
> -------
> 
> This patch adapts the parser in `maybeDemangledName` to the backtrace 
> obtained in `kRealBacktrace` on OS X.
> 
> 
> Diffs
> -----
> 
>   kdecore/io/kdebug.cpp 872a05a 
> 
> Diff: https://git.reviewboard.kde.org/r/121213/diff/
> 
> 
> Testing
> -------
> 
> Works as expected on OS X 10.9.4 .
> 
> 
> Thanks,
> 
> René J.V. Bertin
> 
>

Reply via email to