The print_location() function is used to show information about an unknown memory address and is currently used to help analyze register content is hs_err files. It is quite useful and could also be used in other places in the future.
The function (and hence, the register output in hs_err files) could be improved in a number of ways:
- print_location() (and by extension, any functions called by it, like os::find) should use a caller provided scratch buffer and avoid using on-stack buffers.
- For text addresses, print_location() should not only show the library, but also the function name, if possible.
- For unknown values, it prints the numeric register content twice: "r18=0x0000000000000000: 0x0000000000000000 is an unknown value".
- For known values, it omits the numeric value completely: "RCX=C:\d031900\openjdk\jdk9-hs-rt\output\images\jdk\bin\server\jvm.dll + 12". But the numeric value is still useful.
- To further improve readibily, we could omit the path name of library names. All libraries are displayed later in the library section with full path name anyway.
- There is a lot of code duplication: We have os::dll_address_to_function_name() and os::dll_address_to_library_name() as well as os::find(). On Posix, almost all of them do some variant of dladdr() call. It may be possible to unify and reduce this coding.
- The same is true for also get_signal_handler_name(), whose implementation is the same across all Posix platforms. It also does only print the library name and could be improved by printing the function name as well - this would be useful when telling apart the various signal handlers of the JDK itself, for example.
- Finally, we currently have two register printouts in hs-err files (the plain one and the one which resolves memory locations). Only one is needed.
The function (and hence, the register output in hs_err files) could be improved in a number of ways:
- print_location() (and by extension, any functions called by it, like os::find) should use a caller provided scratch buffer and avoid using on-stack buffers.
- For text addresses, print_location() should not only show the library, but also the function name, if possible.
- For unknown values, it prints the numeric register content twice: "r18=0x0000000000000000: 0x0000000000000000 is an unknown value".
- For known values, it omits the numeric value completely: "RCX=C:\d031900\openjdk\jdk9-hs-rt\output\images\jdk\bin\server\jvm.dll + 12". But the numeric value is still useful.
- To further improve readibily, we could omit the path name of library names. All libraries are displayed later in the library section with full path name anyway.
- There is a lot of code duplication: We have os::dll_address_to_function_name() and os::dll_address_to_library_name() as well as os::find(). On Posix, almost all of them do some variant of dladdr() call. It may be possible to unify and reduce this coding.
- The same is true for also get_signal_handler_name(), whose implementation is the same across all Posix platforms. It also does only print the library name and could be improved by printing the function name as well - this would be useful when telling apart the various signal handlers of the JDK itself, for example.
- Finally, we currently have two register printouts in hs-err files (the plain one and the one which resolves memory locations). Only one is needed.
- relates to
-
JDK-8210754 print_location is not reliable enough (printing register info)
- Resolved
-
JDK-8147509 [aix] Newlines missing in register info printout
- Resolved
-
JDK-8147510 [windows] no text locations shown for register info in hs-err file
- Resolved
-
JDK-8147509 [aix] Newlines missing in register info printout
- Resolved
-
JDK-8147510 [windows] no text locations shown for register info in hs-err file
- Resolved