aboutsummaryrefslogtreecommitdiff
path: root/display_args.c
diff options
context:
space:
mode:
authorSteve Fink <sphink@gmail.com>2006-08-07 05:53:19 +0200
committerIan Wienand <ianw@debian.org>2006-08-07 05:53:19 +0200
commit6a3e24dc1709530e59dd6ae3e91ced1c221fe1b9 (patch)
tree349681978d6dcc285b054f1359561e9716193b0c /display_args.c
parentb2c254573fbf30189293be6b7f2ef307c499704c (diff)
downloadltrace-6a3e24dc1709530e59dd6ae3e91ced1c221fe1b9.tar.gz
implement enumerated parameters
Diffstat (limited to 'display_args.c')
-rw-r--r--display_args.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/display_args.c b/display_args.c
index 66a9093..2a6b34f 100644
--- a/display_args.c
+++ b/display_args.c
@@ -42,6 +42,18 @@ static int display_pointer(enum tof type, struct process *proc, long value,
return display_value(type, proc, pointed_to, inner);
}
+static int display_enum(enum tof type, struct process *proc,
+ arg_type_info* info, long value)
+{
+ int ii;
+ for (ii = 0; ii < info->u.enum_info.entries; ++ii) {
+ if (info->u.enum_info.values[ii] == value)
+ return fprintf(output, "%s", info->u.enum_info.keys[ii]);
+ }
+
+ return display_unknown(type, proc, value);
+}
+
/* Args:
type - syscall or shared library function or memory
proc - information about the traced process
@@ -94,6 +106,8 @@ int display_value(enum tof type, struct process *proc,
return display_string(type, proc, (void*) value,
get_length(type, proc,
info->u.string_n_info.size_spec));
+ case ARGTYPE_ENUM:
+ return display_enum(type, proc, info, value);
case ARGTYPE_POINTER:
return display_pointer(type, proc, value, info);
case ARGTYPE_UNKNOWN: