Hi,

I would appreciate if someone could help us review this change to the
hotspot serviceability agent for the BSD port. We are looking for
upstream reviewers so that it will hopefully be easier when the time
comes to merge the BSD port into mainline in the future.

Thanks in advance,
Harald Eilertsen

----- Forwarded message from Harald Eilertsen <[email protected]> -----

Date: Thu, 1 Oct 2026 12:20:39 GMT
From: Harald Eilertsen <[email protected]>
To: [email protected]
Subject: [bsd-port:bsd-port] RFR: Fix debugd connect test on FreeBSD

The BsdThread and BsdDebuggerLocal classes adds an extra field, and methods to 
deal with a "uniqueThreadId" used on Macos. This is fine when attaching 
directly to the debugee, since the debugger object returned from the 
VM.getDebugger() method will already be a BsdDebuggerLocal object, and we can 
treat it as that.

However, when debugging remotely (via debugd,) the debugger object returned 
will be a RemoteDebuggerClient object, which _does not_ implement the required 
fields and methods for the macos "uniqueThreadId". This would result in an 
exception when trying to cast the returned RemoteDebuggerClient object to an 
incompatible BsdDebuggerLocal class.

On Macos, this issue is tracked as JDK-8239062:
https://bugs.openjdk.org/browse/JDK-8239062

FreeBSD does not use the "uniqueThreadId" field, so this patch just bypasses 
that entirely for remote debugging sessions on FreeBSD.

This patch applies to AMD64 and Aarch64 architectures. The PPC post does not 
use the "uniqueThreadId" field, and should not be affected.

This work is sponsored by The FreeBSD Foundation




---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - Fix debugd connect test on FreeBSD

Changes: https://git.openjdk.org/bsd-port/pull/17/files
  Webrev: https://webrevs.openjdk.org/?repo=bsd-port&pr=17&range=00
  Stats: 29 lines in 4 files changed: 21 ins; 2 del; 6 mod
  Patch: https://git.openjdk.org/bsd-port/pull/17.diff
  Fetch: git fetch https://git.openjdk.org/bsd-port.git pull/17/head:pull/17

PR: https://git.openjdk.org/bsd-port/pull/17

----- End forwarded message -----

Reply via email to