Code::Blocks Forums

User forums => Help => Topic started by: hd on December 21, 2004, 02:23:02 pm

Title: debugging trouble
Post by: hd on December 21, 2004, 02:23:02 pm
Hi,

I can't debug in CodeBlocks. But after compiling the program I can
debug it from command line.

Session listings are as following:
(Could it be directory separators? '\\' versus '/')

--
Regards,
Hakki Dogusan


//
// gdb running at CodeBlocks
//

Compiling: done
Selecting target: debug
Starting debugger: done
No source file named ..\\..\\TIS_App.cpp.
error
error
Program received signal (SIGSEGV)
Segmentation fault
0x006588e6wxBaseArrayPtrVoid::Index(void const*, bool) const at ../../src/common/dynarray.cpp:421
Debugger finished with status 0


//
// gdb running at command prompt
//

C:\a_C\tis\build\cb>gdb tisd.exe
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) break TIS_App::OnInit()
Breakpoint 1 at 0x5060a0: file ../../TIS_App.cpp, line 90.
(gdb) run
Starting program: C:\a_C\tis\build\cb/tisd.exe

Breakpoint 1, TIS_App::OnInit() (this=0x2d161b8) at ../../TIS_App.cpp:91
91              SetVendorName(_T("DynaSet"));
Current language:  auto; currently c++
(gdb) cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x006588e6 in wxBaseArrayPtrVoid::Index(void const*, bool) const (
    this=0x2d28620, lItem=0x2e01f28, bFromEnd=false)
    at ../../src/common/dynarray.cpp:421
421     _WX_DEFINE_BASEARRAY(const void *, wxBaseArrayPtrVoid)
(gdb) cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x006588e6 in wxBaseArrayPtrVoid::Index(void const*, bool) const (
    this=0x2d28620, lItem=0x2e01f28, bFromEnd=false)
    at ../../src/common/dynarray.cpp:421
421     _WX_DEFINE_BASEARRAY(const void *, wxBaseArrayPtrVoid)
(gdb) cont
Continuing.

Program exited with code 030000000005.
(gdb) q
Title: debugging trouble
Post by: hd on January 11, 2005, 12:18:18 pm
I changed void DebuggerGDB::SetBreakpoints() a little bit, now gdb can break..

...from
            if (bp->enabled)
               cmd << "break " << UnixFilename(pf->relativeFilename) << ":" << bp->line + 1;
...to
            if (bp->enabled)
            {
               // NOTE (hd#1#): cmd << "break " << UnixFilename(pf->relativeFilename) << ":" << bp->line + 1;
                    wxString out = UnixFilename(pf->relativeFilename);
                    ConvertToMakefileFriendly(out);
               cmd << "break " << out << ":" << bp->line + 1;
                }
Title: debugging trouble
Post by: mandrav on January 11, 2005, 12:42:13 pm
Thanks, I 'll test it under different conditions and update the sources accordingly :)

Yiannis.
Title: debugging trouble
Post by: Anonymous on January 11, 2005, 05:04:24 pm
Thanks Yiannis,

New problems... Sorry...

When gdb stops at break point, than "Next (F7)" or "StepIn (Shift-F7)" does not functioning;
they behave like "Continue".

I didn't look them in source yet...

--
Regards,
Hakki Dogusan
Title: debugging trouble
Post by: Anonymous on January 19, 2005, 08:39:24 am
And a similar question (to not spoil the master list :-) - can one debug the files, compiled by MSVC? Or only by MinGW?

Mike
Title: debugging trouble
Post by: Anonymous on February 17, 2005, 06:37:02 pm
"can one debug the files, compiled by MSVC?"

I can't :( , I've been looking for an answer to this question too, I'm currently compiling in Code::Blocks then, if something goes wrong, I have to compile with vc++ 6 to debug in it
Title: debugging trouble
Post by: mike on February 18, 2005, 09:07:26 am
As I understand, VCToolkit does not come with a debugger. And "gdb" cannot be used for executables compiled with MSVC (I haven't tried it, it's an assumption). So I have to compile in MinGW; if something goes wrong, I use the command-line debugging (thanx for the hint!), as the C::B debugging facility does not work yet.
Title: debugging trouble
Post by: prr on February 19, 2005, 03:07:22 am
Quote from: mike
As I understand, VCToolkit does not come with a debugger.


Free debugging tools for windows:
http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx

Quote from: mike
And "gdb" cannot be used for executables compiled with MSVC (I haven't tried it, it's an assumption). So I have to compile in MinGW; if something goes wrong, I use the command-line debugging (thanx for the hint!), as the C::B debugging facility does not work yet.


You can use the "Insight" (graphical frontend to gdb) included in cygwin.

walter
Title: debugging trouble
Post by: mike on February 19, 2005, 08:51:54 am
Quote
Free debugging tools for windows[/qoute]

Thanx, I'll try this later today!
Do you know if it is supported by C::B?
Title: debugging trouble
Post by: prr on February 19, 2005, 05:39:59 pm
Quote from: mike
Do you know if it is supported by C::B?


I don't know, but in the package is also included a complete graphical debugger. You can try to call it from codeblocks tools menu with "${PROJECT_DIR}\${PROJECT_NAME}.exe" parameter. Assuming ${PROJECT_NAME} = exe name.

It would be nice to have a ${PROJECT_EXE} macro in this menu.
But since a project could have one or more exe-type targets, it's not so simple to implement. Yiannis, have you ever considered a similar feature?

walter