I am attempting to make my debugging tool better for C++. I currently have a script that runs with the following flags: -Wall -Wextra -O2 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
. When I run my code with these flags, one of the errors I sometimes receive is that I attempted to a subscript container with an out-of-bounds index. While this is very useful, if my code is long, I am not sure which line and/or container this refers to. Is there any way to make this more specific (like how Java IDE tells the specific line and object that caused the error).
The following is an example:
Error: attempt to subscript container with out-of-bounds index 8, but
container only holds 8 elements.
Objects involved in the operation:
sequence "this" @ 0x0061FE40 {
type = std::__debug::vector<int, std::allocator<int> >;
}