Author Topic: Remote debugging issue in 13.12?  (Read 7458 times)

Offline cab_team

  • Single posting newcomer
  • *
  • Posts: 6
Remote debugging issue in 13.12?
« on: January 15, 2015, 09:39:03 am »
Hello CB team,

We're using codeblocks 13.12 on Ubuntu 12.04 (32 bit). We're remote debugging a mipsel target with gdb 7.8.1 and when we select Debug->Stop debugger the local gdb process finishes but the remote executable continues to run. Here is the debugger log:

Code: [Select]
Selecting target:
Device R2
Adding source dir: /storage/work/project/project_trunk /emulator/proj.cb
Adding source dir: /storage/work/project/
Adding file: /storage/work/project/project_trunk/stb/derived.debug/run_device.sh
Changing directory to: /storage/work/project/project_trunk /emulator/proj.cb
Set variable: LD_LIBRARY_PATH=.:

[debug]Command-line: ./gdb-switcher -nx -fullname  -quiet  -args /storage/work/project/project_trunk/stb/derived.debug/run_device.sh
[debug]Working dir : /storage/work/project/project_trunk /emulator/proj.cb

Starting debugger: ./gdb-switcher -nx -fullname  -quiet  -args /storage/work/project/project_trunk/stb/derived.debug/run_device.sh
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Connecting to remote target
Setting breakpoints

[debug]"/storage/work/project/project_trunk/stb/derived.debug/run_device.sh": not in executable format: File format not recognised
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.8.1
[debug]Copyright (C) 2014 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 "--host=i686-pc-linux-gnu --target=mipsel-linux-uclibc".
[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 (GDB) 7.8.1

[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]No symbol table is loaded.  Use the "file" command.
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory /storage/work/project/project_trunk /emulator/proj.cb

[debug]Source directories searched: /storage/work/project/project_trunk /emulator/proj.cb:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> directory /storage/work/project/
[debug]Source directories searched: /storage/work/project/project_trunk /emulator/proj.cb:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> source ../../../project/project/config/device/config.gdb
[debug]>>>>>>cb_gdb:
[debug]> target remote tcp:10.1.1.50:1234
[debug]Remote debugging using tcp:10.1.1.50:1234
[debug]Reading symbols from /home/buildmaster/kernel/project/trunk/nfsroot/lib/ld-uClibc.so.0...(no debugging symbols found)...done.
[debug]Loaded symbols for /home/buildmaster/kernel/project/trunk/nfsroot/lib/ld-uClibc.so.0
[debug]0x77fe0eb0 in _start () from /home/buildmaster/kernel/project/trunk/nfsroot/lib/ld-uClibc.so.0
[debug]>>>>>>cb_gdb:

Connected

[debug]> continue

Reading symbols from /home/buildmaster/kernel/project/trunk/nfsroot/lib/ld-uClibc.so.0...(no debugging symbols found)...done.
In _start () (/home/buildmaster/kernel/project/trunk/nfsroot/lib/ld-uClibc.so.0)

[debug]> continue
[debug]Continuing.
[debug][New Thread 2448]
[debug]Child pid is 0, so we will terminate GDB directly
[debug]Cannot execute this command while the target is running.
[debug]Use the "interrupt" command to stop the target
[debug]and then try again.

Debugger finished with status 0

gdbserver hasn't exited on our remote target and the gdbserver socket is stuck in CLOSE_WAIT status.

Code: [Select]
# netstat -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 device.project.local:1234 mulcon.project.local:60406 CLOSE_WAIT

This worked fine with codeblocks version 10.05 with the same version of gdb, on the same OS and target. The connect with extended remote checkbox (in 13.12) is not selected.

With 10.05, when we click Debug->Stop debugger the remote executable is interrupted; when we click Debug->Stop debugger again, both the remote executable and gdbserver exits and there is no socket left in CLOSE_WAIT.

Can anyone help us solve this problem in 13.12?

Thanks.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Remote debugging issue in 13.12?
« Reply #1 on: January 15, 2015, 09:51:31 am »
Can you try to see if this still works, by running gdb in command line.
If it works from the command line, then can you paste the log from this command line session and the full debugger log from codeblocks?
(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 cab_team

  • Single posting newcomer
  • *
  • Posts: 6
Re: Remote debugging issue in 13.12?
« Reply #2 on: January 15, 2015, 10:43:37 am »
Hi oBFusCATed, thanks for your reply.

Yes, it works from the command line. Here is a transcript of when running gdb from the command line, with the same command line parameters codeblocks is using.

Code: [Select]
$ /usr/local/bin/mipsel-linux-uclibc-gdb -nx -fullname -quiet -args /storage/work/project/project_trunk/stb/derived.debug/run_device.sh
"/storage/work/project/project_trunk/stb/derived.debug/run_device.sh": not in executable format: File format not recognised
(gdb) set sysroot ~/kernel/project/trunk/nfsroot
(gdb) file ../../stb/derived.debug/app_.elf
Reading symbols from ../../stb/derived.debug/app_.elf...done.
(gdb) target remote 10.1.1.50:1234
Remote debugging using 10.1.1.50:1234
Reading symbols from /home/buildmaster/kernel/project/trunk/nfsroot/lib/ld-uClibc.so.0...(no debugging symbols found)...done.
Loaded symbols for /home/buildmaster/kernel/project/trunk/nfsroot/lib/ld-uClibc.so.0
0x77fe0eb0 in _start ()
   from /home/buildmaster/kernel/project/trunk/nfsroot/lib/ld-uClibc.so.0
(gdb) c
Continuing.
[New Thread 695]
^Cwarning: GDB can't find the start of the function at 0x76b5b084.

    GDB is unable to find the start of the function at 0x76b5b084
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
    This problem is most likely caused by an invalid program counter or
stack pointer.
    However, if you think GDB should simply search farther back
from 0x76b5b084 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.

Program received signal SIGINT, Interrupt.
warning: GDB can't find the start of the function at 0x76b5b084.
0x76b5b084 in ?? ()
   from /home/buildmaster/kernel/project/trunk/nfsroot/lib/libc.so.0
(gdb) quit
A debugging session is active.

    Inferior 1 [process 560] will be killed.

Quit anyway? (y or n) y

We provided a debugger log in the previous post, is this is not a "full" debugger log in codeblocks? Is there a way of getting more information?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Remote debugging issue in 13.12?
« Reply #3 on: January 15, 2015, 11:14:35 am »
Hm, are you using the remote debug UI to setup the remote debugging option or are you using some manual method?
(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 cab_team

  • Single posting newcomer
  • *
  • Posts: 6
Re: Remote debugging issue in 13.12?
« Reply #4 on: January 15, 2015, 11:28:17 am »
Yes, we are using the remote debug UI. We've entered the ip address and port number into the "Remote Connection" tab in both versions of Codeblocks (13.12 and 10.05). Our connection type is TCP.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Remote debugging issue in 13.12?
« Reply #5 on: January 24, 2015, 02:19:06 pm »
Sorry for the late reply.

Can you try to reproduce this problem when running remote debugging with native targets?
I have no hardware that can be used to reproduce the problem, so there is no way I can try to fix it.
But if you can reproduce it with native targets then I can probably reproduce it, too.

(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 DejaVu

  • Single posting newcomer
  • *
  • Posts: 4
Re: Remote debugging issue in 13.12?
« Reply #6 on: March 05, 2015, 12:46:08 am »
I can confirm this bug (and many more). Whole debugging at Code::Blocks 13.xx suck hard. Issues:
1) IDE adds several times the same breakpoint (it's not checking if breakpoint already exists)
2) Removing double breakpoint removes only one instance. There's no information in IDE that breakpoint is set and IDE still breaks at invisisible breakpoint.
3) Quite often debugging feature hangs when I want to press "continue debugging". It just doesn't respond.
4) The same issue occurs when I would like to stop debugging. I can click button 1k times and still it doesn't respond to any action.

Remote debugging works fine at GDB, so issue is strictly related with Code::Blocks. I didn't have these issues at Code::Blocks 10.xx. Currently I'm searching other IDE for linux, because it seems that Code::Blocks quality lower than I expected. Debugging for IDE is primary feature. If it's not working then IDE doesn't exists. Secondary feature is Intellisense, but Code::Blocks can't deal with loading all symbols for chromium engine (it just closes while loading all files into project). Chromium engine with third party have ~1GB of source files. Third feature is File Searching. It's slow as hell and it's much better to use grep instead fighting with Code::Blocks slow search. Grep is searching phrases 1000x times faster than Code::Blocks.

PS. If you see any reason to split mentioned issues into several bugs/topics please do it. I have just created an account to confirm issues with remote debugging. If I won't find alternative then maybe I will spend few days to fix remote debugging at Code::Blocks, but currently amount of other issues suggests that other IDE should be picked even if license won't be for free.

I must add that few years ago I was thinking that Code::Blocks will catch up Visual Studio but it seems that performance of each tool in C::B is horrible and software stability is quite low (unacceptable IDE for professional development).

"Can anyone help us solve this problem in 13.12?":
1. make code review of whole remote debugging
2. make diff what has changed with debugging between 10.xx and 13.xx
/edit: 3. blame files related with remote debugging and check what was changed and analyze if changes have sense.

ca. 2 months have passed already since this topic was created and IDE still is unstable.
« Last Edit: March 05, 2015, 12:59:16 am by DejaVu »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Remote debugging issue in 13.12?
« Reply #7 on: March 05, 2015, 01:28:41 am »
ca. 2 months have passed already since this topic was created and IDE still is unstable.
2 months have passed and no one (including you) has posted the exact steps needed to reproduce the problem.
I don't do remote debugging at all (and I have no embedded devices I can test with) so I don't test this feature of Code::Blocks.

Post the steps and I'll try to fix it. If I can't reproduce it I can't do much about it. Sorry.
Same for the other 4 points related to debugging - post exact steps and sample projects and I'll try to do something about it.

p.s. debugging with 10.xx was a disaster and I don't understand why people continue to think it was any good!
p.p.s. cb won't be able to be as good as vstudio, for the simple reason that no one is working on it as a full time job. vstudio team is comprised of tens or even hundreds of people.

(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: 9496
Re: Remote debugging issue in 13.12?
« Reply #8 on: March 05, 2015, 05:34:52 am »
I think it should be possible to try remote debugging with a local loopback adapter. This means, start gdb server and connect to it using 127.0.0.1. This should use the same code portions as if you would connect to a remote device.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Remote debugging issue in 13.12?
« Reply #9 on: March 05, 2015, 09:18:15 am »
Morten: I know, this is the reason why I asked if the problem can be reproduced with a native target.
(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 TedK

  • Single posting newcomer
  • *
  • Posts: 3
Re: Remote debugging issue in 13.12?
« Reply #10 on: May 15, 2015, 07:27:57 pm »
I am not sure my problem is related to this issue.
I am using Code::Blocks on Kubuntu. I have it installed on all 4 PCs (both 32-and 64-bit), they have Ubuntu 14.10 and 15.04. When I try to debug a C++ application that uses STL containers the debugger often hangs when I try to step through a line of code after the program has stopped at a breakpoint. When it does not hang it steps very slowly. This issue makes Code::Blocks unusable for debugging.  The behavior of the integrated debugger is the same on all 4 computers. I also recently installed Raspbian 12.x on an ARM board (Cubieboard4) and installed Code:Blocks 10 on it. When I try to debug C++ programs with STL contailers, the debugger also steps through lines painfully slow and sometimes hangs.
Debugging the same program with GDB from a command line works fine. I also migrated the same project to Eclipse CDT, and and had no problems debugging the application from the Eclipse IDE. I have downloaded the latest sources (May 10, 2015) and have built Code::Blocks from them. but this did not help. The problem seems to be in the debugger plugin.
Because of this issue I will have to stop developing in Code::Blocks and switch to Eclipse. I am sure many programmers and comanies will have to do the same.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11932
    • Travis build status
Re: Remote debugging issue in 13.12?
« Reply #11 on: May 17, 2015, 02:20:51 am »
I am not sure my problem is related to this issue.
It is not.

You have two known problems, that cannot be fixed with the current code unfortunately.
New debugger plugin is in the works, but progress is slow.
(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!]