RFR: 8366154: Validate thread type requirements in debug commands [v2]

Paul Hohensee phh at openjdk.org
Thu Sep 4 19:38:43 UTC 2025


On Mon, 1 Sep 2025 21:54:13 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Kerem Kat has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - add include for global placement new
>>  - remove onJavaThread and check JavaThread::active null where needed
>
> src/hotspot/share/utilities/debug.cpp line 341:
> 
>> 339:     }
>> 340:     return true;
>> 341:   }
> 
> I don't think we need this. The commands that require a JavaThread should be checking that directly themselves. Typically we assume/expect the person debugging to know what they are dealing with and use the appropriate commands.

@dholmes-ora, are you sure you want this level of code duplication? As is it, the latest version duplicates the following 3 times

 if (!c.onThread()) return;
  JavaThread* p = JavaThread::active();
  if (p == nullptr) {
    tty->print_cr("Failed: JavaThread::active is null");
    return;
  }
  tty->print(" for thread: ");
  p->print();
  tty->cr();

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27033#discussion_r2323292717


More information about the hotspot-dev mailing list