Author Topic: No cursor in debugger  (Read 8792 times)

Offline Jerome

  • Single posting newcomer
  • *
  • Posts: 9
No cursor in debugger
« on: June 21, 2012, 09:33:21 pm »
I'm not sure if this is a bug or a configuration issue.

I am doing CUDA programming in C++ on Debian. I need to use a make file, to invoke the nvcc compiler wrapper. That all works fine. When I debug, there is no little yellow triangular cursor inside the source member, and the source editor does not page down when the execution point goes off the bottom of the screen. The debugger correctly displays the source file and line number in text, and it sets break points correctly when I click on them inside the source code, and stops at them.  It would appear that C::B is supposed to parse the debugger text and display a cursor, and that is not working. It seems possible that it does not recognize the file name as referring to the source file being edited, but that is hard to reconcile with the fact that it correctly sets break points when a line is clicked in that file.

Additional info; CUDA make puts all executables in a common directory which is not under the project directory. I got the debugger to work by setting the Output filename under the Build Targets options. Since make is generating the executables, this was not needed to get Build to work, but it appears to be used to set the Debug target. 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: No cursor in debugger
« Reply #1 on: June 21, 2012, 10:46:24 pm »
C::B and GDB versions please?
Does GDB work from the command line?
Does it work with simple c/c++ project?
Where is the full log from the debugger (see the settings for details)?
(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 Jerome

  • Single posting newcomer
  • *
  • Posts: 9
Re: No cursor in debugger
« Reply #2 on: June 22, 2012, 01:30:46 am »
C::B version 10.05, 
GDB version 7.0.1
The cursor is there in a Hello World project.

Here is the debugger messages;

Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: /home/jerome/NV_SDK/C/src/VA/
Adding source dir: /home/jerome/NV_SDK/C/src/VA/
Changing directory to: /home/jerome/NV_SDK/C/bin/linux/debug
Adding file: ../../bin/linux/debug/VA
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.0.1-debian
At /home/jerome/NV_SDK/C/src/VA/VA.cu:91
Continuing...
At /home/jerome/NV_SDK/C/src/VA/VA.cu:103
At /home/jerome/NV_SDK/C/src/VA/VA.cu:104
Child process PID: 9107
At /home/jerome/NV_SDK/C/src/VA/VA.cu:105
At /home/jerome/NV_SDK/C/src/VA/VA.cu:110
At /home/jerome/NV_SDK/C/src/VA/VA.cu:111
At /home/jerome/NV_SDK/C/src/VA/VA.cu:112
Continuing...
Program exited with code 0377.
Debugger finished with status 0

I set a breakpoint, started the program, it hit the break. I set another BP, continued. it hit that. I single-stepped off the bottom of the page (at line 109). At no point was there a cursor, and the editor window did not move.

Here is the debugger log

LD_LIBRARY_PATH=.:
Command-line: /usr/bin/gdb -nx -fullname  -quiet -args ../../bin/linux/debug/VA
Working dir : /home/jerome/NV_SDK/C/src/VA/
Reading symbols from /home/jerome/NV_SDK/C/bin/linux/debug/VA...
done.
(gdb)
> set prompt >>>>>>cb_gdb:
Executing: xterm -T 'Program Console' -e sleep 83452
>>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 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".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set disassembly-flavor intel
>>>>>>cb_gdb:
> catch throw
Function "__cxa_throw" not defined.
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> source /usr/share/codeblocks/scripts/stl-views-1.0.3.gdb
Executing: ps x -o tty,pid,command
>>>>>>cb_gdb:
> cd /home/jerome/NV_SDK/C/bin/linux/debug
>>>>>>cb_gdb:
> directory /home/jerome/NV_SDK/C/src/VA/
>>>>>>cb_gdb:
> break "/home/jerome/NV_SDK/C/src/VA/VA.cu:91"
PS result: ?         9103 ps x -o tty,pid,command
PS result: pts/1     9100 sleep 83452
TTY is[/dev/pts/1]
GetConsoleTTY[/dev/pts/1]ConsolePid[9098]
Queued:[tty /dev/pts/1]
Breakpoint 2 at 0x4014df: file VA.cu, line 91.
>>>>>>cb_gdb:
> tty /dev/pts/1
>>>>>>cb_gdb:
> run
[Thread debugging using libthread_db enabled]
Breakpoint 2, main (argc=1, argv=0x7fffffffe8e8) at VA.cu:91
/home/jerome/NV_SDK/C/src/VA/VA.cu:91:2490:beg:0x4014df
>>>>>>cb_gdb:
> break "/home/jerome/NV_SDK/C/src/VA/VA.cu:103"
Breakpoint 3 at 0x401514: file VA.cu, line 103.
>>>>>>cb_gdb:
> cont
Breakpoint 3, main (argc=1, argv=0x7fffffffe8e8) at VA.cu:103
/home/jerome/NV_SDK/C/src/VA/VA.cu:103:2818:beg:0x401514
>>>>>>cb_gdb:
> next
/home/jerome/NV_SDK/C/src/VA/VA.cu:104:2848:beg:0x401520
>>>>>>cb_gdb:
> next
[New Thread 0x7ffff5dd9700 (LWP 9107)]
/home/jerome/NV_SDK/C/src/VA/VA.cu:105:2898:beg:0x40153d
>>>>>>cb_gdb:
> next
/home/jerome/NV_SDK/C/src/VA/VA.cu:110:3013:beg:0x40155a
>>>>>>cb_gdb:
> next
/home/jerome/NV_SDK/C/src/VA/VA.cu:111:3045:beg:0x40156d
>>>>>>cb_gdb:
> next
/home/jerome/NV_SDK/C/src/VA/VA.cu:112:3083:beg:0x40157e
>>>>>>cb_gdb:
> cont
[Thread 0x7ffff5dd9700 (LWP 9107) exited]
Program exited with code 0377.
>>>>>>cb_gdb:
> quit


The program crashed, but that is what I was debugging. I know what's causing that.

I don't normally use dbg from the command line, so I am not sure if it works. But since it isn't supposed to display a cursor from the command line, that's kind of moot, isn't it? dbg actually seems to work just fine from within C::B. It's C::B that isn't working. But if you want to give me a string of commands to enter at the command line, I'll be happy to do it.

Thanks for your time!

  Jerome

Offline Jerome

  • Single posting newcomer
  • *
  • Posts: 9
Re: No cursor in debugger
« Reply #3 on: June 22, 2012, 01:42:32 am »
By the way, if you like, I will try to debug this myself. Just point me at the source for this feature. I am relatively new to Linux, but I'm here to learn. I am thinking I might try to add extensions to support the CUDA debugger, which is basically just gdb with some additional functions to handle the GPU.

   Jerome

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: No cursor in debugger
« Reply #4 on: June 22, 2012, 08:32:33 am »
Please use tags next time.
Code
> next
/home/jerome/NV_SDK/C/src/VA/VA.cu:110:3013:beg:0x40155a
>>>>>>cb_gdb:

Code
At /home/jerome/NV_SDK/C/src/VA/VA.cu:110
From the above message, I see that the debugger plugin works fine, and it parse the message from gdb correctly, and "cursor" should goto the file "VA.cu" and line "110".

About the source code, they are under:
cb_trunk\src\plugins\debuggergdb\gdb_driver.cpp

Code
void GDB_driver::ParseOutput(const wxString& output)
{
    m_Cursor.changed = false;

   ........
   ........
        if (m_Cursor.changed || m_forceUpdate)
            NotifyCursorChanged();
    }

    if (m_ProgramIsStopped)
        RunQueue();
}

I believe that the NotifyCursorChanged();  call will actually change the cursor in the editor.
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: No cursor in debugger
« Reply #5 on: June 22, 2012, 09:12:44 am »
Jerome: Just try a recent nightly build and newer gdb.

p.s. please use code tags for log pastes.
(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 Jerome

  • Single posting newcomer
  • *
  • Posts: 9
Re: No cursor in debugger
« Reply #6 on: June 25, 2012, 02:59:44 am »
Sorry about the unformatted logs.

I updated the whole C::B package, but the problem persists. I have noticed another symptom. Clicking on a compiler error does not move the cursor into the file to edit. Again, it is as if it doesn't recognize that the source file is available. This also works fine in a vanilla Hello, World project.

 It occurs to me that the source file has .cu as the suffix, as that is what cuda's makefile is expecting. Is it possible that C::B is not recognizing the source file?  I added that suffix to source file masks, and it put the file in the Sources folder OK.

Offline Jerome

  • Single posting newcomer
  • *
  • Posts: 9
Re: No cursor in debugger
« Reply #7 on: June 25, 2012, 03:29:50 am »
I retract that. I thought I had updated everything, but in fact nothing got updated.

It appears that the various packages available on the nightly builds repository are version 10.05svn8059-1. Attempting to upgrade with these puts Synaptic into a dependency tailspin. Something to do with libwxsmith. I will try reinstalling the latest version.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: No cursor in debugger
« Reply #8 on: June 25, 2012, 06:44:51 am »
I retract that. I thought I had updated everything, but in fact nothing got updated.

It appears that the various packages available on the nightly builds repository are version 10.05svn8059-1. Attempting to upgrade with these puts Synaptic into a dependency tailspin. Something to do with libwxsmith. I will try reinstalling the latest version.
Remove all C::B packages and then try to reinstall the nightly-version.

Offline Jerome

  • Single posting newcomer
  • *
  • Posts: 9
Re: No cursor in debugger
« Reply #9 on: June 25, 2012, 06:58:01 pm »
Yes sir.

I removed everything I could find, which was the following;
codeblocks-contrib-common
codeblocks-common
codeblocks-headers
wxsmith-headers
codeblocks-dev
wxsmith-dev
libwxsmithlib0
codeblocks-contrib
codeblocks
libcodeblocks0

I then added apt.jens.lody.de/stable squeeze main to my software sources. In Synaptic Package Manager, I tried marking codeblocks for installation. I received an error message listing the following dependency issues;

<samp>  codeblocks:
 Depends: libcodeblocks0 but it is not going to be installed
  Depends: libwxbase2.8-0 (>=2.8.12.1) but 2.8.10.1-3+b1 is to be installed
  Depends: libwxgtk2.8-0 (>=2.8.12.1) but 2.8.10.1-3+b1 is to be installed
</samp>

Let me know if I am going about this wrong.

  Jerome

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: No cursor in debugger
« Reply #10 on: June 25, 2012, 09:52:39 pm »
Please read carefully the instructions on my site, according the wxWidgets installation, you need a more recent version;

Quote from: http://apt.jenslody.de/
The packages are build against wxWidgets 2.8.12.
If you do not use debian-unstable or testing it is necessary to upgrade your wxWidgets installation.
The wxWidgets packages shipped with debian stable are too old.


Please put the following lines to your sources.list too:

Code
deb http://apt.wxwidgets.org/ squeeze-wx main

key-import to apt's trusted keys:

Code
wget -q http://apt.wxwidgets.org/key.asc -O-  | sudo apt-key add -


Offline Jerome

  • Single posting newcomer
  • *
  • Posts: 9
Re: No cursor in debugger
« Reply #11 on: June 26, 2012, 02:35:54 am »
Thanks, that fixed installation problems, and the new installation fixed the debugger problem.

I did get an error message during installation. It does not seem to have caused any problems with the features I am using, but FYI, here it is;
 E: /var/cache/apt/archives/codeblocks-wxcontrib-headers_10.05svn8059-1_all.deb: trying to overwrite '/usr/include/codeblocks/wxContribItems/wxthings/include/wx/things/thingdef.h', which is also in package codeblocks-headers 10.05svn8059-1

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: No cursor in debugger
« Reply #12 on: June 26, 2012, 06:25:43 am »
Thanks, that fixed installation problems, and the new installation fixed the debugger problem.

I did get an error message during installation. It does not seem to have caused any problems with the features I am using, but FYI, here it is;
 E: /var/cache/apt/archives/codeblocks-wxcontrib-headers_10.05svn8059-1_all.deb: trying to overwrite '/usr/include/codeblocks/wxContribItems/wxthings/include/wx/things/thingdef.h', which is also in package codeblocks-headers 10.05svn8059-1

Seems to be a packaging error, I will look into it.
Thanks for reporting!