find position of a list term in gdb

I'm wondering if it is possible, within a debugging session, to tell gdb to go over all the terms of an std::vector and print out the indexes of those that satisfy a certain condition. In my case I have vector, and I would like to know which of the terms are negative. I am well aware that this can be accomplished using conditional breakpoints, but for that I would have to rerun the program and place the breakpoint in the position where the vector is initialized, but it's less convenient.

Answers


There is no way of doing what you are asking for with plain gdb. The debugger does not have a language in which you can run arbitrary queries. That being said, the debugger does have support (at least not ancient versions) to load python scripts that will interact with data.

You can define scripts in the gdb command line, or else you can define them in files and load them from the command line.


Need Your Help

How to JOIN these 3 tables

php mysql sql join mysqli

I have the following JOIN query already done:

An automated way to load multiple images into PowerPoint on different pages?

ms-office powerpoint

I need to load about 60 images, each on a different page, in to PowerPoint.