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:
   
![image](https://github.com/apache/netbeans/assets/2179736/54d512ac-ee59-436b-b446-9cfbc90e67fb)
   6. NetBeans now switches to debugging view and on the left side you will see 
a list of threads:
   
![image](https://github.com/apache/netbeans/assets/2179736/8be2d8dc-097a-46e8-a45c-cbe62b803041)
      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:
   
   
![image](https://github.com/apache/netbeans/assets/2179736/90cf0c5b-91aa-4b46-990d-d2d54329ab59)
   
   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:
   
   
![image](https://github.com/apache/netbeans/assets/2179736/2c86c922-e4f6-4aaf-9ebe-4d5b0e7fc324)
   
   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:
   
   
![image](https://github.com/apache/netbeans/assets/2179736/cd2b625b-8ef4-43e5-b783-ebc10a512086)
   
   Be warned though: Method Breakpoints are slow.
   
   When a break point is hit, you get this view:
   
   
![image](https://github.com/apache/netbeans/assets/2179736/009c5c40-3f55-4c5e-962d-5f11a8651aa1)
   
   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:
   
   
![image](https://github.com/apache/netbeans/assets/2179736/00d0d31e-1487-4da6-ac4e-f9195f30aac9)
   
   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: 
   
![image](https://github.com/apache/netbeans/assets/2179736/823a6444-81f5-47c7-b0b0-4d1d4b6b25f6)
   
   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

Reply via email to