RFR: 8274986: max code printed in hs-err logs should be configurable [v2]
Tom Rodriguez
never at openjdk.java.net
Mon Oct 11 17:31:07 UTC 2021
On Mon, 11 Oct 2021 08:30:48 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
>> src/hotspot/share/code/codeBlob.cpp line 658:
>>
>>> 656: if (st == tty) {
>>> 657: nm->print_nmethod(verbose);
>>> 658: }
>>
>> I think this should be something like this:
>>
>> ResourceMark rm;
>> st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT,
>> p2i(addr), (int)(addr - nm->entry_point()), p2i(nm));
>> - if (verbose) {
>> - st->print(" for ");
>> - nm->method()->print_value_on(st);
>> - }
>> st->cr();
>> - nm->print_nmethod(verbose);
>> + if (verbose && st == tty) {
>> + nm->print_nmethod(verbose);
>> + } else {
>> + nm->print_on(st);
>> + }
>> return;
>> }
>> st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", p2i(addr), (int)(addr - code_begin()));
>
> I don't think so. As far as I can see, the intent is to have a single line of output for an nmethod followed by an optional " for ..." suffix when `verbose == true`.
> The `nm->print_nmethod(verbose)` call then prints extra multi-line detail for the nmethod with the number of lines printed governed by `verbose`.
> This code seems like it went from being hard coded to always go to `tty` and was then parameterized to go to an arbitrary stream but the evolution accidentally overlooked some code that still goes to `tty`.
> I don't want to make extensive changes here as there really should be a single effort to rationalize all dumping to ensure it's parameterized.
I agree you might not want to bite this off in this PR, but this piece of code is reason you commonly see random nmethods appearing on the tty just before a crash. verbose is only ever true when called from findpc in debug.cpp. All the other non-verbose work print_nmethod does is useless, like writing to the xtty, and otherwise boils down to nm->print_on(tty). But all these printing paths could use a rework so I'm fine if you skip it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5875
More information about the hotspot-dev
mailing list