New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple undeletable breakpoints in one line in template C++ function #1625

Closed
alxklk opened this Issue Apr 26, 2017 · 9 comments

Comments

Projects
None yet
2 participants
@alxklk

alxklk commented Apr 26, 2017

After clicking the breakpoint area or pressing F9 inside template C++ function multiple breakpoints are created. One with id, for example, '5' and several with ids '5.1', '5.2', '5.3' and so on. Only first can be deleted either with mouse or with keyboard. Others can be deleted only with pressing 'Delete' or 'Delete All' button in breakpoints window.

CodeLite version 10.0.3 Windows 10 and Linux x64 (mint 18.1), GDB is set as debugger.
Both Linux and Windows versions were downloaded from official site.

screenshot at 2017-04-26 16-06-45

@alxklk alxklk changed the title from Multiple undeletable breakpints in one line in template C++ function to Multiple undeletable breakpoints in one line in template C++ function Apr 26, 2017

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Apr 26, 2017

Owner

I just created a sample workspace with similar code (wish you could copy your code to save me some time ...) and it does not happen for me.

The problem is: I know you are right, I have seen it happen before but I could not reproduce it in a reliable way, I hoped that your example will shed some light on the matter...

Owner

eranif commented Apr 26, 2017

I just created a sample workspace with similar code (wish you could copy your code to save me some time ...) and it does not happen for me.

The problem is: I know you are right, I have seen it happen before but I could not reproduce it in a reliable way, I hoped that your example will shed some light on the matter...

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Apr 26, 2017

Owner

I will try this tomorrow on a Debian box...

Owner

eranif commented Apr 26, 2017

I will try this tomorrow on a Debian box...

@alxklk

This comment has been minimized.

Show comment
Hide comment
@alxklk

alxklk Apr 27, 2017

I could even attach the whole project archived. Sorry, I should do it yesterday.
testBP.zip

alxklk commented Apr 27, 2017

I could even attach the whole project archived. Sorry, I should do it yesterday.
testBP.zip

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Apr 27, 2017

Owner

Just tried that on Debian 8 machine - this does not happen. Each click toggles the breakpoint (i.e. if there is a breakpoint, it removes it, otherwise, a new breakpoint is added)

Any special steps? or just click the margin with the mouse?

Owner

eranif commented Apr 27, 2017

Just tried that on Debian 8 machine - this does not happen. Each click toggles the breakpoint (i.e. if there is a breakpoint, it removes it, otherwise, a new breakpoint is added)

Any special steps? or just click the margin with the mouse?

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Apr 27, 2017

Owner

Ok, I managed to make this happen (it just started happening here with your code example).
Here is what happening:
Because this is a template function with multiple calls (each call with different type) CodeLite asks GDB to place a single breakpoint on that file/line. However, because this is a template function, GDB has multiple versions of this function, each with different template argument instantiation (one signature for int, one for double, one for float and one for char*)

This is what GDB replies when CodeLite asks for "list-of-breakpoints":

DEBUG>>00000260^done,BreakpointTable={nr_rows="2",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000040121d",func="main(int, char**)",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="12",thread-groups=["i1"],times="1",original-location="/home/eran/Downloads/testBP/main.cpp:12"},bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<MULTIPLE>",times="0",original-location="/home/eran/Downloads/testBP/main.cpp:6"},{number="2.1",enabled="y",addr="0x00000000004012d7",func="testPrint<int>(int const&)",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="6",thread-groups=["i1"]},{number="2.2",enabled="y",addr="0x000000000040130a",func="testPrint<double>(double const&)",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="6",thread-groups=["i1"]},{number="2.3",enabled="y",addr="0x0000000000401345",func="testPrint<float>(float const&)",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="6",thread-groups=["i1"]},{number="2.4",enabled="y",addr="0x000000000040137e",func="testPrint<char [2]>(char const (&) [2])",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="6",thread-groups=["i1"]}]}

Notice breakpoints: 2.1, 2.2, 2.3 and 2.4 all has their "func" property set to different signature
Now, next time you start a debug session, CodeLite remembers all the duplicate breakpoints (2.1, 2.2 etc) and then it asks GDB to set a breakpoint - each "set-breakpoint" command is now multiple by 5, so for the first invocation you get 5 breakpoints, next time you run GDB within CodeLite, you get 25 etc)

The fix should be: don't store multiple breakpoints for next debug session

Owner

eranif commented Apr 27, 2017

Ok, I managed to make this happen (it just started happening here with your code example).
Here is what happening:
Because this is a template function with multiple calls (each call with different type) CodeLite asks GDB to place a single breakpoint on that file/line. However, because this is a template function, GDB has multiple versions of this function, each with different template argument instantiation (one signature for int, one for double, one for float and one for char*)

This is what GDB replies when CodeLite asks for "list-of-breakpoints":

DEBUG>>00000260^done,BreakpointTable={nr_rows="2",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000040121d",func="main(int, char**)",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="12",thread-groups=["i1"],times="1",original-location="/home/eran/Downloads/testBP/main.cpp:12"},bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="<MULTIPLE>",times="0",original-location="/home/eran/Downloads/testBP/main.cpp:6"},{number="2.1",enabled="y",addr="0x00000000004012d7",func="testPrint<int>(int const&)",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="6",thread-groups=["i1"]},{number="2.2",enabled="y",addr="0x000000000040130a",func="testPrint<double>(double const&)",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="6",thread-groups=["i1"]},{number="2.3",enabled="y",addr="0x0000000000401345",func="testPrint<float>(float const&)",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="6",thread-groups=["i1"]},{number="2.4",enabled="y",addr="0x000000000040137e",func="testPrint<char [2]>(char const (&) [2])",file="/home/eran/Downloads/testBP/main.cpp",fullname="/home/eran/Downloads/testBP/main.cpp",line="6",thread-groups=["i1"]}]}

Notice breakpoints: 2.1, 2.2, 2.3 and 2.4 all has their "func" property set to different signature
Now, next time you start a debug session, CodeLite remembers all the duplicate breakpoints (2.1, 2.2 etc) and then it asks GDB to set a breakpoint - each "set-breakpoint" command is now multiple by 5, so for the first invocation you get 5 breakpoints, next time you run GDB within CodeLite, you get 25 etc)

The fix should be: don't store multiple breakpoints for next debug session

@alxklk

This comment has been minimized.

Show comment
Hide comment
@alxklk

alxklk Apr 27, 2017

I tried to reproduce steps.
Create new C++ workspace, then create new console g++ project, all settings were set to default (gnu g++ and gnu gdb), paste source code from attached archive into main.cpp.
If I press F9 or click the margin with mouse, one breakpoint appears in breakpoints window, it's ok.
After pressing F5 and first breakpoint hit I see additional breakpoints with ids 1.1, 1.2, ets., it works only for template functions and number of such breakpoints is equal to quantity of different template instantiations, I think. After the end of debug session additional breakpoints disappear and it is ok. The problem is if I want to delete breakpoint while debugging my program. Only main breakpoint with single digit id can be deleted by pressing F9 or clicking the margin. Additional ones are active and the only way to delete them is Delete All button of breakpoints window.

alxklk commented Apr 27, 2017

I tried to reproduce steps.
Create new C++ workspace, then create new console g++ project, all settings were set to default (gnu g++ and gnu gdb), paste source code from attached archive into main.cpp.
If I press F9 or click the margin with mouse, one breakpoint appears in breakpoints window, it's ok.
After pressing F5 and first breakpoint hit I see additional breakpoints with ids 1.1, 1.2, ets., it works only for template functions and number of such breakpoints is equal to quantity of different template instantiations, I think. After the end of debug session additional breakpoints disappear and it is ok. The problem is if I want to delete breakpoint while debugging my program. Only main breakpoint with single digit id can be deleted by pressing F9 or clicking the margin. Additional ones are active and the only way to delete them is Delete All button of breakpoints window.

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Apr 27, 2017

Owner

Read my comment above (I already reproduced this and managed to figure out what is going on)

Owner

eranif commented Apr 27, 2017

Read my comment above (I already reproduced this and managed to figure out what is going on)

@alxklk

This comment has been minimized.

Show comment
Hide comment
@alxklk

alxklk Apr 27, 2017

Read my comment above (I already reproduced this and managed to figure out what is going on)

Yes, I saw it after I've sent my.

alxklk commented Apr 27, 2017

Read my comment above (I already reproduced this and managed to figure out what is going on)

Yes, I saw it after I've sent my.

@eranif eranif closed this in 814bd1f Apr 27, 2017

@eranif

This comment has been minimized.

Show comment
Hide comment
@eranif

eranif Apr 27, 2017

Owner

Ok, I managed to fix this by removing the "duplicate" entries from the breakpoint table
This will fix this issue completely (tested locally)

Owner

eranif commented Apr 27, 2017

Ok, I managed to fix this by removing the "duplicate" entries from the breakpoint table
This will fix this issue completely (tested locally)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment