[gdb] Add debug_{exp,val}

When debugging cc1 I heavily rely on simple one-parameter debug functions
that allow me to inspect a variable of a common type, like:
- debug_generic_expr
- debug_gimple_stmt
- debug_rtx
and I miss similar functions in gdb.

Add functions to dump variables of types 'value' and 'expression':
- debug_exp, and
- debug_val.

Tested on x86_64-linux, by breaking on varobj_create, and doing:
...
(gdb) call debug_exp (var->root->exp.get ())
&"Operation: OP_VAR_VALUE\n"
&" Block symbol:\n"
&"  Symbol: aaa\n"
&"  Block: 0x2d064f0\n"
(gdb)
...
and:
...
(gdb) call debug_val (value)
&"5"
(gdb)
...
This commit is contained in:
Tom de Vries
2022-08-05 08:09:57 +02:00
parent 701821154b
commit 731d2cc1d5
3 changed files with 31 additions and 0 deletions

View File

@@ -191,6 +191,12 @@
#define ATTRIBUTE_UNUSED_RESULT
#endif
#if (GCC_VERSION > 4000)
#define ATTRIBUTE_USED __attribute__ ((__used__))
#else
#define ATTRIBUTE_USED
#endif
#include "libiberty.h"
#include "pathmax.h"
#include "gdb/signals.h"