https://github.com/cyrus-and/gdb-dashboard
GDB dashboard is a useful python utility for programmers to show valuable information while debugging with gdb. It uses the gdb python interface of gdb and implements several modules in different categories to show debug information:
All the modules are enabled by default.
##Features
Clone the GutHub repo and copy the file in your home directory:
$ git clone https://github.com/cyrus-and/gdb-dashboard
$ cp gdb-dashboard/.gdbinit ~/
##Usage
GDB dashboard is loaded when gdb is invoked, thanks to the ~/.gdbinit file. The dashboard can be shown whenever the program stops. By default it is turned off. Use the following command within gdb to change the behaviour:
>>> dashboard -enabled [on|off]
To show the dashboard:
>>> dashboard
To change the layout, e.g., show only assembly, expressions and registers and disable source, run:
>>> dashboard -layout assembly expressions registers !source
As you can understand, it’s very simple to extend this framework. For more information, hit the project page.
#include <iostream>
#include <vector>
using namespace std;
typedef enum {Tree, Bug} Species;
typedef enum {Big_tree, Acorn, Seedling} Tree_forms;
typedef enum {Caterpillar, Cocoon, Butterfly}
Bug_forms;
struct thing {
Species it;
union {
Tree_forms tree;
Bug_forms bug;
} form;
};
struct a {
int aa;
int bb;
};
void test (){
std::cout << "test" << std::endl;
}
int main()
{
vector<int> ivector(10);
int ar[2][2] = {0};
struct thing foo = {Tree, {Acorn}};
struct a aa = {100,22};
test();
for (int i = 0; i < ivector.size(); i++) {
ivector[i] = i;
}
for (int i = 0; i < ivector.size(); i++) {
cout << ivector[i] << " ";
}
cout << endl;
return 0;
}
gdb ./test
source ~/.gdb-dashboard
b main
r