This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] java run-time stack trace


Per Bothner wrote:

> This patch accomplishes that.  It does have the undesirable side-effect that
> C or C++ functions are are written Java-style (i.e no * or ::):
>
>    at 0x40186645: _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/home/bothner/GNU/linux/lib/libgcj.so.1)
>
> but I think that is reasonable enough for a Java stack printer.
>
> Any objections to checking this in (now, before the branch)?

I have no objection, although I would actually really like to see it demangle in the correct style for each frame, like gdb does. This can
be done simply based on the extension of the source file reported for each frame, assuming that line number information is available (if
not, I guess we'd just have to default to one or the other).

I also want to:

- drop the PC address display, because it takes up precious space and isn't really interesting for 99% of debugging tasks, and you can get
it easily with gdb if you need it (the output will be much more readable if we can fit it on one line per frame in most cases). We could
perhaps enable extra stuff for --enable-libgcj-debug builds though.

- print line number information for frames from shared libs. In order for this to work we'd need to either open up multiple sessions of
addr2line (one for each shared lib); or just call into libbfd directly. The later option may be easier, since addr2line is really just a
wrapper around some bfd calls that do all the real magic. I'm not sure how widely available libbfd is, however - it is always available on
linux systems, but it might be better to just stick with addr2line for portability.

> I believe glibc includes a demangler.  It would be better to use that
> when available but that requires some configury magic.

I don't know if glibc has a demangler, but if it does then using it would open up version skew problems, at least until we're sure that
everyone had a glibc new enough to support v3 java symbols. However, we can easily just link in cp-demangle from libiberty.

regards

  [ bryce ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]