How to Debug openjdk using gdb? - gdb

I have built openJDK the debugging version with the following configuration options in README-builds
bash ./configure ---with-debug-level=slowdebug --with-target-bits=64
However I cannot set any breakpoints or to be correct there are no symbols, doing some reseach on google I have found out that I should extract .diz (libjvm.diz) files in lib folder, but this does not seem to work.

I will answer this for other people, after you get the sources
Follow the steps:
bash ./configure --with-debug-level=slowdebug --with-target-bits=64 --disable-zip-debug-info
make all
An information worth mentioning that finally when you start the debugging session with gdb and you run the program you may see a SEGFAULT ignore it and continue till gdb stops at your breakpoint.

Related

C++ How do I configure Eclipse:Oxygen to do line by line debugging on OSX

I need directions on how to configure Eclipse to do line by line debugging for C++. I have looked at tutorials and videos everywhere on this and none of them actually work. I know I need to install gdb and have done so using brew. The path to my gdb install is '/usr/local/Cellar/gdb/8.0.1/bin/gdb'. If I set this path as my debugger in Eclipse and hit debug after setting a break point, it runs and never hits the break point.
If there is a better IDE for debugging C++ on OSX that actually works, Ill accept directions for configuring that IDE as an acceptable answer.

Eclipse C++ GDB debugger for Mac

i've been trying for a whole day to use Eclipse but i failed every time.
I know that i may be wrong and i do know that there are a lot of people out there who are working hard for an open source project, but if i can't use a program, run and debug an "Hello world" file, there must be something wrong.
I'm using OSX 10.9.5 (yeah, maybe using a mac is my first error, right?).
Every time i try to debug the "Hello World.cpp" program i get the following error.
http://imgur.com/RgXCSyW
Yes, i've searched everywhere on google.
Yes, i've already seen the other replies on a similar topic and i've already tried the solutions they offered. Sadly, it didn't work.
Thanks guys for your patience, i hope to learn how to code and maybe being helpful to others one day.
Luca
p.s. writing the error so other people who are googling it can find it
"
Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Unable to find Mach task port for process-id 33383: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
Unable to find Mach task port for process-id 33383: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
"
There is another option to debug you code using LLDB debugger.
You can check this link for install the LLDB debugger integration.
It is super easy and does the work.
Btw The GDB debugger is part of GNU. Xcode does not use GNU tools (gcc, gdb) anymore. Xcode uses LLVM. LLVM's debugger is LLDB.
Some info about it:
apple developers,
The LLDB Debugger
Probably your problem has been solved, but sharing another solution to others cant be bad :)
This is relevant to macOS Sierra also.
This is a relatively well known "issue" on OS X (which btw is a pain-in-the-neck-to-develop-c++ on). You first need to install g++ and GDB debugger (since LLVM clang++ in combination with LLVM debugger are not yet supported by Eclipse on OS X). The easiest way is via macports. First install macports via the native installer, then, from a terminal, install g++ and gdb (debugger)
sudo port install gcc5 # or gcc49
and
sudo port install gdb
After this, you need to codesign it, see this link. The name of the debugger will be ggdb (not gdb), and macoprts will install it in /opt/local/bin/ggdb.

stepping through stl code in gdb

I'm working on a relatively old Centos system where I am restricted in the packages I can install. I needed a newer version of gdb, so I built that successfully from source in my home dir. This gdb steps through my code fine, but I am looking for trouble that is manifesting in the C++ allocator (mt_allocator.cc) and this new version of gdb can't step through that code. I can break successfully on a function there:
break '__gnu_cxx::__pool<true>::_M_initialize()'
but when that breakpoint hits and I try to step through the code, gdb tells me:
Single stepping until exit from function _ZN9__gnu_cxx6__poolILb1EE13_M_initializeEv,
which has no line number information.
I tried using the dir command within gdb to add the path to where mt_allocator.cc is, but that had no effect.
What do I need to tell gdb so it can find those files?
Ah, found it. The Centos package manager put the debug files for the STL code at /usr/lib/debug. So:
set debug-file-directory /usr/lib/debug
within gdb gets it done.

Eclipse PTP OpenMPI parallel run/debug

Can someone give instructions on how to run/debug an OpenMPI (C/C++/Fortran) program in Eclipse PTP using the actual parallel run/debug modes on a local machine?
I've set a local connection in the 'Remote Environments' section. If I specify the actual program executable as the executable then eclipse gets stuck with 'submit interactive' and 'Launching... Submitting the job...' in the progress window, and I'm left with the specified number of processes of the program running at full CPU indefinitely. If I specify another program, like mpirun or mpiexec, and provide the necessary arguments to get to the program executable then the only difference is that I have the same number of mpirun's running at 0 CPU.
I should add that if I actually select "Local" under "Connection Type" then I get an error:
Failed to execute command: ompi_info -a --parseable
Reason: Cannot run program "ompi_info": Unknown reason
even though that command works fine from the command line and runs successfully when connecting to local host as setup in the 'remote environments'
I've seen the guides on the Eclipse website, but they're no help. I've checked [1] and [2], but I still get this working right.
I can get a program running successfully in parallel by treating it like a normal program and setting the executable to mpiexec and providing the necessary arguments, but I want to do actual parallel debugging, so this doesn't suffice.
EDIT:
I should be more specific. I know there are other methods of debugging, but Eclipse PTP (parallel tools platform) should be able to handle this perfectly, so I'm looking for an explanation from someone who has setup Eclipse PTP on their local machine such that they can use a parallel run configuration and the parallel debugging tools.
Please ask your question on the ptp-user mailing list.
https://dev.eclipse.org/mailman/listinfo/ptp-user
Sounds like openmpi isn't in the path available within eclipse
In fact, this is in the PTP FAQ on https://wiki.eclipse.org/Parallel_Tools_Platform_FAQ#Q:_I_get_the_error_.22Failed_to_execute_command:_ompi_info_-a_--parseable.22_when_I_use_the_Open_MPI_target_configuration_on_my_Mac
I've never actually used the Eclipse IDE, but I debug my MPI code using xterm and gdb:
mpirun -np 2 xterm -e gdb -ex run ./tool
Not exactly what you where after, but perhaps it helps...
Not sure which OS you're using, but I had this issue on MacOS. It's because Eclipse doesn't run .bash_profile or .bashrc, so its environment (namely PATH) won't have everything it needs. You could try to edit the PATH variable to include it by some other means (which I found to be overly complicated on Mac), OR you can just run the eclipse executable from a shell so that it inherits your typical environment. For me this was located at:
~/eclipse/parallel-neon/Eclipse.app/Contents/MacOS/eclipse
Then eclipse was able to detect OpenMPI just fine (PATH contained /usr/local/bin).

How to do remote debugging with Eclipse CDT without gdbserver?

We're using the Eclipse CDT 5 C++ IDE on Windows to develop a C++ application on a remote AIX host.
Eclipse CDT has the ability to perform remote debugging using gdbserver. Unfortunately, gdbserver is not supported on AIX.
Is anyone familiar with a way to debug remotely using Eclipse CDT without gdbserver? Perhaps using an SSH shell connection to gdb?
finally I got gdb run remotly anyhow now. At the Bug-symbol on the taskbar I took Debug Configurations - GDB Hardware Debugging.
In Main C/C++ Applications I set the full path on the Samba share of the executable (X:\abin\vlmi9506). I also set a linked folder on X:\abin in the project. Then I modified my batch-script in GDB Setup. It's not directly calling gdb in the plink-session but a unix-shell-script, which opens gdb. By this I have the possibility to set some unix environment-variables for the program before doing debug. The call in my batch:
plink.exe prevoax1 -l suttera -pw XXXXX -i /proj/user/dev/suttera/vl/9506/test/vlmi9506ddd.run 20155 dev o m
In the unix script I started gdb with the command line params from eclipse, that I found in my former tryals. The call in the shell command looks like this:
gdb -nw -i mi -cd=$LVarPathExec $LVarPathExec/vlmi9506
Then IBM just gives gdb 6.0 for AIX. I found version 6.8 in the net at http://www.perzl.org/aix/index.php?n=Main.Gdb. Our Admin installed it.
I can now step through the program and watch variables. I even can write gdb-commands directly in the console-view. yabadabadooooooo
Hope that helps to others as well. Can not tell, what was really the winner-action.
But each answer gives more new questions. Now I got 3 of them.
When I start the debug config I have to click restart in the toolbar to come really in the main procedure. Is it possible to come directly in main without restarting?
On AIX our programs are first preprocessed for embedded sql. The preprocessed c-source is put in another directory. When I duble-click the line to set a breakpoint, I get the warning "unresolved breakpoint" and in the gdb-console I see, that the break is set to the preprocessed source which is wrong. Is it possible to set the breakpoints on the right source?
We are using CICS on AIX. With the xldb-Debugger and the CDCN-command of CICS we manage that debugging is started, when we come in our programs. Is it possible to get that remotely (in plink) with gdb-eclipse as well?
I wouldn't normally take a shot in the dark on a question I can't really test the answer to, but since this one has sat around for a day, I'll give it a shot. It seems from looking at:
http://wiki.eclipse.org/TM_and_RSE_FAQ#How_can_I_do_Remote_Debugging_with_CDT.3F
...that even if the CDT has changed since that wiki page was made, you should still be able to change the debug command to:
ssh remotehost gdb
instead of using TM which uses gdbserver. This will probably be slightly slower than the TM remote debugging since that actually uses a local gdb, but on the other hand this way you won't have to NFS or SMB mount your source code to make it available to the local debugger (and if you're on a LAN it probably won't matter anyhow).
There's also a reference TCF implementation for linux, which you may or may not have any luck recompiling for AIX, but it allows for remote debugging if gdbserver is otherwise not available:
http://wiki.eclipse.org/DSDP/TM/TCF_FAQ
tried also to remotly debug an aix-appl with windows eclipse-cdt-gdb.
Got blocked at the end with unix/windows path-problems. Maybe my result can help u a little further - maybe you already got it work. I'm interested in your comment. asked on eclipse news portal- following the answer of martin oberhuber (thanks again) tried dsp dd (also blocked with path problem) and set an request in eclipse bugzilla.
here the link to news:
http://www.eclipse.org/newsportal/article.php?id=406&group=eclipse.dsdp.tm
Here my bugzilla:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=252758
At the moment we still debug localy with xldb but I am trying ddd-gdb at the moment. At least locally gdb is running.