Re: STL vector debugging
Re: STL vector debugging
- Subject: Re: STL vector debugging
- From: Chris Jefferson <email@hidden>
- Date: Tue, 7 Feb 2006 10:54:56 +0000
Not perfect at al, but a couple of suggestions.
for a vector v:
"print v._M_impl._M_finish - v._M_impl._M_start" gives length of vector.
"print *(v._M_impl._M_start+n)" gives the nth element of the vector.
On 2/6/06, Robb Olsen-Albright <email@hidden> wrote:
> Greetings list,
>
> The Mac team where I work (well, it's me and one other developer) is
> working on converting our fairly large cross-platform Codewarrior project to
> Xcode (isn't everybody :) )
>
> My question is regarding debugging code that uses STL vectors.
>
> As an example, if I create a new c++ tool and create a vector of some POD
> type and fill it in, such as:
>
> int main (int argc, char * const argv[]) {
> std::vector<unsigned long> ulVector;
> ulVector.push_back(1);
> ulVector.push_back(2);
> ulVector.push_back(3);
> ulVector.push_back(4);
> ulVector.push_back(5);
> }
>
>
> ... and put a breakpoint somewhere after adding a value (like line 4), I may
> be interested in seeing some info about the vector (such as number of items,
> etc).
>
> Well, in the current version of Xcode (2.2.1), I don't see any usable info
> in the debugger window for ulVector. In addition, drilling down into the
> contents of the variable, I don't see any members that provide useful info
> either.
>
> I'm pretty sure that in some previous version of Xcode, I at least saw a
> size:{x} in the summary column. Codewarrior kinda sucked with their
> implementation of debugging views for stl, but it was getting better, and I
> could at least see a size member if I drilled down far enough. And now that
> VS.Net 2005 has improved debugging for STL, I'm getting some grief from my
> Windows counterparts too :)
>
> Now, we have created data formatters (CustomDataView) for wide strings, so
> we can certainly roll our own and get something useful ourselves, but what's
> confusing me is the presence of the Vector.plist in /Library/Application
> Support/Apple/Developer Tools/CustomDataViews. It has entries for various
> flavours of vectors (including specifically 'unsigned long' which is why I
> used the example above), along with a formatting string that just includes
> %1%, %2%, etc., which are just referring to 'child paths' by number;
> however, nothing shows up in the summary column at all.
>
> So, anybody know how to get the Vectors.plist file to do anything, or have
> any other info about debugging STL containers in Xcode 2.2.1?
>
> thanks,
>
> robb olsen-albright
> email@hidden
> vernier software & technology
> portland, or
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden