Add a standard container (std::vector) to the C++ example program to
demonstrate the debugger's capability to inspect and traverse STL
containers during a debugging session. This requires enabling GDB's
pretty-printing feature, which depends on Python scripts shipped with
the compiler.
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
#include <iostream>
#include <unistd.h>
#include <string>
+#include <vector>
int main(int argc, char* argv[])
{
}
} while (endless_mode);
+ // Example: Demonstrate std::vector traversal for debugger inspection
+ std::vector<int> numbers = {1, 2, 3};
+ std::cout << "Traversing std::vector<int> numbers:" << std::endl;
+ for (size_t i = 0; i < numbers.size(); ++i) {
+ std::cout << "numbers[" << i << "] = " << numbers[i] << std::endl;
+ }
+
return 0;
}