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.
This commit is contained in:
Mike Frysinger
2015-06-15 19:17:16 +05:45
parent 920467912a
commit 6362a3f875
9 changed files with 784 additions and 675 deletions

View File

@@ -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. */