[Ltrace-devel] r80 - in ltrace/trunk: . etc sysdeps/linux-gnu/alpha sysdeps/linux-gnu/arm sysdeps/linux-gnu/i386 sysdeps/linux-gnu/ia64 sysdeps/linux-gnu/m68k sysdeps/linux-gnu/mipsel sysdeps/linux-gnu/ppc sysdeps/linux-gnu/s390 sysdeps/linux-gnu/sparc sysdeps/linux-gnu/x86_64

cespedes at alioth.debian.org cespedes at alioth.debian.org
Tue Sep 4 15:34:53 UTC 2007


Author: cespedes
Date: 2007-09-04 15:34:53 +0000 (Tue, 04 Sep 2007)
New Revision: 80

Modified:
   ltrace/trunk/ChangeLog
   ltrace/trunk/README
   ltrace/trunk/breakpoints.c
   ltrace/trunk/debug.c
   ltrace/trunk/debug.h
   ltrace/trunk/display_args.c
   ltrace/trunk/elf.c
   ltrace/trunk/elf.h
   ltrace/trunk/etc/ltrace.conf
   ltrace/trunk/ltrace.c
   ltrace/trunk/ltrace.h
   ltrace/trunk/output.c
   ltrace/trunk/process_event.c
   ltrace/trunk/read_config_file.c
   ltrace/trunk/sysdeps/linux-gnu/alpha/trace.c
   ltrace/trunk/sysdeps/linux-gnu/arm/trace.c
   ltrace/trunk/sysdeps/linux-gnu/i386/trace.c
   ltrace/trunk/sysdeps/linux-gnu/ia64/trace.c
   ltrace/trunk/sysdeps/linux-gnu/m68k/trace.c
   ltrace/trunk/sysdeps/linux-gnu/mipsel/trace.c
   ltrace/trunk/sysdeps/linux-gnu/ppc/trace.c
   ltrace/trunk/sysdeps/linux-gnu/s390/trace.c
   ltrace/trunk/sysdeps/linux-gnu/sparc/trace.c
   ltrace/trunk/sysdeps/linux-gnu/x86_64/trace.c
   ltrace/trunk/wait_for_something.c
Log:
This reverts part of the last patch from Steve Fink, which added
arg_num to arg_type_info.  This seemed necessary because some
architectures need to know the type of the argument to gather in
addition to the argument number, but unfortunately it breaks many
other things.  Now I separate arg_num and arg_type_info, and add
both of them as arguments to gimme_arg().


Modified: ltrace/trunk/ChangeLog
===================================================================
--- ltrace/trunk/ChangeLog	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/ChangeLog	2007-09-04 15:34:53 UTC (rev 80)
@@ -1,3 +1,10 @@
+2007-09-04  Juan Cespedes  <cespedes at debian.org>
+
+	* ltrace.h: Take arg_num out of arg_type_info
+	* linux-gnu/*/trace.c: gimme_arg(): Add arg_num as argument
+	* ltrace.c: check for existence of $HOME before using it
+	* General: Small fixes (indentation)
+
 2007-08-31  Juan Cespedes  <cespedes at debian.org>
 
 	* General: Small fixes (indentation, typos, clean-up of code)
@@ -2,3 +9,3 @@
 	* ltrace.c: Close output file on exit
-	* ltrace.c: use getenf("HOME") instead of getpwuid(geteuid())->pw_dir
+	* ltrace.c: use getenv("HOME") instead of getpwuid(geteuid())->pw_dir
 	* read_config_file.c, display_args.c: remove "ignore" argtype;

Modified: ltrace/trunk/README
===================================================================
--- ltrace/trunk/README	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/README	2007-09-04 15:34:53 UTC (rev 80)
@@ -2,7 +2,7 @@
 
                        A Dynamic Library Tracer
 
-         Copyright 1997-2006 Juan Cespedes <cespedes at debian.org>
+         Copyright 1997-2007 Juan Cespedes <cespedes at debian.org>
 
 
 Contents
@@ -65,7 +65,7 @@
 
 6. License
 ----------
-    Copyright (C) 1997-2006 Juan Cespedes <cespedes at debian.org>
+    Copyright (C) 1997-2007 Juan Cespedes <cespedes at debian.org>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by

Modified: ltrace/trunk/breakpoints.c
===================================================================
--- ltrace/trunk/breakpoints.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/breakpoints.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -100,32 +100,32 @@
 					  proc);
 		}
 #ifdef __mips__
-                {
-                    // I'm sure there is a nicer way to do this. We need to
-                    // insert breakpoints _after_ the child has been started.
-                    struct library_symbol *sym;
-                    struct library_symbol *new_sym;
-                    sym=proc->list_of_symbols;
-                    while(sym){
-                        void *addr= sym2addr(proc,sym);
-                        if(!addr){
-                            sym=sym->next;
-                            continue;
-                        }
-                        if(dict_find_entry(proc->breakpoints,addr)){
-                            sym=sym->next;
-                            continue;
-                        }
-                        debug(2,"inserting bp %p %s",addr,sym->name);
-                        new_sym=malloc(sizeof(*new_sym));
-                        memcpy(new_sym,sym,sizeof(*new_sym));
-                        new_sym->next=proc->list_of_symbols;
-                        proc->list_of_symbols=new_sym;
-                        new_sym->brkpnt=0;
-                        insert_breakpoint(proc, addr, new_sym);
-                        sym=sym->next;
-                    }
-                }
+		{
+			// I'm sure there is a nicer way to do this. We need to
+			// insert breakpoints _after_ the child has been started.
+			struct library_symbol *sym;
+			struct library_symbol *new_sym;
+			sym=proc->list_of_symbols;
+			while(sym){
+				void *addr= sym2addr(proc,sym);
+				if(!addr){
+					sym=sym->next;
+					continue;
+				}
+				if(dict_find_entry(proc->breakpoints,addr)){
+					sym=sym->next;
+					continue;
+				}
+				debug(2,"inserting bp %p %s",addr,sym->name);
+				new_sym=malloc(sizeof(*new_sym));
+				memcpy(new_sym,sym,sizeof(*new_sym));
+				new_sym->next=proc->list_of_symbols;
+				proc->list_of_symbols=new_sym;
+				new_sym->brkpnt=0;
+				insert_breakpoint(proc, addr, new_sym);
+				sym=sym->next;
+			}
+		}
 #endif
 	}
 	proc->breakpoints_enabled = 1;

Modified: ltrace/trunk/debug.c
===================================================================
--- ltrace/trunk/debug.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/debug.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -6,8 +6,8 @@
 #include "output.h"
 
 void
-debug_(int level, const char *file, int line, const char *func, const char *fmt,
-       ...)
+debug_(int level, const char *file, int line, const char *func,
+		const char *fmt, ...)
 {
 	char buf[1024];
 	va_list args;

Modified: ltrace/trunk/debug.h
===================================================================
--- ltrace/trunk/debug.h	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/debug.h	2007-09-04 15:34:53 UTC (rev 80)
@@ -1,7 +1,7 @@
 #include <features.h>
 
 void debug_(int level, const char *file, int line, const char *func,
-            const char *fmt, ...) __attribute__((format(printf,5,6)));
+		const char *fmt, ...) __attribute__((format(printf,5,6)));
 
 int xinfdump(long, void *, int);
 

Modified: ltrace/trunk/display_args.c
===================================================================
--- ltrace/trunk/display_args.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/display_args.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -26,29 +26,28 @@
 static long get_length(enum tof type, struct process *proc, int len_spec,
 		       void *st, arg_type_info* st_info)
 {
-    long len;
-    arg_type_info info;
+	long len;
+	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);
-	return len;
-    }
+	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);
+		return len;
+	}
 
-    info.arg_num = -len_spec - 1;
-    info.type = ARGTYPE_INT;
-    return gimme_arg(type, proc, &info);
+	info.type = ARGTYPE_INT;
+	return gimme_arg(type, proc, -len_spec-1, &info);
 }
 
 static int display_ptrto(enum tof type, struct process *proc, long item,
 			 arg_type_info * info,
 			 void *st, arg_type_info* st_info)
 {
-    arg_type_info temp;
-    temp.type = ARGTYPE_POINTER;
-    temp.u.ptr_info.info = info;
-    return display_value(type, proc, item, &temp, st, st_info);
+	arg_type_info temp;
+	temp.type = ARGTYPE_POINTER;
+	temp.u.ptr_info.info = info;
+	return display_value(type, proc, item, &temp, st, st_info);
 }
 
 /*
@@ -63,97 +62,97 @@
 			    void *addr, arg_type_info * info,
 			    void *st, arg_type_info* st_info)
 {
-    int len = 0;
-    int i;
-    int array_len;
+	int len = 0;
+	int i;
+	int array_len;
 
-    if (addr == NULL)
-	return fprintf(output, "NULL");
+	if (addr == NULL)
+		return fprintf(output, "NULL");
 
-    array_len = get_length(type, proc, info->u.array_info.len_spec,
-			   st, st_info);
-    len += fprintf(output, "[ ");
-    for (i = 0; i < opt_A && i < array_maxlength && i < array_len; i++) {
-	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(output, ", ");
-	if (opt_d)
-	    len += fprintf(output, "%p=", addr);
-	len +=
-	    display_ptrto(type, proc, (long) addr, elt_type, st, st_info);
-	addr += elt_size;
-    }
-    if (i < array_len)
-	len += fprintf(output, "...");
-    len += fprintf(output, " ]");
-    return len;
+	array_len = get_length(type, proc, info->u.array_info.len_spec,
+			st, st_info);
+	len += fprintf(output, "[ ");
+	for (i = 0; i < opt_A && i < array_maxlength && i < array_len; i++) {
+		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(output, ", ");
+		if (opt_d)
+			len += fprintf(output, "%p=", addr);
+		len +=
+			display_ptrto(type, proc, (long) addr, elt_type, st, st_info);
+		addr += elt_size;
+	}
+	if (i < array_len)
+		len += fprintf(output, "...");
+	len += fprintf(output, " ]");
+	return len;
 }
- 
+
 /* addr - A pointer to the beginning of the memory region occupied by
  *        the struct (aka a pointer to the struct)
  */
 static int display_structptr(enum tof type, struct process *proc,
 			     void *addr, arg_type_info * info)
 {
-    int i;
-    arg_type_info *field;
-    int len = 0;
+	int i;
+	arg_type_info *field;
+	int len = 0;
 
-    if (addr == NULL)
-	return fprintf(output, "NULL");
+	if (addr == NULL)
+		return fprintf(output, "NULL");
 
-    len += fprintf(output, "{ ");
-    for (i = 0; (field = info->u.struct_info.fields[i]) != NULL; i++) {
-	if (i != 0)
-	    len += fprintf(output, ", ");
-	if (opt_d)
-	    len +=
-		fprintf(output, "%p=",
-			addr + info->u.struct_info.offset[i]);
-	len +=
-	    display_ptrto(LT_TOF_STRUCT, proc,
-			  (long) addr + info->u.struct_info.offset[i],
-			  field, addr, info);
-    }
-    len += fprintf(output, " }");
+	len += fprintf(output, "{ ");
+	for (i = 0; (field = info->u.struct_info.fields[i]) != NULL; i++) {
+		if (i != 0)
+			len += fprintf(output, ", ");
+		if (opt_d)
+			len +=
+				fprintf(output, "%p=",
+						addr + info->u.struct_info.offset[i]);
+		len +=
+			display_ptrto(LT_TOF_STRUCT, proc,
+					(long) addr + info->u.struct_info.offset[i],
+					field, addr, info);
+	}
+	len += fprintf(output, " }");
 
-    return len;
+	return len;
 }
 
 static int display_pointer(enum tof type, struct process *proc, long value,
 			   arg_type_info * info,
 			   void *st, arg_type_info* st_info)
 {
-    long pointed_to;
-    arg_type_info *inner = info->u.ptr_info.info;
+	long pointed_to;
+	arg_type_info *inner = info->u.ptr_info.info;
 
-    if (inner->type == ARGTYPE_ARRAY) {
-	return display_arrayptr(type, proc, (void*) value, inner,
+	if (inner->type == ARGTYPE_ARRAY) {
+		return display_arrayptr(type, proc, (void*) value, inner,
 				st, st_info);
-    } else if (inner->type == ARGTYPE_STRUCT) {
-	return display_structptr(type, proc, (void *) value, inner);
-    } else {
-	if (value == 0)
-	    return fprintf(output, "NULL");
-	else if (umovelong(proc, (void *) value, &pointed_to) < 0)
-	    return fprintf(output, "?");
-	else
-	    return display_value(type, proc, pointed_to, inner,
-				 st, st_info);
-    }
+	} else if (inner->type == ARGTYPE_STRUCT) {
+		return display_structptr(type, proc, (void *) value, inner);
+	} else {
+		if (value == 0)
+			return fprintf(output, "NULL");
+		else if (umovelong(proc, (void *) value, &pointed_to) < 0)
+			return fprintf(output, "?");
+		else
+			return display_value(type, proc, pointed_to, inner,
+					st, st_info);
+	}
 }
 
 static int display_enum(enum tof type, struct process *proc,
-                        arg_type_info* info, long value)
+		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]);
-    }
+	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);
+	return display_unknown(type, proc, value);
 }
 
 /* Args:
@@ -168,8 +167,8 @@
    strings whose length is given by another structure element.
 */
 int display_value(enum tof type, struct process *proc,
-                  long value, arg_type_info *info,
-		  void *st, arg_type_info* st_info)
+		long value, arg_type_info *info,
+		void *st, arg_type_info* st_info)
 {
 	int tmp;
 
@@ -228,31 +227,31 @@
 						 info->u.string_n_info.size_spec, st, st_info));
 	case ARGTYPE_ARRAY:
 		return fprintf(output, "<array without address>");
-        case ARGTYPE_ENUM:
+	case ARGTYPE_ENUM:
 		return display_enum(type, proc, info, value);
 	case ARGTYPE_STRUCT:
 		return fprintf(output, "<struct without address>");
 	case ARGTYPE_POINTER:
 		return display_pointer(type, proc, value, info,
 				       st, st_info);
- 	case ARGTYPE_UNKNOWN:
+	case ARGTYPE_UNKNOWN:
 	default:
 		return display_unknown(type, proc, value);
 	}
 }
 
-int display_arg(enum tof type, struct process *proc, arg_type_info * info)
+int display_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * info)
 {
-    long arg;
+	long arg;
 
-    if (info->type == ARGTYPE_VOID) {
-	return 0;
-    } else if (info->type == ARGTYPE_FORMAT) {
-	return display_format(type, proc, info->arg_num);
-    } else {
-	arg = gimme_arg(type, proc, info);
-	return display_value(type, proc, arg, info, NULL, NULL);
-    }
+	if (info->type == ARGTYPE_VOID) {
+		return 0;
+	} else if (info->type == ARGTYPE_FORMAT) {
+		return display_format(type, proc, arg_num);
+	} else {
+		arg = gimme_arg(type, proc, arg_num, info);
+		return display_value(type, proc, arg, info, NULL, NULL);
+	}
 }
 
 static int display_char(int what)
@@ -335,9 +334,8 @@
 	int len = 0;
 	arg_type_info info;
 
-	info.arg_num = arg_num;
 	info.type = ARGTYPE_POINTER;
-	addr = (void *)gimme_arg(type, proc, &info);
+	addr = (void *)gimme_arg(type, proc, arg_num, &info);
 	if (!addr) {
 		return fprintf(output, "NULL");
 	}
@@ -380,68 +378,48 @@
 						break;
 					}
 				} else if (c == 'd' || c == 'i') {
-					info.arg_num = ++arg_num;
 					info.type = ARGTYPE_LONG;
 					if (!is_long || proc->mask_32bit)
 						len +=
 						    fprintf(output, ", %d",
-							    (int)gimme_arg(type,
-									   proc,
-									   &info));
+							    (int)gimme_arg(type, proc, ++arg_num, &info));
 					else
 						len +=
 						    fprintf(output, ", %ld",
-							    gimme_arg(type,
-								      proc,
-								      &info));
+							    gimme_arg(type, proc, ++arg_num, &info));
 					break;
 				} else if (c == 'u') {
-					info.arg_num = ++arg_num;
 					info.type = ARGTYPE_LONG;
 					if (!is_long || proc->mask_32bit)
 						len +=
 						    fprintf(output, ", %u",
-							    (int)gimme_arg(type,
-									   proc,
-									   &info));
+							    (int)gimme_arg(type, proc, ++arg_num, &info));
 					else
 						len +=
 						    fprintf(output, ", %lu",
-							    gimme_arg(type,
-								      proc,
-								      &info));
+							    gimme_arg(type, proc, ++arg_num, &info));
 					break;
 				} else if (c == 'o') {
-					info.arg_num = ++arg_num;
 					info.type = ARGTYPE_LONG;
 					if (!is_long || proc->mask_32bit)
 						len +=
 						    fprintf(output, ", 0%o",
-							    (int)gimme_arg(type,
-									   proc,
-									   &info));
+							    (int)gimme_arg(type, proc, ++arg_num, &info));
 					else
 						len +=
 						    fprintf(output, ", 0%lo",
-							    gimme_arg(type,
-								      proc,
-								      &info));
+							    gimme_arg(type, proc, ++arg_num, &info));
 					break;
 				} else if (c == 'x' || c == 'X') {
-					info.arg_num = ++arg_num;
 					info.type = ARGTYPE_LONG;
 					if (!is_long || proc->mask_32bit)
 						len +=
 						    fprintf(output, ", %#x",
-							    (int)gimme_arg(type,
-									   proc,
-									   &info));
+							    (int)gimme_arg(type, proc, ++arg_num, &info));
 					else
 						len +=
 						    fprintf(output, ", %#lx",
-							    gimme_arg(type,
-								      proc,
-								      &info));
+							    gimme_arg(type, proc, ++arg_num, &info));
 					break;
 				} else if (strchr("eEfFgGaACS", c)
 					   || (is_long
@@ -450,42 +428,32 @@
 					str1[i + 1] = '\0';
 					break;
 				} else if (c == 'c') {
-					info.arg_num = ++arg_num;
 					info.type = ARGTYPE_LONG;
 					len += fprintf(output, ", '");
 					len +=
 					    display_char((int)
-							 gimme_arg(type, proc,
-								   &info));
+							 gimme_arg(type, proc, ++arg_num, &info));
 					len += fprintf(output, "'");
 					break;
 				} else if (c == 's') {
-					info.arg_num = ++arg_num;
 					info.type = ARGTYPE_POINTER;
 					len += fprintf(output, ", ");
 					len +=
 					    display_string(type, proc,
-							   (void *)gimme_arg(type,
-									     proc,
-									     &info),
+							   (void *)gimme_arg(type, proc, ++arg_num, &info),
 							   string_maxlength);
 					break;
 				} else if (c == 'p' || c == 'n') {
-					info.arg_num = ++arg_num;
 					info.type = ARGTYPE_POINTER;
 					len +=
 					    fprintf(output, ", %p",
-						    (void *)gimme_arg(type,
-								      proc,
-								      &info));
+						    (void *)gimme_arg(type, proc, ++arg_num, &info));
 					break;
 				} else if (c == '*') {
-					info.arg_num = ++arg_num;
 					info.type = ARGTYPE_LONG;
 					len +=
 					    fprintf(output, ", %d",
-						    (int)gimme_arg(type, proc,
-								   &info));
+						    (int)gimme_arg(type, proc, ++arg_num, &info));
 				}
 			}
 		}

Modified: ltrace/trunk/elf.c
===================================================================
--- ltrace/trunk/elf.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/elf.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -176,15 +176,15 @@
   table.
 
  */
-                                if(dyn.d_tag==DT_PLTGOT){
-                                    lte->pltgot_addr=dyn.d_un.d_ptr; 
-                                }
-                                if(dyn.d_tag==DT_MIPS_LOCAL_GOTNO){
-                                    lte->mips_local_gotno=dyn.d_un.d_val;
-                                }
-                                if(dyn.d_tag==DT_MIPS_GOTSYM){
-                                    lte->mips_gotsym=dyn.d_un.d_val;
-                                }
+				if(dyn.d_tag==DT_PLTGOT){
+					lte->pltgot_addr=dyn.d_un.d_ptr; 
+				}
+				if(dyn.d_tag==DT_MIPS_LOCAL_GOTNO){
+					lte->mips_local_gotno=dyn.d_un.d_val;
+				}
+				if(dyn.d_tag==DT_MIPS_GOTSYM){
+					lte->mips_gotsym=dyn.d_un.d_val;
+				}
 #endif // __mips__
 				if (dyn.d_tag == DT_JMPREL)
 					relplt_addr = dyn.d_un.d_ptr;
@@ -469,28 +469,28 @@
 	for (i = 0; i < library_num; ++i)
 		do_init_elf(&lte[i + 1], library[i]);
 #ifdef __mips__
-        // MIPS doesn't use the PLT and the GOT entries get changed
-        // on startup. 
-        proc->need_to_reinitialize_breakpoints = 1;
-        for(i=lte->mips_gotsym; i<lte->dynsym_count;i++){
-            GElf_Sym sym;
-            const char *name;
-            GElf_Addr addr = arch_plt_sym_val(lte, i, 0);
-            if (gelf_getsym(lte->dynsym, i, &sym) == NULL){
-                error(EXIT_FAILURE, 0,
-                      "Couldn't get relocation from \"%s\"",
-                      proc->filename);       
-            }
-            name=lte->dynstr+sym.st_name;
-            if(ELF64_ST_TYPE(sym.st_info) != STT_FUNC){
-                debug(2,"sym %s not a function",name);
-                continue;
-            }
-            add_library_symbol(addr, name, &library_symbols, 0,
-                               ELF64_ST_BIND(sym.st_info) != 0);
-            if (!lib_tail)
-                lib_tail = &(library_symbols->next);
-        }
+	// MIPS doesn't use the PLT and the GOT entries get changed
+	// on startup. 
+	proc->need_to_reinitialize_breakpoints = 1;
+	for(i=lte->mips_gotsym; i<lte->dynsym_count;i++){
+		GElf_Sym sym;
+		const char *name;
+		GElf_Addr addr = arch_plt_sym_val(lte, i, 0);
+		if (gelf_getsym(lte->dynsym, i, &sym) == NULL){
+			error(EXIT_FAILURE, 0,
+					"Couldn't get relocation from \"%s\"",
+					proc->filename);       
+		}
+		name=lte->dynstr+sym.st_name;
+		if(ELF64_ST_TYPE(sym.st_info) != STT_FUNC){
+			debug(2,"sym %s not a function",name);
+			continue;
+		}
+		add_library_symbol(addr, name, &library_symbols, 0,
+				ELF64_ST_BIND(sym.st_info) != 0);
+		if (!lib_tail)
+			lib_tail = &(library_symbols->next);
+	}
 #else
 	for (i = 0; i < lte->relplt_count; ++i) {
 		GElf_Rel rel;
@@ -538,7 +538,7 @@
 
 	if (proc->need_to_reinitialize_breakpoints) {
 		/* Add "PLTs_initialized_by_here" to opt_x list, if not
-                   already there. */
+		   already there. */
 		main_cheat = (struct opt_x_t *)malloc(sizeof(struct opt_x_t));
 		if (main_cheat == NULL)
 			error(EXIT_FAILURE, 0, "Couldn't allocate memory");

Modified: ltrace/trunk/elf.h
===================================================================
--- ltrace/trunk/elf.h	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/elf.h	2007-09-04 15:34:53 UTC (rev 80)
@@ -27,9 +27,9 @@
 	int hash_type;
 	int lte_flags;
 #ifdef __mips__
-        size_t pltgot_addr;
-        size_t mips_local_gotno;
-        size_t mips_gotsym;
+	size_t pltgot_addr;
+	size_t mips_local_gotno;
+	size_t mips_gotsym;
 #endif // __mips__
 };
 

Modified: ltrace/trunk/etc/ltrace.conf
===================================================================
--- ltrace/trunk/etc/ltrace.conf	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/etc/ltrace.conf	2007-09-04 15:34:53 UTC (rev 80)
@@ -97,7 +97,7 @@
 
 ; arpa/inet.h
 int inet_aton(string,addr);
-string inet_ntoa(addr);			; It isn't a ADDR but an hexa number...
+string inet_ntoa(addr);			; It isn't an ADDR but an hexa number...
 addr inet_addr(string);
 
 ; bfd.h

Modified: ltrace/trunk/ltrace.c
===================================================================
--- ltrace/trunk/ltrace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/ltrace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -118,11 +118,13 @@
 		if (opt_F->filename[0] == '~') {
 			char path[PATH_MAX];
 			char *home_dir = getenv("HOME");
-			strncpy(path, home_dir, PATH_MAX - 1);
-			path[PATH_MAX - 1] = '\0';
-			strncat(path, opt_F->filename + 1,
-					PATH_MAX - strlen(path) - 1);
-			read_config_file(path);
+			if (home_dir) {
+				strncpy(path, home_dir, PATH_MAX - 1);
+				path[PATH_MAX - 1] = '\0';
+				strncat(path, opt_F->filename + 1,
+						PATH_MAX - strlen(path) - 1);
+				read_config_file(path);
+			}
 		} else {
 			read_config_file(opt_F->filename);
 		}

Modified: ltrace/trunk/ltrace.h
===================================================================
--- ltrace/trunk/ltrace.h	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/ltrace.h	2007-09-04 15:34:53 UTC (rev 80)
@@ -55,7 +55,6 @@
 
 typedef struct arg_type_info_t {
 	enum arg_type type;
-	int arg_num;
 	union {
 		// ARGTYPE_ENUM
 		struct {
@@ -106,7 +105,7 @@
 	LT_TOF_FUNCTIONR,	/* Return from a real library function */
 	LT_TOF_SYSCALL,		/* A syscall */
 	LT_TOF_SYSCALLR,	/* Return from a syscall */
-        LT_TOF_STRUCT		/* Not a function; read args from struct */
+	LT_TOF_STRUCT		/* Not a function; read args from struct */
 };
 
 struct function {
@@ -211,7 +210,7 @@
 extern struct event *wait_for_something(void);
 extern void process_event(struct event *event);
 extern void execute_program(struct process *, char **);
-extern int display_arg(enum tof type, struct process *proc, arg_type_info *info);
+extern int display_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info);
 extern struct breakpoint *address2bpstruct(struct process *proc, void *addr);
 extern void breakpoints_init(struct process *proc);
 extern void insert_breakpoint(struct process *proc, void *addr,
@@ -248,7 +247,7 @@
 extern void continue_after_breakpoint(struct process *proc,
 				      struct breakpoint *sbp);
 extern void continue_enabling_breakpoint(pid_t pid, struct breakpoint *sbp);
-extern long gimme_arg(enum tof type, struct process *proc, arg_type_info *);
+extern long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info);
 extern void save_register_args(enum tof type, struct process *proc);
 extern int umovestr(struct process *proc, void *addr, int len, void *laddr);
 extern int umovelong(struct process *proc, void *addr, long *result);

Modified: ltrace/trunk/output.c
===================================================================
--- ltrace/trunk/output.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/output.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -191,26 +191,23 @@
 	func = name2func(function_name);
 	if (!func) {
 		int i;
-		arg_type_info info = *arg_unknown;
 		for (i = 0; i < 4; i++) {
-			info.arg_num = i;
 			current_column +=
-			    display_arg(type, proc, &info);
+			    display_arg(type, proc, i, arg_unknown);
 			current_column += fprintf(output, ", ");
 		}
-		info.arg_num = 4;
-		current_column += display_arg(type, proc, &info);
+		current_column += display_arg(type, proc, 4, arg_unknown);
 		return;
 	} else {
 		int i;
 		for (i = 0; i < func->num_params - func->params_right - 1; i++) {
 			current_column +=
-			    display_arg(type, proc, func->arg_info[i]);
+			    display_arg(type, proc, i, func->arg_info[i]);
 			current_column += fprintf(output, ", ");
 		}
 		if (func->num_params > func->params_right) {
 			current_column +=
-			    display_arg(type, proc, func->arg_info[i]);
+			    display_arg(type, proc, i, func->arg_info[i]);
 			if (func->params_right) {
 				current_column += fprintf(output, ", ");
 			}
@@ -279,23 +276,21 @@
 	}
 
 	if (!func) {
-		arg_type_info info = *arg_unknown;
 		current_column += fprintf(output, ") ");
 		tabto(opt_a - 1);
 		fprintf(output, "= ");
-		info.arg_num = -1;
-		display_arg(type, proc, &info);
+		display_arg(type, proc, -1, arg_unknown);
 	} else {
 		int i;
 		for (i = func->num_params - func->params_right;
 		     i < func->num_params - 1; i++) {
 			current_column +=
-			    display_arg(type, proc, func->arg_info[i]);
+			    display_arg(type, proc, i, func->arg_info[i]);
 			current_column += fprintf(output, ", ");
 		}
 		if (func->params_right) {
 			current_column +=
-			    display_arg(type, proc, func->arg_info[i]);
+			    display_arg(type, proc, i, func->arg_info[i]);
 		}
 		current_column += fprintf(output, ") ");
 		tabto(opt_a - 1);
@@ -303,7 +298,7 @@
 		if (func->return_info->type == ARGTYPE_VOID) {
 			fprintf(output, "<void>");
 		} else {
-			display_arg(type, proc, func->return_info);
+			display_arg(type, proc, -1, func->return_info);
 		}
 	}
 	if (opt_T) {

Modified: ltrace/trunk/process_event.c
===================================================================
--- ltrace/trunk/process_event.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/process_event.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -225,10 +225,9 @@
 	if (fork_p(event->proc, event->e_un.sysnum)) {
 		if (opt_f) {
 			arg_type_info info;
-			info.arg_num = -1; /* Return value */
 			info.type = ARGTYPE_LONG;
 			pid_t child =
-			    gimme_arg(LT_TOF_SYSCALLR, event->proc, &info);
+			    gimme_arg(LT_TOF_SYSCALLR, event->proc, -1, &info);
 			if (child > 0) {
 				open_pid(child, 0);
 			}
@@ -253,10 +252,10 @@
 #ifdef __powerpc__
 		struct breakpoint *nxtbp;
 		char nop_inst[] = PPC_NOP;
-                if (memcmp(sbp->orig_value, nop_inst, PPC_NOP_LENGTH) == 0) {
-                	nxtbp = address2bpstruct(event->proc,
-                                                 event->e_un.brk_addr +
-                                                 	PPC_NOP_LENGTH);
+		if (memcmp(sbp->orig_value, nop_inst, PPC_NOP_LENGTH) == 0) {
+			nxtbp = address2bpstruct(event->proc,
+					event->e_un.brk_addr +
+					PPC_NOP_LENGTH);
 			if (nxtbp != 0) {
 				enable_breakpoint(event->proc->pid, sbp);
 				continue_after_breakpoint(event->proc, nxtbp);
@@ -308,22 +307,22 @@
 				}
 			}
 #elif defined(__mips__)
-                        void *addr;
-                        void *old_addr;
-                        struct library_symbol *sym= event->proc->callstack[i].c_un.libfunc;
-                        assert(sym && sym->brkpnt);
-                        old_addr=sym->brkpnt->addr;
-                        addr=sym2addr(event->proc,sym);
-                        assert(old_addr !=0 && addr !=0);
-                        if(addr != old_addr){
-                            struct library_symbol *new_sym;
-                            new_sym=malloc(sizeof(*new_sym));
-                            memcpy(new_sym,sym,sizeof(*new_sym));
-                            new_sym->next=event->proc->list_of_symbols;
-                            event->proc->list_of_symbols=new_sym;
-                            new_sym->brkpnt=0;
-                            insert_breakpoint(event->proc, addr, new_sym);
-                        }
+			void *addr;
+			void *old_addr;
+			struct library_symbol *sym= event->proc->callstack[i].c_un.libfunc;
+			assert(sym && sym->brkpnt);
+			old_addr=sym->brkpnt->addr;
+			addr=sym2addr(event->proc,sym);
+			assert(old_addr !=0 && addr !=0);
+			if(addr != old_addr){
+				struct library_symbol *new_sym;
+				new_sym=malloc(sizeof(*new_sym));
+				memcpy(new_sym,sym,sizeof(*new_sym));
+				new_sym->next=event->proc->list_of_symbols;
+				event->proc->list_of_symbols=new_sym;
+				new_sym->brkpnt=0;
+				insert_breakpoint(event->proc, addr, new_sym);
+			}
 #endif
 			for (j = event->proc->callstack_depth - 1; j > i; j--) {
 				callstack_pop(event->proc);
@@ -404,7 +403,7 @@
 	elem->c_un.libfunc = sym;
 
 	elem->return_addr = proc->return_addr;
-        if (elem->return_addr) {
+	if (elem->return_addr) {
 		insert_breakpoint(proc, elem->return_addr, 0);
 	}
 

Modified: ltrace/trunk/read_config_file.c
===================================================================
--- ltrace/trunk/read_config_file.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/read_config_file.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -88,7 +88,7 @@
 
 	while (tmp->name) {
 		if (!strncmp(*str, tmp->name, strlen(tmp->name))
-		    && index(" ,()#*;012345[", *(*str + strlen(tmp->name)))) {
+				&& index(" ,()#*;012345[", *(*str + strlen(tmp->name)))) {
 			*str += strlen(tmp->name);
 			return lookup_prototype(tmp->pt);
 		}
@@ -106,28 +106,28 @@
 
 static char *xstrndup(char *str, size_t len)
 {
-    char *ret = (char *) malloc(len + 1);
-    strncpy(ret, str, len);
-    ret[len] = 0;
-    return ret;
+	char *ret = (char *) malloc(len + 1);
+	strncpy(ret, str, len);
+	ret[len] = 0;
+	return ret;
 }
 
 static char *parse_ident(char **str)
 {
-    char *ident = *str;
+	char *ident = *str;
 
-    if (!isalnum(**str) && **str != '_') {
-	output_line(0, "Syntax error in `%s', line %d: Bad identifier",
-		    filename, line_no);
-	error_count++;
-	return NULL;
-    }
+	if (!isalnum(**str) && **str != '_') {
+		output_line(0, "Syntax error in `%s', line %d: Bad identifier",
+				filename, line_no);
+		error_count++;
+		return NULL;
+	}
 
-    while (**str && (isalnum(**str) || **str == '_')) {
-	++(*str);
-    }
+	while (**str && (isalnum(**str) || **str == '_')) {
+		++(*str);
+	}
 
-    return xstrndup(ident, *str - ident);
+	return xstrndup(ident, *str - ident);
 }
 
 /*
@@ -164,17 +164,17 @@
 
 static int parse_int(char **str)
 {
-    char *end;
-    long n = strtol(*str, &end, 0);
-    if (end == *str) {
-	output_line(0, "Syntax error in `%s', line %d: Bad number (%s)",
-		    filename, line_no, *str);
-	error_count++;
-	return 0;
-    }
+	char *end;
+	long n = strtol(*str, &end, 0);
+	if (end == *str) {
+		output_line(0, "Syntax error in `%s', line %d: Bad number (%s)",
+				filename, line_no, *str);
+		error_count++;
+		return 0;
+	}
 
-    *str = end;
-    return n;
+	*str = end;
+	return n;
 }
 
 /*
@@ -192,192 +192,192 @@
  */
 static int parse_argnum(char **str)
 {
-    int multiplier = 1;
-    int n = 0;
+	int multiplier = 1;
+	int n = 0;
 
-    if (strncmp(*str, "arg", 3) == 0) {
-	(*str) += 3;
-	multiplier = -1;
-    } else if (strncmp(*str, "elt", 3) == 0) {
-	(*str) += 3;
-	multiplier = -1;
-    } else if (strncmp(*str, "retval", 6) == 0) {
-	(*str) += 6;
-	return 0;
-    }
+	if (strncmp(*str, "arg", 3) == 0) {
+		(*str) += 3;
+		multiplier = -1;
+	} else if (strncmp(*str, "elt", 3) == 0) {
+		(*str) += 3;
+		multiplier = -1;
+	} else if (strncmp(*str, "retval", 6) == 0) {
+		(*str) += 6;
+		return 0;
+	}
 
-    n = parse_int(str);
+	n = parse_int(str);
 
-    return n * multiplier;
+	return n * multiplier;
 }
 
 struct typedef_node_t {
-    char *name;
-    arg_type_info *info;
-    struct typedef_node_t *next;
+	char *name;
+	arg_type_info *info;
+	struct typedef_node_t *next;
 } *typedefs = NULL;
 
 static arg_type_info *lookup_typedef(char **str)
 {
-    struct typedef_node_t *node;
-    char *end = *str;
-    while (*end && (isalnum(*end) || *end == '_'))
-	++end;
-    if (end == *str)
-	return NULL;
+	struct typedef_node_t *node;
+	char *end = *str;
+	while (*end && (isalnum(*end) || *end == '_'))
+		++end;
+	if (end == *str)
+		return NULL;
 
-    for (node = typedefs; node != NULL; node = node->next) {
-	if (strncmp(*str, node->name, end - *str) == 0) {
-	    (*str) += strlen(node->name);
-	    return node->info;
+	for (node = typedefs; node != NULL; node = node->next) {
+		if (strncmp(*str, node->name, end - *str) == 0) {
+			(*str) += strlen(node->name);
+			return node->info;
+		}
 	}
-    }
 
-    return NULL;
+	return NULL;
 }
 
 static void parse_typedef(char **str)
 {
-    char *name;
-    arg_type_info *info;
-    struct typedef_node_t *binding;
+	char *name;
+	arg_type_info *info;
+	struct typedef_node_t *binding;
 
-    (*str) += strlen("typedef");
-    eat_spaces(str);
+	(*str) += strlen("typedef");
+	eat_spaces(str);
 
-    // Grab out the name of the type
-    name = parse_ident(str);
+	// Grab out the name of the type
+	name = parse_ident(str);
 
-    // Skip = sign
-    eat_spaces(str);
-    if (**str != '=') {
-	output_line(0,
-		    "Syntax error in `%s', line %d: expected '=', got '%c'",
-		    filename, line_no, **str);
-	error_count++;
-	return;
-    }
-    (*str)++;
-    eat_spaces(str);
+	// Skip = sign
+	eat_spaces(str);
+	if (**str != '=') {
+		output_line(0,
+				"Syntax error in `%s', line %d: expected '=', got '%c'",
+				filename, line_no, **str);
+		error_count++;
+		return;
+	}
+	(*str)++;
+	eat_spaces(str);
 
-    // Parse the type
-    info = parse_type(str);
+	// Parse the type
+	info = parse_type(str);
 
-    // Insert onto beginning of linked list
-    binding = malloc(sizeof(*binding));
-    binding->name = name;
-    binding->info = info;
-    binding->next = typedefs;
-    typedefs = binding;
+	// Insert onto beginning of linked list
+	binding = malloc(sizeof(*binding));
+	binding->name = name;
+	binding->info = info;
+	binding->next = typedefs;
+	typedefs = binding;
 }
 
 static size_t arg_sizeof(arg_type_info * arg)
 {
-    if (arg->type == ARGTYPE_CHAR) {
-	return sizeof(char);
-    } else if (arg->type == ARGTYPE_SHORT || arg->type == ARGTYPE_USHORT) {
-	return sizeof(short);
-    } else if (arg->type == ARGTYPE_FLOAT) {
-	return sizeof(float);
-    } else if (arg->type == ARGTYPE_DOUBLE) {
-	return sizeof(double);
-    } else if (arg->type == ARGTYPE_ENUM) {
-	return sizeof(int);
-    } else if (arg->type == ARGTYPE_STRUCT) {
-	return arg->u.struct_info.size;
-    } else if (arg->type == ARGTYPE_POINTER) {
-	return sizeof(void*);
-    } else if (arg->type == ARGTYPE_ARRAY) {
-	if (arg->u.array_info.len_spec > 0)
-	    return arg->u.array_info.len_spec * arg->u.array_info.elt_size;
-	else
-	    return sizeof(void *);
-    } else {
-	return sizeof(int);
-    }
+	if (arg->type == ARGTYPE_CHAR) {
+		return sizeof(char);
+	} else if (arg->type == ARGTYPE_SHORT || arg->type == ARGTYPE_USHORT) {
+		return sizeof(short);
+	} else if (arg->type == ARGTYPE_FLOAT) {
+		return sizeof(float);
+	} else if (arg->type == ARGTYPE_DOUBLE) {
+		return sizeof(double);
+	} else if (arg->type == ARGTYPE_ENUM) {
+		return sizeof(int);
+	} else if (arg->type == ARGTYPE_STRUCT) {
+		return arg->u.struct_info.size;
+	} else if (arg->type == ARGTYPE_POINTER) {
+		return sizeof(void*);
+	} else if (arg->type == ARGTYPE_ARRAY) {
+		if (arg->u.array_info.len_spec > 0)
+			return arg->u.array_info.len_spec * arg->u.array_info.elt_size;
+		else
+			return sizeof(void *);
+	} else {
+		return sizeof(int);
+	}
 }
 
 #undef alignof
 #define alignof(field,st) ((size_t) ((char*) &st.field - (char*) &st))
 static size_t arg_align(arg_type_info * arg)
 {
-    struct { char c; char C; } cC;
-    struct { char c; short s; } cs;
-    struct { char c; int i; } ci;
-    struct { char c; long l; } cl;
-    struct { char c; void* p; } cp;
-    struct { char c; float f; } cf;
-    struct { char c; double d; } cd;
+	struct { char c; char C; } cC;
+	struct { char c; short s; } cs;
+	struct { char c; int i; } ci;
+	struct { char c; long l; } cl;
+	struct { char c; void* p; } cp;
+	struct { char c; float f; } cf;
+	struct { char c; double d; } cd;
 
-    static size_t char_alignment = alignof(C, cC);
-    static size_t short_alignment = alignof(s, cs);
-    static size_t int_alignment = alignof(i, ci);
-    static size_t long_alignment = alignof(l, cl);
-    static size_t ptr_alignment = alignof(p, cp);
-    static size_t float_alignment = alignof(f, cf);
-    static size_t double_alignment = alignof(d, cd);
+	static size_t char_alignment = alignof(C, cC);
+	static size_t short_alignment = alignof(s, cs);
+	static size_t int_alignment = alignof(i, ci);
+	static size_t long_alignment = alignof(l, cl);
+	static size_t ptr_alignment = alignof(p, cp);
+	static size_t float_alignment = alignof(f, cf);
+	static size_t double_alignment = alignof(d, cd);
 
-    switch (arg->type) {
-    case ARGTYPE_LONG:
-    case ARGTYPE_ULONG:
-	return long_alignment;
-    case ARGTYPE_CHAR:
-	return char_alignment;
-    case ARGTYPE_SHORT:
-    case ARGTYPE_USHORT:
-	return short_alignment;
-    case ARGTYPE_FLOAT:
-	return float_alignment;
-    case ARGTYPE_DOUBLE:
-	return double_alignment;
-    case ARGTYPE_ADDR:
-    case ARGTYPE_FILE:
-    case ARGTYPE_FORMAT:
-    case ARGTYPE_STRING:
-    case ARGTYPE_STRING_N:
-    case ARGTYPE_POINTER:
-	return ptr_alignment;
+	switch (arg->type) {
+		case ARGTYPE_LONG:
+		case ARGTYPE_ULONG:
+			return long_alignment;
+		case ARGTYPE_CHAR:
+			return char_alignment;
+		case ARGTYPE_SHORT:
+		case ARGTYPE_USHORT:
+			return short_alignment;
+		case ARGTYPE_FLOAT:
+			return float_alignment;
+		case ARGTYPE_DOUBLE:
+			return double_alignment;
+		case ARGTYPE_ADDR:
+		case ARGTYPE_FILE:
+		case ARGTYPE_FORMAT:
+		case ARGTYPE_STRING:
+		case ARGTYPE_STRING_N:
+		case ARGTYPE_POINTER:
+			return ptr_alignment;
 
-    case ARGTYPE_ARRAY:
-	return arg_align(&arg->u.array_info.elt_type[0]);
+		case ARGTYPE_ARRAY:
+			return arg_align(&arg->u.array_info.elt_type[0]);
 
-    case ARGTYPE_STRUCT:
-	return arg_align(arg->u.struct_info.fields[0]);
-	
-    default:
-	return int_alignment;
-    }
+		case ARGTYPE_STRUCT:
+			return arg_align(arg->u.struct_info.fields[0]);
+
+		default:
+			return int_alignment;
+	}
 }
 
 static size_t align_skip(size_t alignment, size_t offset)
 {
-    if (offset % alignment)
-	return alignment - (offset % alignment);
-    else
-	return 0;
+	if (offset % alignment)
+		return alignment - (offset % alignment);
+	else
+		return 0;
 }
 
 /* I'm sure this isn't completely correct, but just try to get most of
  * them right for now. */
 static void align_struct(arg_type_info* info)
 {
-    size_t offset;
-    int i;
+	size_t offset;
+	int i;
 
-    if (info->u.struct_info.size != 0)
-	return;			// Already done
+	if (info->u.struct_info.size != 0)
+		return;			// Already done
 
-    // Compute internal padding due to alignment constraints for
-    // various types.
-    offset = 0;
-    for (i = 0; info->u.struct_info.fields[i] != NULL; i++) {
-	arg_type_info *field = info->u.struct_info.fields[i];
-	offset += align_skip(arg_align(field), offset);
-	info->u.struct_info.offset[i] = offset;
-	offset += arg_sizeof(field);
-    }
+	// Compute internal padding due to alignment constraints for
+	// various types.
+	offset = 0;
+	for (i = 0; info->u.struct_info.fields[i] != NULL; i++) {
+		arg_type_info *field = info->u.struct_info.fields[i];
+		offset += align_skip(arg_align(field), offset);
+		info->u.struct_info.offset[i] = offset;
+		offset += arg_sizeof(field);
+	}
 
-    info->u.struct_info.size = offset;
+	info->u.struct_info.size = offset;
 }
 
 static arg_type_info *parse_nonpointer_type(char **str)
@@ -386,17 +386,17 @@
 	arg_type_info *info;
 
 	if (strncmp(*str, "typedef", 7) == 0) {
-	    parse_typedef(str);
-	    return lookup_prototype(ARGTYPE_UNKNOWN);
+		parse_typedef(str);
+		return lookup_prototype(ARGTYPE_UNKNOWN);
 	}
 
 	simple = str2type(str);
 	if (simple->type == ARGTYPE_UNKNOWN) {
-	    info = lookup_typedef(str);
-	    if (info)
-		return info;
-	    else
-		return simple;		// UNKNOWN
+		info = lookup_typedef(str);
+		if (info)
+			return info;
+		else
+			return simple;		// UNKNOWN
 	}
 
 	info = malloc(sizeof(*info));
@@ -409,149 +409,149 @@
 
 	/* Syntax: array ( type, N|argN ) */
 	case ARGTYPE_ARRAY:
-	    (*str)++;		// Get past open paren
-	    eat_spaces(str);
-	    if ((info->u.array_info.elt_type = parse_type(str)) == NULL)
-		return NULL;
-	    info->u.array_info.elt_size =
-		arg_sizeof(info->u.array_info.elt_type);
-	    (*str)++;		// Get past comma
-	    eat_spaces(str);
-	    info->u.array_info.len_spec = parse_argnum(str);
-	    (*str)++;		// Get past close paren
-	    return info;
+		(*str)++;		// Get past open paren
+		eat_spaces(str);
+		if ((info->u.array_info.elt_type = parse_type(str)) == NULL)
+			return NULL;
+		info->u.array_info.elt_size =
+			arg_sizeof(info->u.array_info.elt_type);
+		(*str)++;		// Get past comma
+		eat_spaces(str);
+		info->u.array_info.len_spec = parse_argnum(str);
+		(*str)++;		// Get past close paren
+		return info;
 
 	/* Syntax: enum ( keyname=value,keyname=value,... ) */
 	case ARGTYPE_ENUM:{
-	    struct enum_opt {
-		char *key;
-		int value;
-		struct enum_opt *next;
-	    };
-	    struct enum_opt *list = NULL;
-	    struct enum_opt *p;
-	    int entries = 0;
-	    int ii;
+		struct enum_opt {
+			char *key;
+			int value;
+			struct enum_opt *next;
+		};
+		struct enum_opt *list = NULL;
+		struct enum_opt *p;
+		int entries = 0;
+		int ii;
 
-	    eat_spaces(str);
-	    (*str)++;		// Get past open paren
-	    eat_spaces(str);
-
-	    while (**str && **str != ')') {
-		p = (struct enum_opt *) malloc(sizeof(*p));
 		eat_spaces(str);
-		p->key = parse_ident(str);
-		if (error_count) {
-		    free(p);
-		    return NULL;
-		}
+		(*str)++;		// Get past open paren
 		eat_spaces(str);
-		if (**str != '=') {
-		    free(p->key);
-		    free(p);
-		    output_line(0,
-				"Syntax error in `%s', line %d: expected '=', got '%c'",
-				filename, line_no, **str);
-		    error_count++;
-		    return NULL;
-		}
-		++(*str);
-		eat_spaces(str);
-		p->value = parse_int(str);
-		p->next = list;
-		list = p;
-		++entries;
 
-		// Skip comma
-		eat_spaces(str);
-		if (**str == ',') {
-		    (*str)++;
-		    eat_spaces(str);
+		while (**str && **str != ')') {
+			p = (struct enum_opt *) malloc(sizeof(*p));
+			eat_spaces(str);
+			p->key = parse_ident(str);
+			if (error_count) {
+				free(p);
+				return NULL;
+			}
+			eat_spaces(str);
+			if (**str != '=') {
+				free(p->key);
+				free(p);
+				output_line(0,
+						"Syntax error in `%s', line %d: expected '=', got '%c'",
+						filename, line_no, **str);
+				error_count++;
+				return NULL;
+			}
+			++(*str);
+			eat_spaces(str);
+			p->value = parse_int(str);
+			p->next = list;
+			list = p;
+			++entries;
+
+			// Skip comma
+			eat_spaces(str);
+			if (**str == ',') {
+				(*str)++;
+				eat_spaces(str);
+			}
 		}
-	    }
 
-	    info->u.enum_info.entries = entries;
-	    info->u.enum_info.keys =
-		(char **) malloc(entries * sizeof(char *));
-	    info->u.enum_info.values =
-		(int *) malloc(entries * sizeof(int));
-	    for (ii = 0, p = NULL; list; ++ii, list = list->next) {
+		info->u.enum_info.entries = entries;
+		info->u.enum_info.keys =
+			(char **) malloc(entries * sizeof(char *));
+		info->u.enum_info.values =
+			(int *) malloc(entries * sizeof(int));
+		for (ii = 0, p = NULL; list; ++ii, list = list->next) {
+			if (p)
+				free(p);
+			info->u.enum_info.keys[ii] = list->key;
+			info->u.enum_info.values[ii] = list->value;
+			p = list;
+		}
 		if (p)
-		    free(p);
-		info->u.enum_info.keys[ii] = list->key;
-		info->u.enum_info.values[ii] = list->value;
-		p = list;
-	    }
-	    if (p)
-		free(p);
+			free(p);
 
-	    return info;
+		return info;
 	}
 
 	case ARGTYPE_STRING:
-	    if (!isdigit(**str) && **str != '[') {
-		/* Oops, was just a simple string after all */
-		free(info);
-		return simple;
-	    }
+		if (!isdigit(**str) && **str != '[') {
+			/* Oops, was just a simple string after all */
+			free(info);
+			return simple;
+		}
 
-	    info->type = ARGTYPE_STRING_N;
+		info->type = ARGTYPE_STRING_N;
 
-	    /* Backwards compatibility for string0, string1, ... */
-	    if (isdigit(**str)) {
-		info->u.string_n_info.size_spec = -parse_int(str);
+		/* Backwards compatibility for string0, string1, ... */
+		if (isdigit(**str)) {
+			info->u.string_n_info.size_spec = -parse_int(str);
+			return info;
+		}
+
+		(*str)++;		// Skip past opening [
+		eat_spaces(str);
+		info->u.string_n_info.size_spec = parse_argnum(str);
+		eat_spaces(str);
+		(*str)++;		// Skip past closing ]
 		return info;
-	    }
 
-	    (*str)++;		// Skip past opening [
-	    eat_spaces(str);
-	    info->u.string_n_info.size_spec = parse_argnum(str);
-	    eat_spaces(str);
-	    (*str)++;		// Skip past closing ]
-	    return info;
-
 	// Syntax: struct ( type,type,type,... )
-    case ARGTYPE_STRUCT:{
-	    int field_num = 0;
-	    (*str)++;		// Get past open paren
-	    info->u.struct_info.fields =
-		malloc((MAX_ARGS + 1) * sizeof(void *));
-	    info->u.struct_info.offset =
-		malloc((MAX_ARGS + 1) * sizeof(size_t));
-	    info->u.struct_info.size = 0;
-	    eat_spaces(str); // Empty arg list with whitespace inside
-	    while (**str && **str != ')') {
-		if (field_num == MAX_ARGS) {
-		    output_line(0,
-				"Error in `%s', line %d: Too many structure elements",
-				filename, line_no);
-		    error_count++;
-		    return NULL;
-		}
-		eat_spaces(str);
-		if (field_num != 0) {
-		    (*str)++;	// Get past comma
-		    eat_spaces(str);
-		}
-		if ((info->u.struct_info.fields[field_num++] =
-		     parse_type(str)) == NULL)
-		    return NULL;
+	case ARGTYPE_STRUCT:{
+		int field_num = 0;
+		(*str)++;		// Get past open paren
+		info->u.struct_info.fields =
+			malloc((MAX_ARGS + 1) * sizeof(void *));
+		info->u.struct_info.offset =
+			malloc((MAX_ARGS + 1) * sizeof(size_t));
+		info->u.struct_info.size = 0;
+		eat_spaces(str); // Empty arg list with whitespace inside
+		while (**str && **str != ')') {
+			if (field_num == MAX_ARGS) {
+				output_line(0,
+						"Error in `%s', line %d: Too many structure elements",
+						filename, line_no);
+				error_count++;
+				return NULL;
+			}
+			eat_spaces(str);
+			if (field_num != 0) {
+				(*str)++;	// Get past comma
+				eat_spaces(str);
+			}
+			if ((info->u.struct_info.fields[field_num++] =
+						parse_type(str)) == NULL)
+				return NULL;
 
-		// Must trim trailing spaces so the check for
-		// the closing paren is simple
-		eat_spaces(str);
-	    }
-	    (*str)++;		// Get past closing paren
-	    info->u.struct_info.fields[field_num] = NULL;
-	    align_struct(info);
-	    return info;
+			// Must trim trailing spaces so the check for
+			// the closing paren is simple
+			eat_spaces(str);
+		}
+		(*str)++;		// Get past closing paren
+		info->u.struct_info.fields[field_num] = NULL;
+		align_struct(info);
+		return info;
 	}
 
 	default:
 		if (info->type == ARGTYPE_UNKNOWN) {
 			output_line(0, "Syntax error in `%s', line %d: "
-				    "Unknown type encountered",
-				    filename, line_no);
+					"Unknown type encountered",
+					filename, line_no);
 			free(info);
 			error_count++;
 			return NULL;
@@ -593,13 +593,12 @@
 		debug(3, " Skipping line %d", line_no);
 		return NULL;
 	}
-	fun.return_info->arg_num = -1;
 	debug(4, " return_type = %d", fun.return_info->type);
 	eat_spaces(&str);
 	tmp = start_of_arg_sig(str);
 	if (!tmp) {
 		output_line(0, "Syntax error in `%s', line %d", filename,
-			    line_no);
+				line_no);
 		error_count++;
 		return NULL;
 	}
@@ -622,8 +621,8 @@
 		fun.arg_info[i] = parse_type(&str);
 		if (fun.arg_info[i] == NULL) {
 			output_line(0, "Syntax error in `%s', line %d"
-                                    ": unknown argument type",
-				    filename, line_no);
+					": unknown argument type",
+					filename, line_no);
 			error_count++;
 			return NULL;
 		}
@@ -631,7 +630,6 @@
 			fun.arg_info[i]->u.float_info.float_index = float_num++;
 		else if (fun.arg_info[i]->type == ARGTYPE_DOUBLE)
 			fun.arg_info[i]->u.double_info.float_index = float_num++;
-		fun.arg_info[i]->arg_num = i;
 		eat_spaces(&str);
 		if (*str == ',') {
 			str++;
@@ -642,7 +640,7 @@
 			if (str[strlen(str) - 1] == '\n')
 				str[strlen(str) - 1] = '\0';
 			output_line(0, "Syntax error in `%s', line %d at ...\"%s\"",
-				    filename, line_no, str);
+					filename, line_no, str);
 			error_count++;
 			return NULL;
 		}

Modified: ltrace/trunk/sysdeps/linux-gnu/alpha/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/alpha/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/alpha/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -47,10 +47,8 @@
 	return 0;
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
-
 	if (arg_num == -1) {	/* return value */
 		return ptrace(PTRACE_PEEKUSER, proc->pid, 0 /* REG_R0 */ , 0);
 	}

Modified: ltrace/trunk/sysdeps/linux-gnu/arm/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/arm/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/arm/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -51,10 +51,8 @@
 	return 0;
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
-
 	if (arg_num == -1) {	/* return value */
 		return ptrace(PTRACE_PEEKUSER, proc->pid, off_r0, 0);
 	}

Modified: ltrace/trunk/sysdeps/linux-gnu/i386/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/i386/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/i386/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -43,10 +43,8 @@
 	return 0;
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
-
 	if (arg_num == -1) {	/* return value */
 		return ptrace(PTRACE_PEEKUSER, proc->pid, 4 * EAX, 0);
 	}

Modified: ltrace/trunk/sysdeps/linux-gnu/ia64/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/ia64/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/ia64/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -245,9 +245,8 @@
 	exit(1);
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
 	union {
 		long l;
 		float f;

Modified: ltrace/trunk/sysdeps/linux-gnu/m68k/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/m68k/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/m68k/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -48,10 +48,8 @@
 	return 0;
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
-
 	if (arg_num == -1) {	/* return value */
 		return ptrace(PTRACE_PEEKUSER, proc->pid, 4 * PT_D0, 0);
 	}

Modified: ltrace/trunk/sysdeps/linux-gnu/mipsel/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/mipsel/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/mipsel/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -118,7 +118,7 @@
 I'm not doing any floating point support here. 
 
 */
-long gimme_arg(enum tof type, struct process *proc, int arg_num)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
     long ret;
     debug(2,"type %d arg %d",type,arg_num);

Modified: ltrace/trunk/sysdeps/linux-gnu/ppc/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/ppc/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/ppc/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -56,10 +56,8 @@
 	return 0;
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
-
 	if (arg_num == -1) {	/* return value */
 		return ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_R3,
 			      0);

Modified: ltrace/trunk/sysdeps/linux-gnu/s390/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/s390/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/s390/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -161,9 +161,8 @@
 	return 0;
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
 	long ret;
 
 	switch (arg_num) {

Modified: ltrace/trunk/sysdeps/linux-gnu/sparc/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/sparc/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/sparc/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -48,10 +48,8 @@
 	return 0;
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
-
 	proc_archdep *a = (proc_archdep *) proc->arch_ptr;
 	if (!a->valid) {
 		fprintf(stderr, "Could not get child registers\n");

Modified: ltrace/trunk/sysdeps/linux-gnu/x86_64/trace.c
===================================================================
--- ltrace/trunk/sysdeps/linux-gnu/x86_64/trace.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/sysdeps/linux-gnu/x86_64/trace.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -86,10 +86,8 @@
 	exit(1);
 }
 
-long gimme_arg(enum tof type, struct process *proc, arg_type_info *info)
+long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
 {
-	int arg_num = info->arg_num;
-
 	if (proc->mask_32bit)
 		return (unsigned int)gimme_arg32(type, proc, arg_num);
 

Modified: ltrace/trunk/wait_for_something.c
===================================================================
--- ltrace/trunk/wait_for_something.c	2007-08-31 16:49:48 UTC (rev 79)
+++ ltrace/trunk/wait_for_something.c	2007-09-04 15:34:53 UTC (rev 80)
@@ -111,7 +111,7 @@
 	if (stop_signal != (SIGTRAP | event.proc->tracesysgood)
 	    && stop_signal != SIGTRAP) {
 		event.thing = LT_EV_SIGNAL;
- 		event.e_un.signum = stop_signal;
+		event.e_un.signum = stop_signal;
 		return &event;
 	}
 




More information about the Ltrace-devel mailing list