Author Topic: Debugger cannot open files  (Read 24874 times)

Offline carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Debugger cannot open files
« on: November 19, 2009, 02:00:49 pm »
Hi,

When I use the debugger in codeblocks, and I want to open the functions of the stack, I get something like this:

Cannot open file: C:\prog\src\common\event.cpp
Cannot open file: C:\prog\src\common\event.cpp
Cannot open file: C:\prog\src\msw\frame.cpp
Cannot open file: C:\prog\src\msw\window.cpp

Is there something wrong with my debugger settings?

Thanks...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Debugger cannot open files
« Reply #1 on: November 19, 2009, 02:21:27 pm »
Is there something wrong with my debugger settings?
Probably not. But definitely something is wrong with your posting.
What platform, OS, what C::B version, what compiler (version), what debugger (version), please?
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 carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugger cannot open files
« Reply #2 on: November 19, 2009, 02:31:58 pm »
Sorry.
Here is more info:

Windows XP
CodeBlocks Nightly Build 5911 (the latest one)
Mingw GDB debugger 6.3.2

Offline carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugger cannot open files
« Reply #3 on: November 19, 2009, 03:31:12 pm »
So if I want to open the location (doubleclick on the entry on the stack), it wants to open the cpp files at the wrong directery.
It searches in my project directory: c:\prog, in stead of the directory of the wxwidgets cpp files.

How can I change this?
I already tried to add the wxWidgets directory to "Additional Debugger Search Dirs". But doesn't help.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger cannot open files
« Reply #4 on: November 19, 2009, 03:55:09 pm »
Please update to gdb 6.8 or 7.0+ 6.3 is quite old!!!!!
(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 carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugger cannot open files
« Reply #5 on: November 19, 2009, 04:25:34 pm »
Please update to gdb 6.8 or 7.0+ 6.3 is quite old!!!!!

Still the same problem.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger cannot open files
« Reply #6 on: November 19, 2009, 04:51:37 pm »
It seems you want to step into the wxwidget library(debug version). My question is: How do you build your wxWidget library?
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 carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugger cannot open files
« Reply #7 on: November 19, 2009, 05:11:36 pm »
It seems you want to step into the wxwidget library(debug version). My question is: How do you build your wxWidget library?

Something likes this:
mingw32-make.exe -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1
and
mingw32-make.exe -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1

I have used them, and they work. Don't have any compiler errors either, but my program crashes.
So, I want to debug. But I get the error that they can't find the files. (debugger searches in the wrong directory)


Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger cannot open files
« Reply #8 on: November 19, 2009, 05:23:15 pm »
Some months ago, I used the wxPack, then I can't debug into the wxWidget's source code.

See my post:
how to debug into wxwidget source code?
report the Debugger problem about the tracking into wxWidgets source

I guess this is a issue about the path problem.
You should use the "absolute path" to build your project.

Check this option: settings->compiler and debugger settings-> advanced compiler options -> use full path for source files




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 carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugger cannot open files
« Reply #9 on: November 20, 2009, 09:57:39 am »
Some months ago, I used the wxPack, then I can't debug into the wxWidget's source code.

See my post:
how to debug into wxwidget source code?
report the Debugger problem about the tracking into wxWidgets source

I guess this is a issue about the path problem.
You should use the "absolute path" to build your project.

Check this option: settings->compiler and debugger settings-> advanced compiler options -> use full path for source files

Good to see I'm not alone with this problem.
So the only solution this far is to have your project in the samples directory of wxWidgets.


Or are you saying that with using an absolute path, it can be solved too?
I can find: settings->compiler and debugger...
But then I can't find the "advanced compiler options"; and neither "use full path for source files".











Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger cannot open files
« Reply #10 on: November 20, 2009, 02:31:44 pm »

Or are you saying that with using an absolute path, it can be solved too?

But then I can't find the "advanced compiler options"; and neither "use full path for source files".


Yes, the problem was solved.
The "advanced compiler options" is a button in the right bottom.
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Debugger cannot open files
« Reply #11 on: November 20, 2009, 02:44:54 pm »
The "advanced compiler options" is a button in the right bottom.

To be more precisely it's called "Advanced options" and you can find it at: "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings" ( the rightmost tab).

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger cannot open files
« Reply #12 on: November 20, 2009, 03:03:43 pm »
Ok, it's here. see the image.
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 carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugger cannot open files
« Reply #13 on: November 20, 2009, 03:27:50 pm »
After clicking "Advanced Options...".
Is it the last checkbox (see my attachment)?
It was already checked.  :?

[attachment deleted by admin]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger cannot open files
« Reply #14 on: November 20, 2009, 04:57:33 pm »
After clicking "Advanced Options...".
Is it the last checkbox (see my attachment)?
It was already checked.  :?

yes, you are right.

In my system(Windows XP), I can debug into the wxWdigets source.

Note: I'm not sure how you build wx Debug library. When building the library, you also need to use the "full path" option.
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Debugger cannot open files
« Reply #15 on: November 20, 2009, 08:07:40 pm »
I just tested it on vista with a wizard-created standard-project, no special settings, and debugging into wxWidgets works fine.

Self build (of course) C::B from trunk (r5923).

wxWidgets 2.8.10 build the same way as yours.
All build with TDM's gcc 4.4.1-2, debugger is gdb 7.02.

The project is in "c:\new\tmp\testtt", wxWidgets is below "c:\wxwidgets-2.8.10", that's also the base path of the global variable "wx", all other fields of the settings for "wx" are left empty.

Offline carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugger cannot open files
« Reply #16 on: November 30, 2009, 03:23:47 pm »
Still haven't found a solution to my problem.
I make use of wxwidgets 2.9.0 and last nightly build of codeblocks.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger cannot open files
« Reply #17 on: November 30, 2009, 03:50:03 pm »
Still haven't found a solution to my problem.
I make use of wxwidgets 2.9.0 and last nightly build of codeblocks.

Both jens and me have no problem debug into the wx source code. So I still suggest you can use wxWidgets 2.8.10.(because I havn't tried 2.9.0).

The last suspect is : did you have some space between the folder names? such as your wxWidgets library path is :

C:\XXXXX  XXXXX\

This may cause some problems in my opinion GDB can't debug into a source file with space in full path names. :D
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 carrejans

  • Single posting newcomer
  • *
  • Posts: 9
Re: Debugger cannot open files
« Reply #18 on: November 30, 2009, 05:01:28 pm »
Still haven't found a solution to my problem.
I make use of wxwidgets 2.9.0 and last nightly build of codeblocks.

Both jens and me have no problem debug into the wx source code. So I still suggest you can use wxWidgets 2.8.10.(because I havn't tried 2.9.0).

The last suspect is : did you have some space between the folder names? such as your wxWidgets library path is :

C:\XXXXX  XXXXX\

This may cause some problems in my opinion GDB can't debug into a source file with space in full path names. :D

No, no spaces in path.

I use some things from 2.9, that don't exist in 2.8.10.  :?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Debugger cannot open files
« Reply #19 on: November 30, 2009, 09:54:42 pm »
After reading this thread again, I can confirm this problems.
I can debug into wWidgets, that means set a breakpoint in my code and then step into wxWidgets code.

Jumping into wxWidgets sources from the callstack does indeed not work.
The problem is, that wxWidgets is not compiled with full, but with relative paths, so C:::B does not know where to look for ../src/xxx.cpp.