From 6362a3f8757bfce133b724df2077573433823ad4 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 15 Jun 2015 19:17:16 +0545 Subject: 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. --- include/gdb/ChangeLog | 7 +++++++ include/gdb/callback.h | 9 +++++++++ 2 files changed, 16 insertions(+) (limited to 'include/gdb') diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index d36d6b8f247..24fe00f9193 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,10 @@ +2015-06-17 Mike Frysinger + + * callback.h (CB_TARGET_DEFS_MAP): Add name member. + (cb_host_str_syscall, cb_host_str_errno, cb_host_str_signal, + cb_target_str_syscall, cb_target_str_errno, cb_target_str_signal): + Declare. + 2015-03-28 James Bowman * sim-ft32.h: New file. diff --git a/include/gdb/callback.h b/include/gdb/callback.h index 4628b7eb2aa..80299f13d06 100644 --- a/include/gdb/callback.h +++ b/include/gdb/callback.h @@ -59,6 +59,7 @@ name of the symbol. */ typedef struct { + const char *name; int host_val; int target_val; } CB_TARGET_DEFS_MAP; @@ -316,6 +317,14 @@ int cb_target_to_host_signal (host_callback *, int); /* Translate host signal number to target. */ int cb_host_to_gdb_signal (host_callback *, int); +/* Translate symbols into human readable strings. */ +const char *cb_host_str_syscall (host_callback *, int); +const char *cb_host_str_errno (host_callback *, int); +const char *cb_host_str_signal (host_callback *, int); +const char *cb_target_str_syscall (host_callback *, int); +const char *cb_target_str_errno (host_callback *, int); +const char *cb_target_str_signal (host_callback *, int); + /* Translate host stat struct to target. If stat struct ptr is NULL, just compute target stat struct size. Result is size of target stat struct or 0 if error. */ -- cgit v1.2.1