remote DBG via TCP cannot find bounds of current function - c++

I am trying to remotely debug a linux machine c++ hello world code from a windows client. I am Debuging from windows 7 to Beaglebone Black running ubuntu. I remember i had similar issues when i was debuging from a linux machine to raspberry pi host.
The problem is, when i start debbuging i cant step anywhere because i am getting ths message:
I provided the gdb debugger and executable for the client program within i debug from but i have no clue what else shuld i give? One thing is that when i instead of stepping continue through the code, i finally get to my breakpoint but i get segfault at the end anyways. How can i provide the apropriate info for the debugger?
Any help would be really aprichiated.

Related

Remote gdb stops at every event

I'm having remote ARM Linux box which I need to debug.
The server is started:
gdbserver :12345 ./my_app
The client:
./arm-am3354-linux-gnueabihf-gdb ~/
(gdb) target remote dev_r:12345
(gdb) continue
Then I'm trying to pause the app with Ctrl+C, but the gdb stops with:
[Inferior 1 (process 2766) exited with code 01]
And on server:
Child exited with status 1
GDBserver exiting
Story:
I was trying to use remote debugging in QtCreator, but when setting breakpoints in run-time the gdb was crashing in the same way. Also the breakpoints and pause is not working in QtCreator.
I was trying also another gdb like gdb-multiarch and the one from android-sdk.
Update:
Debugging small program aka Hello World works. Local Debugging (on x86) works too. The app itself has hundred thousand lines of code, shared and static libraries.
Partial solution:
Probably the sysroot for embedded platform that I've got was invalid. After copying /lib/ and /usr/ from the target device and setting it as
set sysroot /home/karel/sysroot
I'm able to set breakpoints and the app stops at them. The pause however is still stopping the remote app. The same for QtCreator: Tools->Options->Debugger->GDB->Additional Attach Commands
I had a similar (or even exactly the same?) issue with debugging my application running on the EGLFS platform. Debugging when built with Qt 5.4 was working perfectly fine, debugging with Qt 5.5 did behave as you describe.
After hours of searching, I found that my application on Qt 5.5 exited when receiving a SIGINT, whereas on Qt 5.4, the debugger could pause the application as expected. Since GDB sends SIGINT when trying to pause the application or setting / removing a breakpoint, this was where trouble started.
After some more research, I finally found the following commit to Qt 5.5: Fix up signal handling in QFbVtHandler. At the very end, you see that when receiving SIGINT or SIGTERM, the handleInt() handler is called where we finally run into _exit(1). Setting a breakpoint there confirmed that this is exactly what happens when trying to pause or set a breakpoint with GDB.
Solution that worked for me: I have created a patch to qfbvthandler.cpp, simply removing the #define VTH_ENABLED line.
GDB debugging is now again working like a charm.
Note: Even though qfbvthandler.cpp has been updated in Qt5.6 and upwards, I suspect the behaviour would still be the same. I however don't have a workspace set up in order to test this.

"Program File does not exist" while trying to debug with Eclipse/OpenOCD

I recently got a nrf51 bluetooth module and I am trying to debug it with Eclipse Mars. I installed the required toolchain as well as OpenOCD (I am using STLink v2 to debug the board).
While running openOCD and arm-none-eabi-gdb in console, everything works fine. The OpenOCD server starts up and I am able to connect with the gdb tool.
However, when trying to start a debug session with Eclipse, it throws the error "Exception occurred during launch. Reason: Program file does not exist". The build process finishes normally. It's the first time I used Eclipse for C/C++ development and the first time after years I used Eclipse at all so I don't even have an idea what could be wrong.
I tried messing around with the project settings without luck. Can anyone give me a hint?
I should mention, I used an already existing Makefile since I tried compiling one of the nordic SDK examples. I Changed it so the resulting files are ready for debugging.
In past I've used Segger's Jlink programmer and the JlinkExe (A pre-built binary) for Linux platform to program Nordic Bluetooth module such as NRF51 and it worked seamlessly. There are some very good documentation on using GNU toolchain with NRF51 series SOC and in case you get your hands on Segger's Jlink, I would recommend you to use that for programming. Meanwhile, this thread in the Nordic's developer zone seem to be very much similar to your problem. Maybe you'll be find some clues there.

X Server crashes when I try to change settings in Eclipse on remote Linux node

I've written a C++ application in windows, and want to be able to run it on a Linux cluster node without using Wine. I therefore tried to connect to a cluster node (with an X Server running) and once connected tried to compile the code in Eclipse (C++). However, when I try to set up the linking in the Eclipse menu, the program crashes and I get a 'BadWindow (invalid Window parameter)' X Server error.
I found this bug report
https://bugs.eclipse.org/bugs/show_bug.cgi?id=333227
And tried to use -XX:-UseCompressedOops but it made no difference.
What else could it be?
Well, I found an easy solution; I switched to Cygwin/X instead of the X server software I used before. Not a crash in sight.

debugging stripped-down linux system

I'm having a problem on my embedded linux board. My program runs, then somewhere in a particular function throws a segmentation fault. So i'm trying to track down why this is happening so I can fix it.
The problem is that my target board runs a filesystem image which does not include gdb or gdbserver. Is there any way I can debug this application as it runs on the embedded target without rebuilding the kernel or my application?

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.