Author Topic: Debugger doesn't work anymore  (Read 6000 times)

Offline Curlz

  • Single posting newcomer
  • *
  • Posts: 8
Debugger doesn't work anymore
« on: August 02, 2016, 11:12:49 am »
I'm pretty sure it's just a minor issue, but I'm struggling for a day now to get the debugger running again.

I changed some code yesterday resulting in some NaN results I don't understand yet -> debugger time.

When i want to debug my code a console opens in sleep mode, codeblocks tells me terminal/console closed (Detected that the terminal/console has been closed, do you want to stop the debugging session?) and I get the following debugger log

Code
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/
Adding source dir: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/
Adding file: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal
Changing directory to: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/.
Set variable: LD_LIBRARY_PATH=.:

[debug]Command-line: /usr/bin/gdb -nx -fullname  -quiet  -args /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal
[debug]Working dir : /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal

Starting debugger: /usr/bin/gdb -nx -fullname  -quiet  -args /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal
done

[debug]Reading symbols from /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal...
[debug]done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Queued:[tty /dev/?]
[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11
[debug]Copyright (C) 2016 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Haltepunkt 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/
[debug]Source directories searched: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "/home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/TE-yz.c:145"
[debug]Haltepunkt 2 at 0x40261f: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/TE-yz.c, line 145.
[debug]>>>>>>cb_gdb:

Haltepunkt 2 at 0x40261f: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/TE-yz.c, line 145.

[debug]> break "/home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c:150"
[debug]Haltepunkt 3 at 0x400efb: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 150.
[debug]>>>>>>cb_gdb:

Haltepunkt 3 at 0x400efb: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 150.

[debug]> break "/home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c:185"
[debug]Haltepunkt 4 at 0x401169: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 185.
[debug]>>>>>>cb_gdb:

Haltepunkt 4 at 0x401169: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 185.

[debug]> break "/home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c:200"
[debug]Haltepunkt 5 at 0x401197: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 200.
[debug]>>>>>>cb_gdb:

Haltepunkt 5 at 0x401197: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 200.

[debug]> break "/home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c:217"
[debug]Haltepunkt 6 at 0x4011d8: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 217.
[debug]>>>>>>cb_gdb:

Haltepunkt 6 at 0x4011d8: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 217.

[debug]> break "/home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c:220"
[debug]Haltepunkt 7 at 0x40121a: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 220.
[debug]>>>>>>cb_gdb:

Haltepunkt 7 at 0x40121a: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 220.

[debug]> tty /dev/?
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]/dev/?: Datei oder Verzeichnis nicht gefunden.
[debug]During startup program exited with code 1.
[debug]Starting program: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal
[debug]>>>>>>cb_gdb:

During startup program exited with code 1.

[debug]> quit

Debugger finished with status 0

So all in all the debugger is not really starting.
I tried debugging other codes and get the same problem. Guess reinstalling codeblocks would work, but that doesn't prevent me from doing the same mistake again.
I've read some threads concerning the debugger around here, but haven't really found my problem.

Looking forward to an answer.

Curlz

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13153
    • Travis build status
Re: Debugger doesn't work anymore
« Reply #1 on: August 02, 2016, 11:40:19 am »
Does it work if you execute the same commands in gdb started from terminal?
(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 Curlz

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugger doesn't work anymore
« Reply #2 on: August 02, 2016, 12:46:50 pm »
First of all thanks for your time!

Running gdb from console works fine. After specifying everything the code starts running until it hits the first breakpoint.

I'm not really used to working with gdb from console though. Guess I will try to find my error this way until I figure out how to get gdb running in codeblocks again.

Cheers.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13153
    • Travis build status
Re: Debugger doesn't work anymore
« Reply #3 on: August 02, 2016, 02:04:19 pm »
Can you show me the log from the console?

p.s. keep in mind that because your locale is set to German C::B won't work correctly. It parses the gdb output and expects English messages! You have to reset the locale to English.
(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 Curlz

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugger doesn't work anymore
« Reply #4 on: August 02, 2016, 02:23:03 pm »
Using gbd from console looks like this

Code
[email protected]:~/Dokumente/IGVP-Rechner/FDTD-Toroidal$ gdb
GNU gdb (Ubuntu 7.11-0ubuntu1) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) file ./bin/Debug/FDTD-Toroidal
Reading symbols from ./bin/Debug/FDTD-Toroidal...done.
(gdb) break 217
Haltepunkt 1 at 0x401224: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 217.
(gdb) break 222
Haltepunkt 2 at 0x401233: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 222.
(gdb) break 225
Haltepunkt 3 at 0x401275: file /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c, line 225.
(gdb) run
Starting program: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal
f_in in GHz =
16

Breakpoint 2, main () at /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/main.c:222
222     source(t, y_max, z_max, mesh, pi, dt, jplas, e_field);

Hope this is the log you were asking for?!
The has code been compiled with codeblocks (using gcc) before. Breakpoint 1 is within an if statement I'm using for debugging now and is therefore skipped here, the other two are at functions that are possibly involved in my problem.

Thanks for the tip with my locale language. Will switch to english right away.

PS: Just tried debugging in C::B again and changing my locale language didn't do the trick. Also resetted to default in setting > debugger > GBD/CDB debugger.
« Last Edit: August 02, 2016, 02:31:25 pm by Curlz »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13153
    • Travis build status
Re: Debugger doesn't work anymore
« Reply #5 on: August 02, 2016, 02:33:16 pm »
Please try to replicate what commands cb is executing, so we can see which one is causing the problem.
(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 Curlz

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugger doesn't work anymore
« Reply #6 on: August 02, 2016, 02:43:31 pm »
At the end of the first log it says (now in english)

Code
[debug]> tty /dev/?
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]/dev/?: No such file or directory.
[debug]During startup program exited with code 1.
[debug]Starting program: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal
[debug]>>>>>>cb_gdb:

During startup program exited with code 1.

[debug]> quit

Debugger finished with status 0

Not sure, but it seems like gdb is trying to run the wrong file here?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13153
    • Travis build status
Re: Debugger doesn't work anymore
« Reply #7 on: August 02, 2016, 04:19:27 pm »
The output is pretty messed up.
Can you run the same commands in terminal and tell me which one is causing the problem?
(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 Curlz

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugger doesn't work anymore
« Reply #8 on: August 02, 2016, 04:42:34 pm »
Alright. The gdb tty/ dev/? before the run is causing the problem..

This is now from console
Code

(gdb) tty /dev/?
(gdb) run
Starting program: /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal
/dev/?: No such file or directory.
During startup program exited with code 1.


It's looking for the right program which is in /home/lennart/Dokumente/IGVP-Rechner/FDTD-Toroidal/bin/Debug/FDTD-Toroidal, but can't find the terminal dev/?.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13153
    • Travis build status
Re: Debugger doesn't work anymore
« Reply #9 on: August 02, 2016, 05:49:56 pm »
Interesting. What is your terminal command?
You can find it in Settings -> Environment -> General.
(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 Curlz

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugger doesn't work anymore
« Reply #10 on: August 02, 2016, 06:02:21 pm »
Terminal to launch console programs is konsole -e (seems to be still german) which is the standard terminal I got from kubuntu, but I think it was xterm some time ago. Shell to run commands in is  /bin/sh -c.

After changing the "Terminal to launch console programs" back to xterm -T $TITLE -e, the debugger seems to be working again, giving "warning: GDB: Failed to set controlling terminal: Operation not permitted" before the program starts.
Strange.. I do remember running the debugger in the usual terminal. Possibly because locale was German for a while?

But it seems like the C::B debugger is working again. Thank you very much for your guidance!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13153
    • Travis build status
Re: Debugger doesn't work anymore
« Reply #11 on: August 02, 2016, 09:00:03 pm »
Interesting. What version of konsole/kde are you running?
(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 Curlz

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugger doesn't work anymore
« Reply #12 on: August 03, 2016, 10:58:47 am »
KDE is Kubuntu 16.04 and all i found out about the terminal is that its called org.kde.konsole (https://konsole.kde.org/). (I also have debain-xterm and debain-uxterm, but usually prefer the other one.)

In the info center there is:
KDE Plasma version: 5.5.5
QT-version: 5.5.1
Kernel version: 4.4.0-31-generic
OS type: 64 bit

"konsole --version" furthermore gives
Qt: 5.5.1
KDE Frameworks: 5.18.0
Konsole: 15.12.3

Not sure if that is helpful so here is also the output of "cat /proc/version"
Linux version 4.4.0-31-generic ([email protected]) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1) ) #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016