matthiasblaesing commented on issue #6862:
URL: https://github.com/apache/netbeans/issues/6862#issuecomment-1925835316
Ok, you need to tell the IDE what to do. The intention is now not to get a
stack trace (you did that already), but get the info what files are
modified/tried to be read.
1. Start your "Work" IDE like this:
`<PATH_TO_NETBEANS>\bin\netbeans64.exe
-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044`
This will launch the IDE in a "debuggable" mode. The debug agent listens
now on TCP port 1044 for a debugger. The `-J` indicates to the NetBeans
launcher that the rest of the option should be passed to the java launcher
itself. That is instructed to load the debugger agent (jdwp) and configured to
start in server mode, not to supend execution and listen to TCP port 1044.
2. Do what you need to do, to get it into its "broken" state
3. Launch the debugging IDE (yeah, needs a different userdir):
`<PATH_TO_NETBEANS>\bin\netbeans64.exe --userdir c:/temp/debugging`
4. Ensure, that in the Plugin Manager (Tools -> Plugins -> Installed) the
"Java SE" is Choose DebuActive and if it is not, activate it
5. Choose "Debug -> Attach Debugger", ensure "Java Debugger (JPDA)" is
selected as "Debugger", as Connector choose "SocketAttach", as "Host" choose
"localhost", as Port "1044". "Ok" that:

6. NetBeans now switches to debugging view and on the left side you will see
a list of threads:

And on the lower border you see Variables and Breakpoints. Variables
becomes active, once a a thread is stopped.
7. In the debugging view you can suspend threads by clicking on the
"Pause"-Symbol (at the end of the corresponding line), The view then changes
and show a stack trace for that thread. You can now activate each stack frame
by double clicking on it (it is then printed in bold) and in the Variables view
you can see the variables in the stack frame:

In this case I clicked "Pause" on the "exec_JNA..." Thread and then double
clicked the "WinNTFileSystem.delete:625" line. As the runtime JDK matches the
JDK of the debugged IDE, the source code in the JDK is automatically opened. In
the example we can see, that `f` is the passed in file and when I expand it, I
can see the backing path.
This is of course not a reproduction of your situation, but the idea is,
that you repeat that against your "Work IDE" and check the threads, that you
can identify in the stacktrace. In these threads check the stack frames to see
whether you can identify which file is passed to
`java.io.WinNTFileSystem.checkAccess`.
Further checks can be done using the breakpoint function. For example you
can create a methdo break point like this:

The red marked icon is "Create new breakpoint".
You can now choose what kind of breakpoint you want to create. This way you
would get a break on each call to `checkAccess:

Be warned though: Method Breakpoints are slow.
When a break point is hit, you get this view:

You see on the left the debugging view highlights the current active stack
frame, in Breakpoints view the breakpoint that was hit is highlighted. You can
now switch to "Variables", change the active stack frame and inspect the
variables:

In the example `checkAccess` is called from `File#canWrite` and is invoked
on the path `z:\\src\\jnalib\\contrib\\platform\\build.xml`.
To continue execution, you can now allow execution to allow for the thread
using the play button in "Debugging" tab or by choosing "Continue" in the
debugging toolbar:

Breakpoints can be removed at any time, if execution is topped because a
breakpoint was hit, the thread stays suspended until you allow execution again.
If you find problem, use the "stop" button in the debugging toolbar. The
Debugging IDE will disconnect from the debugged IDE.
I hope this helps a bit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists