aboutsummaryrefslogtreecommitdiff
path: root/display_args.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-01-03 17:03:39 +0100
committerPetr Machata <pmachata@redhat.com>2012-08-29 19:02:05 +0200
commit000e31195ad4ad30a0c80c93ab57a424e7d8d918 (patch)
tree5cbadf5497d1ef87725561d74b4e193f2ec8ef48 /display_args.c
parenta0a6a54a41d828c9a018829033443b0faabefb2f (diff)
downloadltrace-000e31195ad4ad30a0c80c93ab57a424e7d8d918.tar.gz
Add type.c/.h, value.c/.h, value_dict.c/.h
- none of this is plugged in yet - expr.c/.h is not in yet, so we still express array length with len_spec integer. Some function are mocked out so the thing compiles
Diffstat (limited to 'display_args.c')
-rw-r--r--display_args.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/display_args.c b/display_args.c
index 5df34ca..872b1c9 100644
--- a/display_args.c
+++ b/display_args.c
@@ -6,13 +6,14 @@
#include "common.h"
#include "proc.h"
+#include "type.h"
static int display_char(int what);
static int display_string(enum tof type, Process *proc,
void* addr, size_t maxlen);
static int display_value(enum tof type, Process *proc,
- long value, arg_type_info *info,
- void *st, arg_type_info* st_info);
+ long value, struct arg_type_info *info,
+ void *st, struct arg_type_info *st_info);
static int display_unknown(enum tof type, Process *proc, long value);
static int display_format(enum tof type, Process *proc, int arg_num);
@@ -21,15 +22,16 @@ static size_t array_maxlength = INT_MAX;
static long
get_length(enum tof type, Process *proc, int len_spec,
- void *st, arg_type_info* st_info) {
+ void *st, struct arg_type_info *st_info)
+{
long len;
- arg_type_info info;
+ struct arg_type_info info;
if (len_spec > 0)
return len_spec;
if (type == LT_TOF_STRUCT) {
- umovelong (proc, st + st_info->u.struct_info.offset[-len_spec-1],
- &len, st_info->u.struct_info.fields[-len_spec-1]);
+ umovelong(proc, st + st_info->u.struct_info.offset[-len_spec-1],
+ &len, st_info->u.struct_info.fields[-len_spec-1]);
return len;
}
@@ -39,9 +41,9 @@ get_length(enum tof type, Process *proc, int len_spec,
static int
display_ptrto(enum tof type, Process *proc, long item,
- arg_type_info * info,
- void *st, arg_type_info* st_info) {
- arg_type_info temp;
+ struct arg_type_info * info,
+ void *st, struct arg_type_info *st_info) {
+ struct arg_type_info temp;
temp.type = ARGTYPE_POINTER;
temp.u.ptr_info.info = info;
return display_value(type, proc, item, &temp, st, st_info);
@@ -57,8 +59,8 @@ display_ptrto(enum tof type, Process *proc, long item,
*/
static int
display_arrayptr(enum tof type, Process *proc,
- void *addr, arg_type_info * info,
- void *st, arg_type_info* st_info) {
+ void *addr, struct arg_type_info * info,
+ void *st, struct arg_type_info *st_info) {
int len = 0;
size_t i;
size_t array_len;
@@ -70,7 +72,7 @@ display_arrayptr(enum tof type, Process *proc,
st, st_info);
len += fprintf(options.output, "[ ");
for (i = 0; i < options.arraylen && i < array_maxlength && i < array_len; i++) {
- arg_type_info *elt_type = info->u.array_info.elt_type;
+ struct arg_type_info *elt_type = info->u.array_info.elt_type;
size_t elt_size = info->u.array_info.elt_size;
if (i != 0)
len += fprintf(options.output, ", ");
@@ -91,9 +93,9 @@ display_arrayptr(enum tof type, Process *proc,
*/
static int
display_structptr(enum tof type, Process *proc,
- void *addr, arg_type_info * info) {
+ void *addr, struct arg_type_info * info) {
int i;
- arg_type_info *field;
+ struct arg_type_info *field;
int len = 0;
if (addr == NULL)
@@ -119,10 +121,10 @@ display_structptr(enum tof type, Process *proc,
static int
display_pointer(enum tof type, Process *proc, long value,
- arg_type_info * info,
- void *st, arg_type_info* st_info) {
+ struct arg_type_info * info,
+ void *st, struct arg_type_info *st_info) {
long pointed_to;
- arg_type_info *inner = info->u.ptr_info.info;
+ struct arg_type_info *inner = info->u.ptr_info.info;
if (inner->type == ARGTYPE_ARRAY) {
return display_arrayptr(type, proc, (void*) value, inner,
@@ -143,7 +145,7 @@ display_pointer(enum tof type, Process *proc, long value,
static int
display_enum(enum tof type, Process *proc,
- arg_type_info* info, long value) {
+ struct arg_type_info *info, long value) {
size_t ii;
for (ii = 0; ii < info->u.enum_info.entries; ++ii) {
if (info->u.enum_info.values[ii] == value)
@@ -166,8 +168,8 @@ display_enum(enum tof type, Process *proc,
*/
int
display_value(enum tof type, Process *proc,
- long value, arg_type_info *info,
- void *st, arg_type_info* st_info) {
+ long value, struct arg_type_info *info,
+ void *st, struct arg_type_info *st_info) {
int tmp;
switch (info->type) {
@@ -239,7 +241,9 @@ display_value(enum tof type, Process *proc,
}
int
-display_arg(enum tof type, Process *proc, int arg_num, arg_type_info * info) {
+display_arg(enum tof type, Process *proc, int arg_num,
+ struct arg_type_info * info)
+{
long arg;
if (info->type == ARGTYPE_VOID) {
@@ -330,7 +334,7 @@ display_format(enum tof type, Process *proc, int arg_num) {
unsigned char *str1;
int i;
size_t len = 0;
- arg_type_info info;
+ struct arg_type_info info;
info.type = ARGTYPE_POINTER;
addr = (void *)gimme_arg(type, proc, arg_num, &info);