I am trying to debug a program with lldb and clang.
Error is thrown
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations
I am trying it on Windows 10 and have latest version of clang (8.0)
I am trying with a command to compile a program with this clang -g -O0 test.c -o test and to debug I am giving lldb test and for breakpoint
b test.c:3
I am actually looking for debug information . But nothing seems to be working fine...any solution for this ?
I tried the same thing on ubuntu , with same command and everything works correctly.
I think Windows version of LLDB still under development.
Related
I recently just installed MinGW in Windows. However, when I try to compile a simple hello.c program I get this error message
C:\Users\HP-PC\Desktop\eclipse-workspace\FirstProject>gcc hello.c
Cannot create temporary file in C:\Users\HP-PC\AppData\Local\Temp;C:\MinGW\bin\:
Invalid argument
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I have tried reinstalling MinGW, but the error persists. I have also tried checking gcc --version and g++ -- version, and these worked without problems.
I'm a C newbie who recently installed gcc and gdb on windows 10 through MinGW. However, when I tried to debug my program using gdb through win10 cmd I got an error.
Here's what I did on cmd:
gcc ./test.c
gdb ./a.exe
And I got this:
not in executable format: File format not recognized
Then I tried to install gdb on bash as well and did the following:
gcc ./test.c
gdb ./a.out
(gcc through bash would create a.out but would create a.exe through cmd)
This time gdb seems to be able to start the executable file correctly, however when I tried typing in break commands I got another error message:
No symbol table is loaded. Use the "file" command.
Can anyone help to solve the problem?
PS. I've tried using file but it didn't work either.
PSS.after using gcc -g ./test.c the gdb seems to be working correctly on bash. However the windows one still can't run .exe file.
I made my code as a standalone .c file and read that, in order to debug, the file must be in a project. So I made an empty project and added my file to it, set some breakpoints and, when i run the debugger, I get this on console:
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6.1
Child process PID: 13112
Error in re-setting breakpoint 2: PC register is not available
Error in re-setting breakpoint -3: PC register is not available
In ()
Tried some tutorials and whatched some videos without success. Does somebody knows a fix for that? Is there a simpler way to debug a .c file?
For linux system you could use gdb as debugger in this way:
$ vim hello.c
# include <stdio.h>
int main()
{
printf("hello \n");
}
$ gcc -o hello hello.c
$ ./hello
$ gdb hello
(gdb) break main
(gdb) run
and then you can use:
c or continue
n or next
s or step
For more details see this.
Updated MinGW downloading it from its sourceforge repositor.
Downloaded the 6.2.0 version that is available in this link.
Then I unziped it to C:\ and modified the environment variable Path to add the new C:\MinGW\bin folder. To know if you made it correctly just open CMD and type gcc --version.
After that, I modified the compiller and debugger settings of Code::Blocks to use the new version of MinGW and its executables.
Now it is compiling and debugging properly.
According to Free Pascal's GDB Debugger Tips the problem is with GDB and they cite Bug 14018.
It appears you should use a different version of GDB. They suggest downgrading to 7.2. Now I believe other versions are now available, like 8.0. I don't know if GDB 8.0 suffers it too.
I'm building a plugin on Mac OS X using Eclipse CDT, which streams some data via libwebsockets to a browser websocket connection. The compilation process works fine, and I'm able to run my plugin in X-Plane and see data coming in on Google Chrome as expected.
I want to setup debugging with GDB, but I've been pulling my hair for about a week now without any success. I've created a launch configuration in Eclipse CDT to Attach to Application, but every time the debug session is supposed to start, I just get the following in the Eclipse debug perspective:
When starting the Debug, Eclipse shows me a popup list of running processes, and I select X-Plane, but when starting, it simply shows that the thread is suspended.
I've set up the launch configuration as follows:
As an alternative, I tried setting up a project using a makefile, which can be seen here:
https://gist.github.com/josefvanniekerk/690ad22160789c724490
The gcc and linker invocations from Eclipse CDT look as follows:
Building file: ../src/XPWebSocket.c
Invoking: GCC C Compiler
gcc -DAPL=1 -DIBM=0 -DLIN=0 -DXPLM210 -I../lib/xpsdk_v213/CHeaders/XPLM -I../lib/libwebsockets/lib -O3 -g3 -Wall -c -fmessage-length=0 -fvisibility=hidden -MMD -MP -MF"src/XPWebSocket.d" -MT"src/XPWebSocket.d" -o "src/XPWebSocket.o" "../src/XPWebSocket.c"
Finished building: ../src/XPWebSocket.c
Building target: xpwebsocket.xpl
Invoking: MacOS X C Linker
gcc -L../lib/libwebsockets/build/lib -F/{...omitted...}/Projects/xplane/XPWebSocketLib/lib/xpsdk_v213/Libraries/Mac -framework XPLM -shared -o "xpwebsocket.xpl" ./src/XPWebSocket.o -lwebsockets
Finished building target: xpwebsocket.xpl
I've made double sure that I've passed the -g option to enable debugging, but I just can't get this working.
I've tried pointing the C/C++ Application to /Applications/X-Plane/X-Plane.app/Contents/MacOS/X-Plane, changed it to Debug/xpwebsocket.xpl, tried pointing it to the .xpl file inside the X-Plane Resources/Plugins folder, quite frankly, I have no idea what I'm supposed to do to get debugging to work with X-Plane + GDB.
I've started reading up on trying to establish a GDB debug session from the command line, maybe if I understand that process, I can get around to get Eclipse to work. But who knows how many days of reading up that's going to involve.
Can anyone please offer some advice?
More info just in, GDB trace in Eclipse CDT is showing the following (just the error bits):
033,165 &".gdbinit: No such file or directory.\n"
033,165 13^error,msg=".gdbinit: No such file or directory."
037,222 19-target-attach --thread-group i1 197&
037,223 19^error,msg="Asynchronous execution not supported on this target."
After turning off: "Non-stop mode" in CDT, getting the following:
527,581 18^error,msg="Unable to find Mach task port for process-id 197: (os/kern) failure (0x5).\n (\
please check gdb is codesigned - see taskgated(8))"
Guessing I need to codesign X-Plane executable.
I managed to sort this out by signing gdb using the following guide:
http://ntraft.com/installing-gdb-on-os-x-mavericks/
However, fixing the above only reveals that there's possibly a LOT wrong with GDB on Yosemite.
I am using OSX 10.8.2 and gdb 6.3. I have to use both xcode 4.6.1 and xcode 3.
I have a simple c executable for which i am trying to attach gdb through command line. But i am not able to give break points. As soon as the gdb is attached i am getting the below lines.
unable to read unknown load command 0x2b
unable to read unknown load command 0x80000022
unable to read unknown load command 0x24
unable to read unknown load command 0x2a
I goggled it out and found that gdb 6.3 has few bugs for which above thing might be happening. so i thought of updating the gdb to 7.6. Even this is not happening.
Steps i did to install gdb 7.6
./congigure
make
make install
make is ending with below lines
make[8]: Nothing to be done for `all-am'.
make[1]: Nothing to be done for `all-target'.
make install with below lines
make[11]: Nothing to be done for `install-data-am'.
make[1]: Nothing to be done for `install-target'.
I want gdb which is supported by xcode 3,4.6 as well as in command line. Please help to resolve this.
They're just warnings, you're fine to ignore them. The gdb binary you're using didn't include the definitions of these load commands (LC_DYLD_INFO_ONLY, LC_VERSION_MIN_MACOSX, etc see /usr/include/mach-o/loader.h) and it's complaining about them when it parses the Mach-O binaries with them included. The gdb included in Xcode 4.6 will handle these without warning, fwiw.
As I can figure out with make command output your program is compiled and not changed. So you have to make clean your code and try again. Make sure that you are compiling the code with -g parameter of gcc to link the symbol table of C to the executable, in order to give to gdb the necessary parameters for debugging. So, you must to have a look at makefile.