User forums > Using Code::Blocks

see content of a vector in debugging

<< < (14/26) > >>

killerbot:
how can I check if somethings is wrong in the first setup steps ??

cacb:

--- Quote from: ollydbg on June 14, 2009, 10:31:47 am ---If this file loaded correctly, you can type "pvector", then here is the log output.


--- Code: ---> pvector
Prints std::vector<T> information.
Syntax: pvector <vector> <idx1> <idx2>
Note: idx, idx1 and idx2 must be in acceptable range [0..<vector>.size()-1].
Examples:
pvector v - Prints vector content, size, capacity and T typedef
pvector v 0 - Prints element[idx] from vector
pvector v 1 2 - Prints elements in range [idx1..idx2] from vector
>>>>>>cb_gdb:
--- End code ---

--- End quote ---

Hi, I am trying to learn debugging in Code::Blocks by reading this. I have also read a GDB tutorial.

Are you supposed to type in those commands in the "Debugger" tab? I have a sample program running in debug mode and stopped at a breakpoint (defined by clicking in the margin). But under "Watches" and "Local variables" it just says "No locals", which is obviously not the case. And the Debugger window (the Debugger tab in the Messages area) will not allow me to type in anything at all. So I am "blind".

What am I missing? The debugger is running, but I don't seem to be able to examine any variables at all, even simple integers. The debugger reports "Registering new type: wxString" and the same for STL String and Vector, so it appear sto be working.

There must be something simple I have not figured out.... but what?

oBFusCATed:

--- Quote from: killerbot on June 14, 2009, 12:01:45 pm ---how can I check if somethings is wrong in the first setup steps ??

--- End quote ---
The source command does not emit errors :(
Issuing the pvector command is the only way to debug it :(
I've lost 15 minutes myself debugging a typing error in the command.


--- Quote from: ollydbg on June 14, 2009, 05:25:33 am ---I have a problem "Squirrel function call failed". As in the debuger (debug) panel, I can see the returned string from gdb. see the screen shot:

--- End quote ---
What version of CB do you use? With tostring or with wxString_ToLong binding?
Open the script console, to see the script errors (view -> script console)

ollydbg:

--- Quote from: oBFusCATed on June 14, 2009, 10:19:40 pm ---What version of CB do you use? With tostring or with wxString_ToLong binding?
Open the script console, to see the script errors (view -> script console)

--- End quote ---
Firstly, Thanks for your reply!

I use the SVN 5645 CB and applied your patches(two patches, the debug command and STL vector).

I'm sorry, I'm not sure what's the difference between tostring or wxString_ToLong binding :(.

In my mind, I can only understand the wiki page of debug_script.
http://wiki.codeblocks.org/index.php?title=Debugger_scripts
Like the image



There are several steps:
1, send a command to GDB to query the variable type by  "whatis v"
2, GDB return the type = XXXXXXX
3, if the type string matches some Evaluate_XXX function, then the correct script will be called by squirrel to GDB for more details
4, the corresponding  Parse_XXXX function will be called to give the correct value the "watches panel"

So, what does the binding used for? :D

Here is my squirrel log output:

--- Code: ---Welcome to the script console!

AN ERROR HAS OCCURED [the index 'tointeger' does not exist]

CALLSTACK
*FUNCTION [Parse_StlVector()] F:\cb_svn\src\output\share\codeblocks\scripts\gdb_types.script line [158]

LOCALS
[size_value] INSTANCE
[capacity_pos] 16
[vector_info_str] INSTANCE
[size_pos] 0
[start] 0
[a_str] INSTANCE
[this] TABLE

--- End code ---

Seems I should use "tostring"? How can I do? Thanks.


 

oBFusCATed:
Uf, I've swap tointeger with tostring again :(

The updated version of the gdb_types.script uses tointeger, but the function that should be called is wxString_ToLong (Morten likes that name more and modified my bindings patch)


--- Code: ---AN ERROR HAS OCCURED [the index 'tointeger' does not exist]

CALLSTACK
*FUNCTION [Parse_StlVector()] F:\cb_svn\src\output\share\codeblocks\scripts\gdb_types.script line [158]

--- End code ---

So on line 158, replace tointeger with wxString_ToLong and it will work

@killerbot, tonight I'll test "set debug on" or something like that for the source command

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version