Author Topic: Debugging under Linux - setting breakpoints while running  (Read 7930 times)

Offline Mikhail

  • Single posting newcomer
  • *
  • Posts: 4
Debugging under Linux - setting breakpoints while running
« on: April 08, 2013, 04:16:21 am »
Hi,

Let me make it clear:

Breakpoints which are set while program is running, are NOT reachable,
debugger does not break on them.

To reproduce the behavior start debugging, then set break
point (on menu handler or something like that).

Program will not break when you call this menu/

If break point is set before starting debugger or when debugger
is paused on some other break point, I can set new break point
and it is reachable.

Not all programs exhibit this.

My question is what possibly could cause this?
I use "-g" to enable debugging.

The program in question is too big to post.

Thank you,
Mikhail






« Last Edit: April 08, 2013, 06:17:37 pm by Mikhail »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugging under Linux - setting breakpoints while running
« Reply #1 on: April 08, 2013, 05:17:25 am »
Hi,
When I  start debugging and then set break point then program breaks when this line
is reached. It does work and I had to compile example with wxWidgets to verify it.
However in my program (uses old wxwidgets) for some reason it does not happen -
when I start the program under debugger and set break point while running is never reached.
I can't understand your report, can you show us the exact steps to reproduce your bug?

BTW: Please edit your post, and wrap your log messages with code tags, thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging under Linux - setting breakpoints while running
« Reply #2 on: April 08, 2013, 09:31:16 am »
Also please redo the log that doesn't work after you've enabled full logging in the options of the debugger (Settings -> Debugger)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Debugging under Linux - setting breakpoints while running
« Reply #3 on: April 08, 2013, 08:26:41 pm »
Using both: -g and -s would cause such behaviour and is a common mistake. Post the full build log for more...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Mikhail

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugging under Linux - setting breakpoints while running
« Reply #4 on: April 09, 2013, 01:58:10 am »
Attached is compilation and debug logs.

I am not using "-s" option.
When I tried to set break point debugger posted message (see in the log)

[debug]Code::Blocks is trying to interrupt process with pid: 4020; child pid: 0 gdb pid: 4020

Continuing...

It seems that actual point was only set on exit

[debug]> break "/home/misha/tmp/wxxt-1.67/samples/demo/demo.cpp:353"
[debug]Breakpoint 2 at 0x804fb53: file /home/misha/tmp/wxxt-1.67/samples/demo/demo.cpp, line 353.

Your help is appreciated,

Thank  you

Mikhail

[attachment deleted by admin]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging under Linux - setting breakpoints while running
« Reply #5 on: April 09, 2013, 10:11:25 am »
The problem is that the pid detection failed...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Mikhail

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugging under Linux - setting breakpoints while running
« Reply #6 on: April 09, 2013, 05:44:28 pm »
What could be done on my side to find out why it is failed?

If I start program outside of CB and then attach debugger to it
everything works as expected.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugging under Linux - setting breakpoints while running
« Reply #7 on: April 09, 2013, 06:29:27 pm »
What could be done on my side to find out why it is failed?
Nothing, I have to fix this bug.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Mikhail

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugging under Linux - setting breakpoints while running
« Reply #8 on: April 09, 2013, 06:33:07 pm »
Let me know if you need code from me. I can package GUI lib + demo program + CB workspace