JDK-8147512 : Cleanups and improvements for print_location
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2016-01-16
  • Updated: 2019-05-02
  • Resolved: 2018-12-11
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
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.

Comments
Runtime Triage: This is not on our current list of priorities. We will consider this feature if we receive additional customer requirements.
11-12-2018

Hi Mikhailo, sorry, not in the foreseeable future. I still consider this a worthwhile cleanup, but it will take a while before I can do this. If you'd like to close the issue for now, thats fine.
17-10-2018

[~stuefe] Thomas, please let us know if you plan to work on this for 12?
16-10-2018