Debugging STL collections

I have a question about debugging STL collections.  If I have an old-fashioned array of ints, I can view the entire array in the watch window.  I am wondering if there is any way to do that with an STL collections.  Take a look at this code:

{code}
	std::vector<int> myvec;
	int i;
	for (i=0; i < 10; i++) {
		myvec.insert(myvec.end(), i);
	}
	int j = myvec[3] ;

	int myarr[10];
	for (i=0; i < 10; i++) {
		myarr[i] = i;
	}
	int k = myvec[3] ;
{code}

In the debugger Watch window, I can check "Allow side effects and function calls", and I can look at the value of an individual member of the vector or the array using [] notation like this:
{code}
	myvec[7]
	myarr[7]
{code}

For the Array, I can just use this syntax and it will show me the entire contents of all of the entries of the array, but that does not work for the vector.  Is there any way to do that?  I am currently using C++ Builder XE, but will be upgrading to XE8 very soon.
{code}
	myvec
	myarr
{code}

Thanks in advance for your help
0
Mary
7/22/2015 7:22:17 PM
embarcadero.cppbuilder.ide 2180 articles. 1 followers. Follow

8 Replies
325 Views

Similar Articles

[PageSpeed] 54

Mary wrote:

> I have a question about debugging STL collections.  If I have an
> old-fashioned array of ints, I can view the entire array in the watch
> window.  I am wondering if there is any way to do that with an STL
> collections.

Yes, there is, however it is not trivial to implement.  You have to write 
a custom Debug Visualizer (or find a third-party implementation) for each 
individual STL collection that you are interested in viewing:

Debugger Visualizers
http://docwiki.embarcadero.com/RADStudio/XE/en/Debugger_Visualizers

The IDE ships with source code for several example visualizers in the "$(BDS)\source\Visualizers" 
folder.  There is an example visualizer provided that handles std::string 
and std::wstring.  Obviously, a std::vector visualizer would be more complex 
to implement, but doable.

-- 
Remy Lebeau (TeamB)
0
Remy
7/22/2015 7:48:10 PM
Remy,
Is there a white paper or a little more documentation on how to do it, beyond the sample code?  Or could you recommend a third party vendor that has created STL debug visualizers?
Thanks
Mary
0
Mary
7/22/2015 8:12:01 PM
Mary wrote:

> Is there a white paper or a little more documentation on how to
> do it, beyond the sample code?

Not that I know of.  However, there have been some prior forum discussions. 
 For instance, there is some information available here (the primary topic 
was about writing an AnsiString visualizer, but there is some vector-related 
info as well):

http://bcbjournal.com/forums/viewtopic.php?f=10&t=1074

> Or could you recommend a third party vendor that has created
> STL debug visualizers?

I am not aware of any.

-- 
Remy Lebeau (TeamB)
0
Remy
7/22/2015 9:02:25 PM
Hi Remy,

I took a look at the link you posted: 

http://bcbjournal.com/forums/viewtopic.php?f=10&t=1074

There is a reference to another post where you posted some sample code, but unfortunately it is a dead link:
https://forums.embarcadero.com/thread.jspa?messageID=278312&tstart=0

I don't suppose that source still exists somewhere?

Thanks!
Mary
0
Mary
7/23/2015 3:09:50 PM
<Mary McCartney> wrote in message news:728660@forums.embarcadero.com...
> Hi Remy,
>
> I took a look at the link you posted:
>
> http://bcbjournal.com/forums/viewtopic.php?f=10&t=1074
>
> There is a reference to another post where you posted some sample code, 
> but unfortunately it is a dead link:
> https://forums.embarcadero.com/thread.jspa?messageID=278312&tstart=0
>
> I don't suppose that source still exists somewhere?

Don't know about original, but might check this:
http://codenewsfast.com/cnf/article/1160497240/permalink.art-ng1882q4801

and in that is this reference:
http://mb.audacia-software.de/pfiles/MoreVisualizers.zip

And in the bcbjournal thread, You didn't read carefully/far enough...

Further down in that bcbjournal thread is code that is probably derived from 
the thread you can't reach - and below that code are Remy's comments on what 
else he did before he had it functioning correctly.

You might be able to also find the original on codenewsfast.com, but a 
little hard without enough known keywords...
0
david
7/23/2015 4:45:20 PM
Mary McCartney wrote:

> For the Array, I can just use this syntax and it will show me the
> entire contents of all of the entries of the array, but that does not
> work for the vector. Is there any way to do that?

SomeVec._Myfirst is pointer on data buffer. You can use

"*(SomeVec._Myfirst)" and appropriate "Repeat count" to see contents of
the buffer.

BTW, since C++11 SomeVec.data() also should work (i.e. in 64 bit
debugger).

> I can look at the value of an individual member of the vector or
> the array using [] notation

Good to know that this works: in CB2007 such watch usually hangs up IDE
after second evaluation. :(

I have my own IDE debugging expert for RAD2007 which allows to see
arrays as plots at breakpoint (I never tried it in later versions). I
can send its sources (in Pascal) if you have an interest. The only
"problems" that it uses
 1) standard db components (not available in Studio by default now) and
 2) some minor controls from (free) JCL/JCVL library.

--
Alex
0
Alex
7/24/2015 5:11:43 AM
> {quote:title=Alex Belo wrote:}{quote}

> I have my own IDE debugging expert for RAD2007 which allows to see
> arrays as plots at breakpoint (I never tried it in later versions). I
> can send its sources (in Pascal) if you have an interest. The only
> "problems" that it uses
>  1) standard db components (not available in Studio by default now) and
>  2) some minor controls from (free) JCL/JCVL library.
> 
> --
> Alex

Thanks for the offer Alex - that is very generous!  But I don't think it would help me.  I really needs C++ samples.
0
Mary
7/29/2015 1:05:50 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Mary wrote:
> 
> > Is there a white paper or a little more documentation on how to
> > do it, beyond the sample code?
> 
> Not that I know of.  However, there have been some prior forum discussions. 
>  For instance, there is some information available here (the primary topic 
> was about writing an AnsiString visualizer, but there is some vector-related 
> info as well):
> 
> http://bcbjournal.com/forums/viewtopic.php?f=10&t=1074
> 
> > Or could you recommend a third party vendor that has created
> > STL debug visualizers?
> 
> I am not aware of any.
> 
> -- 
> Remy Lebeau (TeamB)

Thanks Remy.  I am getting a little sidetracked at work and won't be able to work on this for a while, but I wanted to thank you for pointing me in the right direction.  You rock!
0
Mary
7/29/2015 1:15:14 PM
Reply:

Similar Artilces:

My visual studio IDE ,Is not showing a pop-up window like (With Debugging or without debugging) ?
 Hi,    My Issue is in Visual studio IDE,My VS IDE is not showing the pop-up window like  (With Debugging or without debugging) ,when i am clicking the F5 .Can anybody explain How to set options to show that popup window. THanksBenarji Hi, in the web.config look for the <compilation> element. Set the debug attribute to false: <compilation debug="false"> Now press F5 again. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

IDE stops the debugging
Hi,  When I am debugging, a break point is hit and suddenly IDE stops the debugging; but IE continues to work. I have tried , deleting the website and creating again, setting the user on machine.config, registering ‘diasymreader.dll’ etc. Still I am facing the same issue. Environment  IDE - 7.1.3088 Framework – 1.1.4322 SP1 Language – C#  Thanks in advance. Hamlin Stephen Hi,  I can provide you more information on above post. This happens only to a particular page. This page has a popup window.. The interesting thing is, the line is getting highlighted b...

ide maximizes on debug
Hi, Anyone knowing how to prevent the ide to blow up to full screen when starting a debugging session? I've been looking around in settings but seem not to be able to find it (RAD2007)... tk Hi totte totte karlsson wrote: > Hi, > Anyone knowing how to prevent the ide to blow up to full screen when starting a > debugging session? I've been looking around in settings but seem not to be able > to find it (RAD2007)... If it is any way like CB2009 there is a dropdownbox right to the menu line with two buttons to the right that is for managing the deskto...

Debugging STL contaners
Hi All, I'm using C++ Builder XE2. Does anyone knows how to get / display STL iterator data using the debugger? It worked fine on C++ Builder 5, though. Thanks in advance, Omer. Omer wrote: > I'm using C++ Builder XE2. > Does anyone knows how to get / display STL iterator data using the > debugger? > It worked fine on C++ Builder 5, though. BCB5 uses RogueWave, BCB6 uses STLPort, and later versions use Dinkumware. Different STL libraries implement iterators in different ways. Some use simple pointers, others use classes with overridden operators, eve...

Observing a collection while debugging...
 Is there any way to do this?  Whenever I mouse over a collection's name in the code while debugging, it says "In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user."For example, I use Java and NetBeans for school assignments.   With NetBeans, I have a Tree View of the collection in question without a "qualified property" or "explicitly supplied arguments". Any help would be appreciated.Daniel    Hi Daniel, I would like to know if your project i...

VS2003 IDE not debugging
I was unable to perform debugging using vs2003, I already set debugging asp.net to true in properties section, but still this won't work. I tried reinstalling vs yesterday it debugging works after.  But this morning the issue was back without any changes made before i shutdown my computer yesterday. I notice that after i press F5 to start my web app, debugging options such as pause or stop does not appear after the project was loaded to the explorer.  This allows me to press F5 again when I switch back to the source code. Can anyone help me with my issue to vs2003, I already...

CB2009 IDE freezes when debugging
I found that if I have local variable window open (as in the default), the IDE would freeze on certain cpp files when debugger breaks at one of the lines. Anyone else encountered the same problem? This is consistently reproducable in my project - same file, whichever line the breakpoint is doesn't change the outcome. Every time the breakpoint is hit, CB2009 hangs. Hello, I remember to have seen this in C++Builder 2006, but I did not yet encounter it in C++Builder 2009. Can you reduce your project to a freely redistributable set of code which reproduces the error? In my experien...

debugging Perl with the Eclipse IDE
I'm not sure if this is a Perl problem or an Eclipse problem, but I'm hoping someone here will know the solution. I'm trying to debug Perl under the Eclipse IDE. I recently reconfigured my network, which resulted in changing my local IP from 192.168.1.12 to 192.168.2.12. When I try to run the Perl debugger under Eclipse, I get the following error: Unable to connect to remote host: 192.168.1.12:5000 Compilation failed in require. at /home/ddjones/workspace/Temp/puzzle.pl line 0 main::BEGIN() called at /usr/lib/perl5/5.8.8/perl5db.pl line 0 eval {...} called at /...

Javascript Debugging in DotNet IDE ?
suppose i have written few javascript function in a file called test.aspx. i want to debug those function in DotNet IDE.please tell me all the steps that how to debug Javascript in DotNet IDE. Hi, Press F5 .. In VS.NET IDE click on Debug -> Windows -> Running Documents Select the page which contains javascript to be debug from that runnin documents. put the break point... hope it works out.. some better ways are there. i try to get back to you with appropriate steps. Arul ...

IDE Freezes in D2006 while debugging
I've noticed that if you are stepping thru code with F7/F8 and you press one of these keys too quickly in succession, the IDE will lockup. I have to kill it and start over. Is this fixed in 2009? -- Don Gollahon > {quote:title=Don Gollahon wrote:}{quote} > I've noticed that if you are stepping thru code with F7/F8 and you press one of these keys too quickly in succession, the IDE will lockup. I have to kill it and start over. > > Is this fixed in 2009? I can't reproduce it in 2007, so it must be OK in 2009. :-) Ken White wrote: >> {quo...

Debugging .SQL files from IDE
Hi, I use SQL server as the backend with Asp.net I have plenty of stored procedures , used in the project. To maintain the database stored procedures , i have created a seperate database project where i have added .SQl files for the stored procedures. The main Asp.net project is maintained as another project. Please explain a method where in i can debug the stored procedures with Asp.net pages. can i keep .SQL files within a Asp.net project which calls/uses them , especially when using Stored procedures? how to set break points in the .SQL file and debug them. I thi...

Protect IDE from the program being debugged
Hi! At least, please catch stack overflows in PBVM (infinite recursion etc.) In PB6 that caused GPFs, and PB8 just dies silently. Bye Oh, you mean like loop detection and stuff. Yes, that would be dandy. What would also be dandy is to not have the debugger automatically populate all the variable lists as it is running. IMHO, that's also where some GPFs come into play, as the debugger tries to display objects that are invalid. Gee, would it be too much to ask the DEBUGGER to trap these things and recover you back to a working IDE? Wouldn't it be nice if it coul...

How to remote debug using IDE ?
Hello all i have cpp app that is using the spidermonky engine scripting . the app initialize the spidermonky debug server that i can connect to and debug currently i can do it using old firefox browser and its web tool remote debugger . i like to use moderen IDE for debugger , what options do i have ? is there any plugin for Eclipse / Netbeans / other? Thanks Hi Meir, On 09/30/2015 08:28 AM, Meir Yanovich wrote: > Hello all > i have cpp app that is using the spidermonky engine scripting . > the app initialize the spidermonky debug server that i can connect to and d...

debug not working in vs2008 ide
for some reason setting breakpoints in the codebehind no longer stops for debugging.  It just suddenly started happening for no reason.  Has anyone else experienced this ?  Is there a fix ?   tia Mark. Just to make sure, you are not starting the application without debugging, right?Thanks,MaxLet Me Google That For You! im using the debug option (F5)   Ive deleted all the files in the bin folder and the temporary files in the .net folder for the app, but it makes no difference I cant debug anymore !  help.....  HI,Go to Vs 2008 command prompt and...

Web resources about - Debugging STL collections - embarcadero.cppbuilder.ide

Brogdale Farm - home of the National Fruit Collection - a great day out in Kent
Brogdale Farm, home of the National Fruit Collection Kent tourist attraction. A great day out for all the family with local produce, healthy ...

National Fruit Collection
The is one of the largest fruit collections in the world and includes over 3,500 named Apple, Pear, Plum, Cherry, Bush fruit, Vine and Cob Nut ...

Collection (museum) - Wikipedia, the free encyclopedia
A museum is distinguished by a collection of often unique objects that forms the core of its activities for exhibitions , education , research ...

Police search for owner of antique coin collection found in Laverton
Collectible valuables uncovered during search of car.

Meet the biodiesel scam artist with a $15M art collection
Filed under: Government/Legal , Green , Read This , Auctions , Biodiesel The $15-million collection of confiscated art from a biodiesel fraudster ...

Should we Expect Triple-A titles in the PS Plus Instant Game Collection in January 2016?
Bidness Etc asks whether January will be the month when we can see a free triple-A offering on the PS4 for PS Plus subscribers.

"The 2015 Black List, a collection of Hollywood's best unproduced screenplays, was announced Monday..." ...
" Bubbles , by Isaac Adamson, topped the list with 44 votes. It centers on a baby chimp that’s adopted by Michael Jackson." Narrating his own ...

Lender EZCORP Must Pay $10M In Refunds, Fines For Illegal In-Person Debt Collection Practices
A small-dollar lender has been slammed with a top-dollar penalty by federal regulators who say that the company’s debt collection practices violated ...

Biofuel Bandit’s $15 Million Art Collection About To Be Auctioned Off
Biofuel Bandit’s $15 Million Art Collection About To Be Auctioned Off

Alexandre Vauthier Launches Shoe Collection That Is #MADE-for-walking
“Darling, the legs aren't so beautiful, I just know what to do with them,” said Marlene Dietrich, the mesmerizing movie star of 1940s cinema. ...

Resources last updated: 12/23/2015 11:32:36 PM