Brahim
Brahim

Reputation: 838

gdb pretty printer stops working if I rerun my program

If I use the command run inside gdb to rerun my program I can no longer pretty print my c++ objects like vectors:

$ gdb ./some_program
(gdb) br some_where
(gdb) run
(gdb) print some_vector # the vector is pretty printed
(gdb) run
(gdb) print some_vector # the vector is no longer pretty printed

Here's a sample code I used and its actual gdb session:

#include <vector>
#include <iostream>                                                                                                                                                                                                                       using namespace std;
int main()
{
    vector<int> v{1};
    cout << v[0] << endl;
}

enter image description here

Upvotes: 1

Views: 142

Answers (1)

ks1322
ks1322

Reputation: 35845

This is most likely this libstdc++ pretty printers bug.

You can apply this patch to you currently installed pretty printers or update whole gcc to a more recent version.

Upvotes: 1

Related Questions