On Tue, 21 Dec 2021 21:27:24 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:

>> Chris Plummer has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - Fix issue with address range patterns. For some reason they have always 
>> allowed some extra lower case letters at the end of the pattern that just 
>> get ignored. I removed support for this since sometimes it resulted in bad 
>> address ranges producing an exception rather than a usage() message.
>>  - Fix missing return after calling usage()
>
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/CommandProcessor.java 
> line 560:
> 
>> 558:                     } else {
>> 559:                         out.println();
>> 560:                     }
> 
> I wonder if it is possible to simplify the above fragment at 549-560 with 
> something like:
>                     if (verbose) {
>                         // If we know what this is a pointer to, then print 
> additional information.
>                         PointerLocation loc = PointerFinder.find(val);
>                         if (!loc.isUnknown()) {
>                             out.print(" ");
>                             loc.printOn(out, false, false);     // make it 
> print without line end or ignore there is an extra end?
>                         }
>                     }
>                     out.println();

`printOn()` always prints a newline. It's hard to make it not do that since it 
relies on other `print` APIs, some of which print newlines and some of which 
don't (in which case `printOn()` will print a newline). So I can't easily just 
create a `printOn()` variant that doesn't print newlines, and printing two 
newlines would introduce a bunch of blank lines in the output, which wouldn't 
look good.

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

PR: https://git.openjdk.java.net/jdk/pull/6902

Reply via email to