Debugging JVM
Manavjeet Singh
manavjeet18295 at iiitd.ac.in
Thu Sep 24 18:53:23 UTC 2020
Thank you Roman and Adityam for replying.
It was very helpful.
Manavjeet Singh
CSD Undergraduate | 2018295
Indraprastha Institute of Information Technology (IIITD)
On Wed, Sep 23, 2020 at 6:14 AM Aditya Mandaleeka <adityam at microsoft.com>
wrote:
> Hi Manavjeet,
>
> Like Roman, I mostly just use GDB from a terminal, but since you mentioned
> that you're using VS Code as your editor and are looking for a GUI
> debugger,
> I thought I'd mention that you can configure VS Code to debug the VM.
>
> These links might be useful:
> https://code.visualstudio.com/docs/cpp/launch-json-reference
> https://code.visualstudio.com/docs/cpp/cpp-debug
>
> A high-level explanation of how this works is that it will use GDB to
> interact
> with the running process and provide views/controls that you can see in
> VS Code (so you'll get familiar GUI debugging abilities like the ability
> to step
> through source in your editor, set breakpoints, see local variables, see
> the call
> stacks for each thread, etc.). And while doing this, you can also use
> the integrated terminal to access any other GDB functionality that you want
> to use while debugging.
>
> I haven't used it extensively, but when I have, it has worked well (even
> when
> used in conjunction with the Remote-SSH extension!).
>
> Setting it up should be straightforward. Your launch.json will have your
> java
> executable as "program", so something like
>
> "program":
> "/home/foo/path/to/jdk/build/linux-x86_64-server-fastdebug/jdk/bin/java"
>
> and the "args" will be a json array of whatever you want to pass to the
> executable. The other settings should be self-explanatory (with the aid of
> the above links). Once you have that set up, hitting the green arrow
> labeled
> "Start Debugging" should launch your program under the debugger.
>
> I hope that's useful and does what you're looking for.
>
> -Aditya
>
> -----Original Message-----
> From: hotspot-gc-dev <hotspot-gc-dev-retn at openjdk.java.net> On Behalf Of
> Roman Kennke
> Sent: Tuesday, September 22, 2020 3:06 AM
> To: Manavjeet Singh <manavjeet18295 at iiitd.ac.in>;
> hotspot-gc-dev at openjdk.java.net
> Subject: Re: Debugging JVM
>
> Hi Manavjeet Singh,
>
> I am using gdb to debug Hotspot. It is important to build with debug
> symbols (e.g. configure with --with-native-debug-symbols=internal).
> Also, it is very useful to also compile with asserts and other checks
> turned on (--with-debug-level=fastdebug). If you need to step through
> code, it's usually a good idea to build without optimizations too (
> --with-debug-level=slowdebug).
>
> There are GUI debuggers that may or may not be useful (e.g. I know
> people who use Emacs with GDB, I am using CLion - but not for
> debugging, but I think it is possible, and uses GDB as 'backend' for
> that).
>
> I hope that helps!
>
> Best regards,
> Roman
>
> > Hi!
> > I am currently learning the working of G1GC by making little changes
> > in the
> > code. Initially, I used GDB to add breakpoints in the code and
> > understand
> > its working. But I was wondering if there are any advanced GUI
> > debuggers
> > that can be used for this purpose? I am using VS Code as my primary
> > editor.
> > Can someone put light on the debugging setups they are using?
> > Thanks and regards
> > Manavjeet Singh
> >
>
>
More information about the hotspot-gc-dev
mailing list