aboutsummaryrefslogtreecommitdiff
path: root/sim/common/gentmap.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-15 19:17:16 +0545
committerMike Frysinger <vapier@gentoo.org>2015-06-17 13:19:51 -0400
commit6362a3f8757bfce133b724df2077573433823ad4 (patch)
tree681f10063e77d5ed43b862eb7be12d4c860e790e /sim/common/gentmap.c
parent920467912a594a3e5af1d779487ffe3e5c550aef (diff)
downloadgdb-6362a3f8757bfce133b724df2077573433823ad4.zip
gdb-6362a3f8757bfce133b724df2077573433823ad4.tar.gz
gdb-6362a3f8757bfce133b724df2077573433823ad4.tar.bz2
sim: callback: add human readable strings for debugging to maps
When tracing, we often want to display the human readable name for the various syscall/errno values. Rather than make each target duplicate the lookup, extend the existing maps to include the string directly, and add helper functions to look up the constants. While most targets are autogenerated (from libgloss), the bfin/cris targets have custom maps for the Linux ABI which need to be updated by hand.
Diffstat (limited to 'sim/common/gentmap.c')
-rw-r--r--sim/common/gentmap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sim/common/gentmap.c b/sim/common/gentmap.c
index fbc09a2..669a7e5 100644
--- a/sim/common/gentmap.c
+++ b/sim/common/gentmap.c
@@ -80,10 +80,11 @@ gen_targ_map_c (void)
for (t = &sys_tdefs[0]; t->symbol; ++t)
{
printf ("#ifdef CB_%s\n", t->symbol);
- printf (" { CB_%s, TARGET_%s },\n", t->symbol, t->symbol);
+ /* Skip the "SYS_" prefix for the name. */
+ printf (" { \"%s\", CB_%s, TARGET_%s },\n", t->symbol + 4, t->symbol, t->symbol);
printf ("#endif\n");
}
- printf (" { -1, -1 }\n");
+ printf (" { 0, -1, -1 }\n");
printf ("};\n\n");
printf ("/* errno mapping table */\n");
@@ -91,10 +92,10 @@ gen_targ_map_c (void)
for (t = &errno_tdefs[0]; t->symbol; ++t)
{
printf ("#ifdef %s\n", t->symbol);
- printf (" { %s, TARGET_%s },\n", t->symbol, t->symbol);
+ printf (" { \"%s\", %s, TARGET_%s },\n", t->symbol, t->symbol, t->symbol);
printf ("#endif\n");
}
- printf (" { 0, 0 }\n");
+ printf (" { 0, 0, 0 }\n");
printf ("};\n\n");
printf ("/* open flags mapping table */\n");
@@ -102,10 +103,10 @@ gen_targ_map_c (void)
for (t = &open_tdefs[0]; t->symbol; ++t)
{
printf ("#ifdef %s\n", t->symbol);
- printf (" { %s, TARGET_%s },\n", t->symbol, t->symbol);
+ printf (" { \"%s\", %s, TARGET_%s },\n", t->symbol, t->symbol, t->symbol);
printf ("#endif\n");
}
- printf (" { -1, -1 }\n");
+ printf (" { 0, -1, -1 }\n");
printf ("};\n\n");
}