RFR: 8322980: Debug agent's dumpThread() API should update thread's name before printing it
Kevin Walls
kevinw at openjdk.org
Thu Jan 4 17:03:23 UTC 2024
On Thu, 4 Jan 2024 02:06:28 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
> In threadControl.c, at build time you can decide to keep track of thread names by compiling with "#define DEBUG_THREADNAME". If this is also a debug build, some extra debugging functions are included in the build, including "dumpThread(ThreadNode *node)". These are intended to be called from gdb, or possibly from somewhere in the debug agent implementation, to aid with debugging. When dumpThread() prints the thread's name, it just uses the name that was stored when the thread was created. However, the thread name can change, so dumpThread() should really fetch the current thread name and print it.
>
> I also added some commented out code to print other useful fields of the ThreadNode, including the ThreadState. These can be enabled by the user as needed.
>
> Tested with all of tier1, and also ran tier2 and tier4 svc tests.
Looks good I think.
A future idea could be to have these ifdefs active in the debug JDK build. I wouldn't normally run the debugger from the debug build, but if you wanted this extra info it would be more convenient if it was in the debug JDK bundle.
(The changed output might fool some tests so would need checking, but might be worth considering.)
-------------
Marked as reviewed by kevinw (Committer).
PR Review: https://git.openjdk.org/jdk/pull/17259#pullrequestreview-1804619393
More information about the serviceability-dev
mailing list