User forums > Nightly builds
The 25 August 2012 build (8248) is out.
Folco:
Happy birthday !
Agetian:
Here's an interesting issue I ran into with the last couple SVN builds including the latest one: I'm using MinGW 4.7.1 with the stock GDB that comes with it (also v4.7.1). Whenever I try to debug a program that features std::string in it, if I watch a std::string object, the value is never shown correctly, and if I hover the mouse over it with the "show value" mode turned on (don't remember what this option is actually called), a SIGSEGV message will pop up. Amazingly enough this only seems to happen for strings, std::vector<int>, for instance, is shown just fine, as are all the built-in types, such as int or float. Is it something I'm doing wrong or is it something wrong with C::B? :\
oBFusCATed:
Agetian:
Have your string variables being initialized?
Do you have python enabled gdb or non-python gdb?
Have you installed any pretty printers?
Can you post the full log from the debugger? (you have to enabled full logging)
Agetian:
--- Quote from: oBFusCATed on August 26, 2012, 08:41:09 pm ---Agetian:
Have your string variables being initialized?
Do you have python enabled gdb or non-python gdb?
Have you installed any pretty printers?
Can you post the full log from the debugger? (you have to enabled full logging)
--- End quote ---
1) Yes, the string variables are initialized. This is easily tested even on a simple "std::string s = "Test";" line.
2) I believe it's a Python-enabled gdb (it references python27.dll), but I'm not sure how to tell you with bigger degree of certainty.
3) No, at least not that I'm aware of it - nothing out of the ordinary, just stock C::B SVN and stock MinGW/GDB, with whatever configuration they both came with. If you're interested, MinGW 4.7.1 came from this source: http://sourceforge.net/projects/mingwbuilds/
4) Sure thing, I think this is what you meant about full log, but if I'm wrong, please tell me where to obtain the correct thing:
--- Code: ---Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: D:\cppclasstest\
Adding source dir: D:\cppclasstest\
Adding file: D:\cppclasstest\bin\Debug\cppclasstest.exe
Changing directory to: D:/cppclasstest/.
[debug]PATH=.;D:\mingw-4.7.1\bin;D:\mingw-4.7.1;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Windows Live\Shared;D:\mingw-TDD-4.6.1\bin;C:\Program Files\Calibre2;C:\D\dmd\windows\bin;C:\D\dmd2\windows\bin;C:\D\dm\bin;C:\Program Files\TortoiseSVN\bin
[debug]Command-line: D:\mingw-4.7.1\bin\gdb.exe -nx -fullname -quiet -args D:/cppclasstest/bin/Debug/cppclasstest.exe
[debug]Working dir : D:\cppclasstest
Starting debugger: D:\mingw-4.7.1\bin\gdb.exe -nx -fullname -quiet -args D:/cppclasstest/bin/Debug/cppclasstest.exe
done
[debug]> set prompt >>>>>>cb_gdb:
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
[debug]Reading symbols from D:/cppclasstest/bin/Debug/cppclasstest.exe...
[debug]done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.4.1
[debug]Copyright (C) 2012 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 "i686-w64-mingw32".
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (GDB) 7.4.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 new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source D:\CB_Portable\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory D:/cppclasstest/
[debug]>>>>>>cb_gdb:
[debug]> break "D:/cppclasstest/main.cpp:15"
[debug]Breakpoint 2 at 0x401394: file D:\cppclasstest\main.cpp, line 15.
[debug]>>>>>>cb_gdb:
[debug]> run
Child process PID: 3968
[debug][New Thread 3968.0x16a4]
[debug]Breakpoint 2, main () at D:\cppclasstest\main.cpp:15
[debug]D:\cppclasstest\main.cpp:15:188:beg:0x401394
[debug]>>>>>>cb_gdb:
At D:\cppclasstest\main.cpp:15
[debug]> bt 30
[debug]#0 main () at D:\cppclasstest\main.cpp:15
[debug]>>>>>>cb_gdb:
[debug]> next
[debug]D:\cppclasstest\main.cpp:17:214:beg:0x4013c3
[debug]>>>>>>cb_gdb:
At D:\cppclasstest\main.cpp:17
[debug]> bt 30
[debug]#0 main () at D:\cppclasstest\main.cpp:17
[debug]>>>>>>cb_gdb:
[debug]> whatis s
[debug]type = std::string
[debug]>>>>>>cb_gdb:
[debug]> output &s
[debug](std::string *) 0x22fef0>>>>>>cb_gdb:
[debug]> output s.c_str()[0]@s.size()
[debug]The program being debugged was signaled while in a function called from GDB.
[debug]GDB has restored the context to what it was before the call.
[debug]To change this behavior use "set unwindonsignal off".
[debug]Evaluation of the expression containing the function
[debug](std::string::size() const) will be abandoned.
[debug]Program received signal SIGSEGV, Segmentation fault.
[debug]0x00412f42 in std::string::size() const ()
[debug]>>>>>>cb_gdb:
Program received signal SIGSEGV, Segmentation fault.
In std::string::size() const () ()
[debug]> whatis s
[debug]type = std::string
[debug]>>>>>>cb_gdb:
[debug]> output s.c_str()[0]@s.size()
[debug]The program being debugged was signaled while in a function called from GDB.
[debug]GDB has restored the context to what it was before the call.
[debug]To change this behavior use "set unwindonsignal off".
[debug]Evaluation of the expression containing the function
[debug](std::string::size() const) will be abandoned.
[debug]Program received signal SIGSEGV, Segmentation fault.
[debug]0x00412f42 in std::string::size() const ()
[debug]>>>>>>cb_gdb:
[debug]> bt 30
Program received signal SIGSEGV, Segmentation fault.
[debug]> bt 30
[debug]#0 main () at D:\cppclasstest\main.cpp:17
[debug]>>>>>>cb_gdb:#0 main () at D:\cppclasstest\main.cpp:17
[debug]>>>>>>cb_gdb:
--- End code ---
This was done with a breakpoint set on a line that said:
std::string s = "Test";
I used the "Next line (F7)" command to go over this line to ensure that "s" was initialized, and then hovered the mouse over s to get its value, upon which it segfaulted.
oBFusCATed:
Putting a breakpoint on the initialization line is not a good idea.
Can you try to put a breakpoint only on the next line?
Also can you disable the watch scripts and post the log again?
Another thing to try is to execute the commands: "p s.size()" and "p s.c_str()" in the debug log window.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version