Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse Debugger Usage with gcc on WIndows(2 questions regarding Eclipse debugging)
Eclipse Debugger Usage with gcc on WIndows [message #1863768] Mon, 26 February 2024 09:03 Go to next message
Werner Alexi is currently offline Werner AlexiFriend
Messages: 1
Registered: February 2024
Junior Member
Hi,
currently I am working on a Windows project in C using Eclipse CDT, gcc C compiler and the Eclipse debugger. Starting programs in debug mode works. I have encountered 2 problems, maybe someone here can help me:

1. How do I programmatically invoke the Eclipse debugger? In ancient times I worked with Visual Studio and remember the Windows function DebugBreak(). I tried this, but it did not work. My project internally spawns several processes and I need to catch one of them in the debugger at a certain point. How can I achieve this?

2. The project uses several source modules from other projects. I use the Eclipse link feature (i.e. use the "Add file", "Advanced", "Link to file in file system") features in Eclipse. The project builds ok. I can debug and step into the "linked" source files. But setting breakpoints in these files is not working. The breakpoints are simply ignored. I am also using the Eclipse debugger for an exotic platform (HPE NonStop) using cross compilers. In this scenario breakpoints in "linked" files work, so it does not seem to be a "cannot be done" kind of limitation. Is there a setting to enable this?

Any help is appreciated, thank you very much.
Kind regards
Werner
Re: Eclipse Debugger Usage with gcc on WIndows [message #1864950 is a reply to message #1863768] Sun, 21 April 2024 17:31 Go to previous message
Ralph Felts is currently offline Ralph FeltsFriend
Messages: 1
Registered: April 2024
Junior Member
Hello,
1. Invoking the Eclipse debugger programmatically can be achieved using the DebugBreak() function. However, DebugBreak() is a Windows-specific function and may not work with the Eclipse debugger. Instead, you can use the raise(SIGINT) function to generate a SIGINT signal, which can be caught by the debugger. Here's an example of how you can use it: geometry dash scratch
c
#include <signal.h>

int main() {
    // Your program code here

    raise(SIGINT); // Send SIGINT signal to invoke debugger

    // Rest of your program code
    return 0;
}

When you run your program and it reaches the raise(SIGINT) line, the debugger should be invoked and pause execution at that point.

2. I think the issue with breakpoints in linked source files might be related to the build configuration or the way the files are included in your project. I think you should make sure the linked source files are part of the build configuration. Go to your project properties, navigate to "C/C++ Build" -> "Settings" -> "Build Steps" -> "Build Artifact(s)", and ensure that the linked source files are included.

[Updated on: Wed, 24 April 2024 16:49]

Report message to a moderator

Previous Topic:gdb gets incorrect path from Eclipse
Next Topic:C++20 concepts support
Goto Forum:
  


Current Time: Tue May 21 10:49:02 GMT 2024

Powered by FUDForum. Page generated in 0.03271 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top