Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Breakpoints don't work (Breakpoints don't work using GUI (do with debugger console))
Breakpoints don't work [message #1817608] Tue, 26 November 2019 10:43 Go to next message
Eclipse UserFriend
In a C program I can set a break point and it **appears** to be set but when debugging execution blows past, not breaking.

When I use the 'debugger console' to look at the breakponts (info breakpoints) they show as having the address as 'Pending'.

I can explicitly set breakpoints in the debuuger console (info breakpoint main.c:931) and the address is shown and the breakpoint is hit when debugging.

Why does setting the breakpoint with the GUI not set the breakpoint properly ??
Re: Breakpoints don't work [message #1817673 is a reply to message #1817608] Wed, 27 November 2019 11:59 Go to previous messageGo to next message
Eclipse UserFriend
You may need to provide more information.
What shows in the Breakpoints view?
A valid breakpoint has a check mark on it in both the Editor and Breakpoint View.
It's possible that the source doesn't match the executable
or you have disabled the breakpoints in Eclipse (icon: little blue circle with a slash).
I've moved things around so I can't tell you how to find the icon.
If you have set it then all breakpoints will be shown with a slash through them.

What happens if you set Stop at startup in the Debug Launcher?

Re: Breakpoints don't work [message #1817677 is a reply to message #1817673] Wed, 27 November 2019 12:47 Go to previous messageGo to next message
Eclipse UserFriend
Yes it has the blue circle on both views.
In the debugger console though, when I use the gdb 'info breakpoints' it shows them as having an address '<PENDING>'. This is not a shared library (where I understand this could occur).
From the debugger console I can set a breakpoint that does work ... 'break main.c:929'.

(gdb) info breakpoints
Num     Type           Disp Enb Address            What
4       breakpoint     keep y   0x000000000042db0c in main at ../src/main.c:929
6       breakpoint     keep y   <PENDING>          /home/michael/git/sandbox/src/main.c:931

[Updated on: Wed, 27 November 2019 12:49] by Moderator

Re: Breakpoints don't work [message #1817680 is a reply to message #1817677] Wed, 27 November 2019 14:33 Go to previous messageGo to next message
Eclipse UserFriend
So how did you get it to stop?
I must be at a breakpoint.
I can't get control at the gdb terminal until a breakpoint is hit.
GDB just runs to completion when there are none.
Your breakpoints seem to be enabled.

Here's the Editor view stopped at main with a breakpoint at the next line
index.php/fa/36842/0/
Your <PENDING> breakpoint is showing an absolute path.
Is it valid?
How was it set?
When I set a breakpoint, it has a relative path.
index.php/fa/36841/0/


There was an old issue with breakpoints and absolute paths.
Not sure if it applies here.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=219522



Re: Breakpoints don't work [message #1817691 is a reply to message #1817680] Wed, 27 November 2019 18:24 Go to previous messageGo to next message
Eclipse UserFriend
So how did you get it to stop?

I'm not sure I understand the question ... the gdb is started (using the eclipse "debug as" -> "Debug Configurations" -> "MyProgram Debug" (then press Debug button)) and stops at the top of main. If I then press 'Resume' (F8) the program runs but goes through the breakpoints set in eclipse (the ones with the <PENDING> address)

I must be at a breakpoint.
I can't get control at the gdb terminal until a breakpoint is hit.
GDB just runs to completion when there are none.
Your breakpoints seem to be enabled.


Your <PENDING> breakpoint is showing an absolute path.
Is it valid?
How was it set?


The only breakpoints that work are the ones that i set from within the debugger console directly in gdb. The breakpoints set by using the mouse on the source code window **appear** to be set but are the ones with <PENDING> address and do not work.
Yes, the path is correct (that would have been a dead giveaway!).
It is curious that there is a difference... the breakpoints set in gdb debugger console are relative but the ones set with the mouse/GUI are absolute.


[Updated on: Wed, 27 November 2019 18:25] by Moderator

Re: Breakpoints don't work [message #1817692 is a reply to message #1817691] Wed, 27 November 2019 19:06 Go to previous messageGo to next message
Eclipse UserFriend
The debugger stops at main because a temporary breakpoint was set there.
You don't see it because it evaporates as soon as it is hit.
So, Eclipse IS setting breakpoints that work.
In fact, it's the only way you could have commanded another breakpoint with GDB.

I set my breakpoints using the GUI so the question becomes:
Why are my breakpoint paths relative and yours are absolute?
There's clearly something different but I don't have what you have.
Your going to have to do more than repeat yourself.

What happens if you create a HelloWorld project?
Can you debug it?

If so, what's different between the projects?
If not, then you have something repeatable you can file a bug report on.
But I can tell you that what I've posted so far is with a HelloWorld project.

What version of Eclipse are you using?
What version of CDT are you using?
What version of GDB are you using?

Where is the executable in relation to the source?
What is in the Debug Launch source tab?
Where does Eclipse think the source is?


[Updated on: Wed, 27 November 2019 19:20] by Moderator

Re: Breakpoints don't work [message #1817693 is a reply to message #1817692] Wed, 27 November 2019 19:35 Go to previous messageGo to next message
Eclipse UserFriend
Yes, of course I tried a 'hello world' program ... same symptoms, with a new workspace ... same symptoms..., new installation of eclipse ... same symptoms

The executable is in the directory ProjectDir/Debug, the source in the directory ProjectDir/src, the includes in the directory ProjectDir/include.

The debugger starts fine, the source is shown in the debugging view and as I've said a couple of times the breakpoints appear to be set at the correct place in the program.

Eclipse IDE for C/C++ Developers
Version: 2019-09 R (4.13.0)
Build id: 20190917-1200
OS: Linux, v.5.3.12-300.fc31.x86_64, x86_64 / gtk 3.24.12
Java version: 13.0.1

C/C++ Common GDB Support 9.9.0.201906111633 org.eclipse.cdt.gdb.feature.group Eclipse CDT
GNU gdb (GDB) Fedora 8.3.50.20190824-25.fc31
Re: Breakpoints don't work [message #1817694 is a reply to message #1817693] Wed, 27 November 2019 19:46 Go to previous messageGo to next message
Eclipse UserFriend
I'm using the same Eclipse and CDT versions but have no problems.
FWIW: I have GNU gdb (GDB) Fedora 8.3-6.fc30

You seem to have uncovered a bug.
File a bug report using the HelloWorld example.
They might be able to give you a workaround.
Re: Breakpoints don't work [message #1817697 is a reply to message #1817694] Wed, 27 November 2019 22:02 Go to previous messageGo to next message
Eclipse UserFriend
Yes, it could well be something to do with the later version of gdb. I did not notice this when I was using F30.
I find it hard to believe that no one else experiences this 8-(
Re: Breakpoints don't work [message #1818123 is a reply to message #1817697] Fri, 06 December 2019 06:10 Go to previous messageGo to next message
Eclipse UserFriend
You can get more results on this problem at Ask Fedora, subject thread "eclipse-does-not-install-in-fedora-31/4015" - in the end, I downgraded to Fedora 30, since there was no sign of a solution for Fedora 31 (see the Fedora Eclipse packagers' comment...). Doing this also avoids other problems with Fedora 31 (default Wayland compositor stops Paraview working, discontinuing python 2 stops Calibre working...)
Re: Breakpoints don't work [message #1818571 is a reply to message #1818123] Thu, 19 December 2019 19:35 Go to previous messageGo to next message
Eclipse UserFriend
I'm installing an independent stand-alone Eclipse. It installs and runs fine except for the breakpoint issue.

My problem is certainly an issue of absolute paths vs relative paths.

Using the CDT/Eclipse GUI, setting a breakpoint uses an absolute path to the source file (except for the initial temporary breakpoint at the first line of the program). If I add the breakpoint using the Debugger Console it is a relative path and it works.
I saw a couple of issues on other forums of this being a problem with Windows. Now, it seems it is also an issue on Linux.

Guess I'll just have to add breakpoints old school until it's fixed.

(gdb)                                                                          
Temporary breakpoint 2, main () at ../src/test2.c:15
15              puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
(gdb) info breakpoints                                                                                                    
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   <PENDING>  /home/michael/eclipse-workspace/test2/src/test2.c:16
(gdb) break test2.c:15                                                                                                                                 
Breakpoint 3 at 0x40112a: file ../src/test2.c, line 15.
(gdb) info break
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   <PENDING>          /home/michael/eclipse-workspace/test2/src/test2.c:16
3       breakpoint     keep y   0x000000000040112a in main at ../src/test2.c:15
4       breakpoint     keep y   <PENDING>          /home/michael/eclipse-workspace/test2/src/test2.c:15
(gdb)     
Re: Breakpoints don't work [message #1818615 is a reply to message #1818571] Fri, 20 December 2019 11:12 Go to previous messageGo to next message
Eclipse UserFriend
OK, here's some interesting observations...
The source file in GDB is referenced relative to the Debug directory ...
Located in /home/michael/eclipse-workspace/test/Debug/../src/test.c
but when the GUI is used to set the breakpoint it uses the collapsed path line ...
Located in /home/michael/eclipse-workspace/test/src/test.c
which GDB rejects...

(gdb)                                                                                                                                                 
Temporary breakpoint 1, main () at ../src/test.c:15
15              puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
info source
Current source file is ../src/test.c
Compilation directory is /home/michael/eclipse-workspace/test/Debug
Located in /home/michael/eclipse-workspace/test/Debug/../src/test.c
Contains 17 lines.
Source language is c.
Producer is GNU C17 9.2.1 20190827 (Red Hat 9.2.1-1) -mtune=generic -march=x86-64 -g3 -O0 -fmessage-length=0.
Compiled with DWARF 2 debugging format.
Includes preprocessor macro info.
(gdb) break /home/michael/eclipse-workspace/test/src/test.c:15
No source file named /home/michael/eclipse-workspace/test/src/test.c.
Breakpoint 2 (/home/michael/eclipse-workspace/test/src/test.c:15) pending.
(gdb) break /home/michael/eclipse-workspace/test/Debug/../src/test.c:15
Breakpoint 3 at 0x40112a: file ../src/test.c, line 15.
(gdb) 


A half fix is to add both "File System Folder" of "/" and a "Path Mapping" to the debug configuration for the source.
This works when adding a breakpoint with the GUI; however, when you start the debugging previously defined breakpoints still have the original issue. So each time you start debugging you need to remove all breakpoints and then add them back 8-(

index.php/fa/37003/0/

[Updated on: Fri, 20 December 2019 11:49] by Moderator

Re: Breakpoints don't work [message #1818628 is a reply to message #1818615] Fri, 20 December 2019 13:40 Go to previous messageGo to next message
Eclipse UserFriend
I have replied on the bug that was created - but the summary is that Fedora included an unreleased version of GDB that had a bug in it. The GDB bug has been fixed. No released version of GDB has the bug in it.

Please see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=558519#c1


-----

To try to answer the why - GDB in the console displays the name of the file as it was passed to the compiler when compiled, e.g. ../src/Hello.c, but in the MI layer we rely on the fullname to the file which, if possible, resolves to an absolute path.

The bug in GDB broke the canonicalizations of paths, so GDB was incorrectly failing to install a breakpoint because it decided the absolute path to the file did not match anything in the debug information.

Although often (correctly) criticised as too subtle, Eclipse was showing the breakpoint as pending (or not fully installed) because the blue dot did not have the blue tick too.
Re: Breakpoints don't work [message #1818631 is a reply to message #1818628] Fri, 20 December 2019 14:21 Go to previous message
Eclipse UserFriend
The GDB in Fedora Rawhide (32) does not have the bug that caused this problem.
For others who have this problem, here are the RPM's for GDB 9.0.54 on Fedora 31.

https://drive.google.com/drive/folders/1a_VECNDg5oapoSGqtfdz_DE3CwuLFov9

Previous Topic:NPE with eclipse 2019-12 CDT
Next Topic:Symbol 'std' could not be resolved Issue
Goto Forum:
  


Current Time: Sun Jun 15 15:36:38 EDT 2025

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

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

Back to the top