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

Kerem Kat krk at openjdk.org
Tue Sep 9 09:47:12 UTC 2025


On Mon, 8 Sep 2025 09:54:38 GMT, Kevin Walls <kevinw 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 308:
> 
>> 306:  public:
>> 307:   Command(const char* str) : _has_rm(false) {
>> 308:     if (level++ == 0) {
> 
> "level" can recognise concurrent usage, but doesn't protect against it?  The commands still proceed to do their thing, so it doesn't seem right make us skip printing "Executing..." if level was not exactly zero?
> 
> (Adding the flush() if there is concurrent might be a good thing, it may help if there is output that could be confused, if that is even possible to achieve...)

My original understanding for the level variable was to handle nested command calls, not concurrent ones.

For instance, if a command like `find` were to internally call `findm`, printing two "Executing..." messages would be more confusing, as the user executed a single command from gdb.

On the other hand, is it possible to call these functions from gdb concurrently?

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

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


More information about the hotspot-dev mailing list