Author Topic: CB on Win XP: issues  (Read 10567 times)

Offline harrykar

  • Multiple posting newcomer
  • *
  • Posts: 20
CB on Win XP: issues
« on: June 30, 2014, 07:32:57 pm »
I am new here so greetings to all you  :)

Yesterday i download Code::Blocks 13.12 rev9501 from sourceforge was a zip(good i hate exe  ;) ). Till now i used Geany. I had some headaches (i discover C:B not debug single files that are not part of a project --and C:B seems not be alone here are other IDEs having that behaviour--)with CB resolved with some googling

Now i am faced with that problem:
I did a -test- project(simple console app) in a directory on desktop (C:\Documents and Setings\owner.... ) i tried to debug but debugger not stop on breakpoints and also goto cursor not worked; worked only step by step debug; after some googling (tnx to  http://stackoverflow.com/questions/12106948/cant-use-breakpoints-in-codeblocks-even-when-debug-settings-are-correct-linu) i deduce the problem probably was the spaces in "Documents and Settings" directory(the only one in my case that have spaces in his name); obviously i can't rename system's directory "Documents and Settings" so i worked around  moving project's directory in C:\project; spaces gone away and all automagically all worked as intended

Anyway that's a silly way to do. Someone know how that spaces can be masquerated trough C:B? exist another workaround out there to solve better?

NOTICE that the problem arises only in debugging not in building and running (operations did ever inside C:B)

Thanks in advance

PS: mingw installed ( gdb:7.6.1 ,gcc:4.8.1)
« Last Edit: July 01, 2014, 01:34:59 pm by harrykar »
--"Arguing with an engineer is like wrestling with a pig in the mud; after a while you  realize you are muddy and the pig is enjoying it." <br />-- Don't Learn to HACK - Hack to LEARN <br />-- cyberwarfare is now an active part of information warfare

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: CB on Win XP: issues
« Reply #1 on: June 30, 2014, 11:25:09 pm »
why do you need spaces? they make things complicated and are easy to avoid...

i think that c::b can handle it, but mingw and gdb not, and so c::b can't do anything about it.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: CB on Win XP: issues
« Reply #2 on: July 01, 2014, 06:28:23 am »
C::B features a work-around (probably well hidden):
Goto Settings -> Compiler -> your MinGW compiler -> Tab "Other settings" -> Button "Advanced options" -> In the new window, in tab "Others" enable "Use full path for source files (GDB work-around)" and probably also "Use 8.3 notation". The latter might not work if you have auto-generated files or alike. However it shouldn't be needed for that purpose (I don't recall exactly).
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 harrykar

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: CB on Win XP: issues
« Reply #3 on: July 01, 2014, 09:23:21 am »
why do you need spaces? they make things complicated and are easy to avoid...

I will not but MS sw engineers seems to like it  >:(

Quote
i think that c::b can handle it, but mingw and gdb not, and so c::b can't do anything about it.

Maybe you are right i did a search and here http://www.mingw.org/wiki/Getting_Started in the first lines is clearly reported :

MinGW Installation Notes

MinGW may have problems with paths containing spaces, and if not, usually other programs used with MinGW
will experience problems with such paths. Thus, we strongly recommend that you do not install MinGW in any
location with spaces in the path name reference. You should avoid installing into any directory or subdirectory
having names like "Program Files" or "My Documents", etc.


but wrapping the whole thing (file specification) inside double quotes i guess should work as we see from C:B build log window
Code
-------------- Build: Debug in test (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall -g -Wall -pg -g -std=c11 -pedantic  -c "C:\Documents and Settings\Owner\Επιφάνεια εργασίας\BOB\cources\tmp\test\main.c" -o obj\Debug\main.o


NOTICE that the problem arises only in debugging not in building and running (ever inside C:B)
i.e. the compiler  seems unaffected but the debugger seems sensible why that asymmetric behavior?  

tnx for your reply


« Last Edit: July 01, 2014, 01:36:30 pm by harrykar »
--"Arguing with an engineer is like wrestling with a pig in the mud; after a while you  realize you are muddy and the pig is enjoying it." <br />-- Don't Learn to HACK - Hack to LEARN <br />-- cyberwarfare is now an active part of information warfare

Offline harrykar

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: CB on Win XP: issues
« Reply #4 on: July 01, 2014, 10:04:19 am »

C::B features a work-around (probably well hidden):
Goto Settings -> Compiler -> your MinGW compiler -> Tab "Other settings" -> Button "Advanced options" -> In the new window, in tab "Others" enable "Use full path for source files (GDB work-around)"

I saw (C:B is full of settings and subtleties lol) and was just ticked(enabled) by default.



Quote
and probably also "Use 8.3 notation". The latter might not work if you have auto-generated files or alike. However it shouldn't be needed for that purpose (I don't recall exactly).

that was unticked by default and as last resource i enable it but the output in C:B's debugger window is ever the same(bad  :( ):

Code
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Documents and Settings\Owner\Επιφάνεια εργασίας\BOB\cources\tmp\test\
Adding source dir: C:\Documents and Settings\Owner\Επιφάνεια εργασίας\BOB\cources\tmp\test\
Adding file: C:\Documents and Settings\Owner\Επιφάνεια εργασίας\BOB\cources\tmp\test\bin\Debug\test.exe
Changing directory to: C:/DOCUME~1/Owner/6808~1/BOB/cources/tmp/test/.
Set variable: PATH=.;c:\MinGW\bin;c:\MinGW;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;c:\MinGW\libexec\gcc\mingw32\4.8.1;C:\Program Files\Geany\bin
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/DOCUME~1/Owner/6808~1/BOB/cources/tmp/test/bin/Debug/test.exe
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.6.1
Child process PID: 2236
[Inferior 1 (process 2236) exited normally]
Debugger finished with status 0

So now what?

PS: i copy/paste the same command we see above in CB's debugger window:
Code
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/DOCUME~1/Owner/6808~1/BOB/cources/tmp/test/bin/Debug/test.exe
done

in cmd.com (without any change) and in msys (here  only i  change "\" to "/" in the first part i.e.the path of gdb) and either worked well

output of msys:
Code
Owner@giannis-b791577 ~
$ C:/MinGW/bin/gdb.exe -nx -fullname  -quiet  -args C:/DOCUME~1/Owner/6808~1/BO
B/cources/tmp/test/bin/Debug/test.exe
Reading symbols from C:\DOCUME~1\Owner\6808~1\BOB\cources\tmp\test\bin\Debug\tes
t.exe...done.
(gdb) quit

Owner@giannis-b791577 ~
$

So i deduce if C:B use Msys's  convention C:B have to change   "\" --> "/" in the path of  gdb in the command above before start gdb or
wrap the command into " " i.e. "C:\MinGW\bin\gdb.exe" in either case work well.
Lets see

a)
Code
Owner@giannis-b791577 ~
$ C:\MinGW\bin\gdb.exe
sh: C:MinGWbingdb.exe: command not found
not work

b)  (see also output of msys above)
Code
Owner@giannis-b791577 ~
$ "C:\MinGW\bin\gdb.exe"
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 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 "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) quit

Owner@giannis-b791577 ~
$
work as intended

I am wondering how cmd.com can handle flawlessly either combinations (with or without " " and with "/" or "\") :(

Tnx very much for your reply
« Last Edit: July 01, 2014, 09:57:58 pm by harrykar »
--"Arguing with an engineer is like wrestling with a pig in the mud; after a while you  realize you are muddy and the pig is enjoying it." <br />-- Don't Learn to HACK - Hack to LEARN <br />-- cyberwarfare is now an active part of information warfare

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: CB on Win XP: issues
« Reply #5 on: July 01, 2014, 06:52:59 pm »
I guess unchecking the workaround (full-path)-option might work, because the part of the path with the spaces might be hidden (if all files are in a subdirectory of "Documents and settings").
Newer gdb's should probably work correctly with relative paths.

Offline harrykar

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: CB on Win XP: issues
« Reply #6 on: July 01, 2014, 10:00:04 pm »
I guess unchecking the workaround (full-path)-option might work, because the part of the path with the spaces might be hidden (if all files are in a subdirectory of "Documents and settings").

Lets give it a try ... and ...Ladys and Gents :) ... nope no way to work :(

Quote
Newer gdb's should probably work correctly with relative paths.
I guess the problem arises ancestrally. Why introduce spaces in Os's objects if you MS know that nixes don't ?     

Anyway thanks jens
« Last Edit: July 02, 2014, 06:38:16 pm by harrykar »
--"Arguing with an engineer is like wrestling with a pig in the mud; after a while you  realize you are muddy and the pig is enjoying it." <br />-- Don't Learn to HACK - Hack to LEARN <br />-- cyberwarfare is now an active part of information warfare