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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [MinGW] RFC/RFA: Get Partial Stack Traces on Windows


Ranjit Mathew wrote:
There is no manual page for dladdr() on my system (though
there are for dlopen(), dlsym(), etc.) and online searches
didn't help much. Are the names not dynamically allocated
on all systems? I mean, is free() in this case non-kosher
on just glibc systems or is it the case for Solaris, etc.
as well?

Yes, there does seem to be a lack of docs for dladdr(). But, I found this:


http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=man&fname=/usr/share/catman/p_man/cat3/libdl/dladdr.z

In particular:
"The memory pointed to by *dli_fname* and *dli_sname* is within the mapped object. If the object is closed with *dlclose()*, the pointers become invalid."


So, its safe to assume you don't need a free().
Anyway, adding the "const" qualifiers and removing the
misguided free() calls make things work again on Linux.
I'm attaching the latest revision of this patch.

OK to apply?

Thanks,
Ranjit.

- --
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA. Web: http://rmathew.com/

------------------------------------------------------------------------

Index: ChangeLog
from  Ranjit Mathew  <rmathew@gcc.gnu.org>

* gcj/javaprims.h (_Jv_uintptr): New typedef similar to uintptr_t in
C99.

Hmm, is there some reason we can't just use uintptr_t? Doesn't GCC ensure it is always available?
* include/java-stack.h: Include stdlib.h.
(_Jv_AddrInfo): New structure to hold address information.
(_Jv_platform_dladdr): Declare.
* posix.cc: Include dlfcn.h if available. Include java-stack.h.
(_Jv_platform_dladdr): Define.
* win32.cc: Include string.h. Include java-stack.h.
(backtrace): Remove.
(_Jv_platform_dladdr): Define.

Cool. Splitting out _Jv_platform_dladdr really cleans up the stacktrace.cc code - this looks perfect, almost - stylistically I think it would be better to declare _Jv_platform_dladdr in platform.h along with the other _Jv_platform_* functions. I realize this means platform.h will have to typedef _Jv_AddrInfo, or include java-stack.h, but I don't think that is a significant problem.


Otherwise, this is ok to commit. TVM!

Bryce


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