User forums > Using Code::Blocks

structure has no component named c_str

(1/2) > >>

raynebc:
I ran into some strange debugger behavior when tracing through my program, when I added an element of an array of structures to the watches, it displayed "structure has no component named c_str" instead of a list of member variables and their values.  I can't tell why this is, when I added an element of a different array of different structures (with similar members) it displayed that structure's contents normally.  Is this a problem with GDB?  With Code::Blocks?  With my programming?

If it makes any difference, the layout of the structure is as follows:

--- Code: ---struct bf_string
{
unsigned long long keyid;
unsigned long offset;
char *string;
char encountered;
};
--- End code ---

Thanks in advance.

oBFusCATed:
Can you post a minimal sample that can be used to reproduce the problem?
Do you have watch scripts enabled in the debugger's settings?
What version of CB are you using?

raynebc:
I'm afraid I didn't put together a minimal sample, since I couldn't even get it to behave the same for both structure types.  I reproduced this behavior on both the 9-16-14 and 1-17-15 nightly C::B releases.  "Enable watch script" was enabled, but when I disable it and debug my program again, the watches display correctly, so I guess it's a problem with that feature?  The tooltip mentions not to use it with a Python-enabled GDB, but I don't know how to tell if I have such a version of GDB installed.  GDB's help output gives the following:
GNU gdb (GDB) 7.5
...
This GDB was configured as "i686-pc-mingw32".

This GDB version is kind of old, but I'd rather not risk breaking something that's otherwise working just fine if I can avoid it.

oBFusCATed:
Search for gdb python pretty printers.

raynebc:
Is this a problem with MinGW's GDB instead of Code::Blocks then?  I honestly don't know why it would have problems displaying standard data types in a structure.  I also don't know what data type it was having problems with, so I wouldn't know where to begin as far as writing my own printer.  I know this GDB can print long long integer values because it displayed the other structure without problem.  In the end, I'm not customizing GDB in any way so I probably don't lose anything by turning off this feature.  Thank you for the tip.

Navigation

[0] Message Index

[#] Next page

Go to full version