aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUGS4
-rw-r--r--ChangeLog16
-rw-r--r--TODO7
-rw-r--r--debian/changelog24
-rw-r--r--debian/control.in8
-rw-r--r--debian/copyright2
-rwxr-xr-xdebian/rules5
-rw-r--r--debug.c53
-rw-r--r--debug.h7
-rw-r--r--display_args.c6
-rw-r--r--etc/ltrace.conf79
-rw-r--r--ltrace.12
-rw-r--r--ltrace.c47
-rw-r--r--ltrace.h99
-rw-r--r--options.c97
-rw-r--r--options.h1
-rw-r--r--proc.c2
-rw-r--r--process_event.c4
-rw-r--r--read_config_file.c10
-rw-r--r--sysdeps/linux-gnu/trace.c9
-rw-r--r--testsuite/ltrace.main/parameters.c3
-rw-r--r--testsuite/ltrace.main/parameters.conf5
-rw-r--r--testsuite/ltrace.main/parameters.exp2
-rw-r--r--testsuite/ltrace.minor/attach-process.exp2
-rw-r--r--testsuite/ltrace.minor/count-record.exp2
-rw-r--r--testsuite/ltrace.minor/demangle.exp2
-rw-r--r--testsuite/ltrace.minor/print-instruction-pointer.exp2
-rw-r--r--testsuite/ltrace.minor/time-record-T.exp2
-rw-r--r--testsuite/ltrace.minor/time-record-tt.exp2
-rw-r--r--testsuite/ltrace.minor/time-record-ttt.exp2
-rw-r--r--testsuite/ltrace.minor/trace-clone.c1
-rw-r--r--testsuite/ltrace.minor/trace-clone.exp2
-rw-r--r--testsuite/ltrace.minor/trace-exec.exp6
-rw-r--r--testsuite/ltrace.minor/trace-fork.exp2
34 files changed, 281 insertions, 236 deletions
diff --git a/BUGS b/BUGS
index c3be4a1..ac809e1 100644
--- a/BUGS
+++ b/BUGS
@@ -1,5 +1,5 @@
* Option -f sometimes fails to trace some children
* Manual page is not accurate (config files...)
-* elf.c only supports elf32 binaries
-* netscape sometimes dies with SIGSEGV (is this still true?)
+* Doesn't work with threads
+* Doesn't do inter-library calls (BP is in the executable's PLT)
* It lacks support for several Linux archs, and many operating systems
diff --git a/ChangeLog b/ChangeLog
index e972c5d..5a1d230 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2007-08-31 Juan Cespedes <cespedes@debian.org>
+
+ * General: Small fixes (indentation, typos, clean-up of code)
+ * ltrace.c: Close output file on exit
+ * ltrace.c: use getenf("HOME") instead of getpwuid(geteuid())->pw_dir
+ * read_config_file.c, display_args.c: remove "ignore" argtype;
+ that's what "void" is for
+ * packaging/debian/: misc fixes, sync with version 0.5-2
+ * etc/ltrace.conf: added more system calls
+ * testsuite/ltrace.minor/trace-clone.c: sleep(1) to avoid earlier
+ termination of process
+ * sysdeps/linux-gnu/trace.c: trace_pid(): reverted Petr's patch
+ to wait for child to stop, as it stopped following clone()
+ * process_event.c: Disable breakpoints before doing fork() (again!),
+ to make children work as expected
+
2007-05-10 Petr Machata <pmachata@redhat.com>
* Based on work of Supriya Kannery <supriyak@in.ibm.com>
diff --git a/TODO b/TODO
index 64f419e..78f9ac1 100644
--- a/TODO
+++ b/TODO
@@ -4,18 +4,15 @@
+ Read list of undefined symbols in executables
+ Read list of exported symbols in libraries
+ Read debugging info from executables/libraries
-* Update list of syscalls automatically?
+* Automatically update list of syscalls?
* Improve documentation
-* Improve -e option
+* Improve -e/-x options (regexp?)
* Improve -l option
* Improve C++ name demangling
* Display different argument types:
+ how to display execl...?
+ format+: for scanf()...: display args as pointers, and imply `+' for args
* Update /etc/ltrace.conf
-* netscape:
- + Why does it show so many `breakpointed at:' messages?
- \- Is this still true?
* More architectures: sparc64...
* More operating systems (solaris?)
* Option -I (inter-library calls)
diff --git a/debian/changelog b/debian/changelog
index e0f7ef4..18a6b63 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,12 +1,24 @@
+ltrace (0.5-2) unstable; urgency=low
+
+ * Fixed compilation issue in ppc
+
+ -- Juan Cespedes <cespedes@debian.org> Fri, 31 Aug 2007 13:53:27 +0200
+
ltrace (0.5-1) unstable; urgency=low
- * New upstream
- * Closes: #372928, #372928: spelling fixes
- * Change maintainer to ianw@debian.org, so I get bug reports
- * Change Juan to an uploader
- * Acknowledge 0.3.35.1 NMU, thanks Andrew Pollock
+ * New upstream version
+ * Remove some unneeded files in /usr/share/doc (ChangeLog, COPYING...)
+ * Fix several typos (closes: Bug#372928)
+ * Added more system calls to ltrace.conf
+
+ -- Juan Cespedes <cespedes@debian.org> Thu, 30 Aug 2007 14:54:44 +0200
+
+ltrace (0.4-2) unstable; urgency=low
+
+ * Use fclose() to close the output file when using option '-o'
+ (thanks to GuiJianfeng <jianfenggui@gmail.com>)
- -- Ian Wienand <ianw@debian.org> Fri, 16 Jun 2006 11:15:45 +1000
+ -- Juan Cespedes <cespedes@debian.org> Tue, 07 Aug 2007 11:49:27 +0200
ltrace (0.4-1) unstable; urgency=low
diff --git a/debian/control.in b/debian/control.in
index 9aebda7..f23fb59 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -1,10 +1,10 @@
Source: ltrace
Section: utils
Priority: optional
-Maintainer: Ian Wienand <ianw@debian.org>
-Uploaders: Juan Cespedes <cespedes@debian.org>
-Standards-Version: 3.6.2.2
-Build-Depends: @cdbs@, binutils-dev, dpatch, libelfg0-dev
+Maintainer: Juan Cespedes <cespedes@debian.org>
+Uploaders: Ian Wienand <ianw@debian.org>
+Standards-Version: 3.7.2
+Build-Depends: @cdbs@, binutils-dev, libelfg0-dev
Package: ltrace
Architecture: i386 arm m68k s390 powerpc sparc alpha amd64 ia64 ppc64
diff --git a/debian/copyright b/debian/copyright
index 2a83405..d79231d 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -4,7 +4,7 @@ Dynamic Library Tracer ``ltrace''.
Copyrights
----------
-Copyright (C) 1997-2006 Juan Cespedes <cespedes@debian.org>
+Copyright (C) 1997-2007 Juan Cespedes <cespedes@debian.org>
ARMLinux port: Copyright (C) 1998 Pat Beirne <pbeirne@home.com>
m68k port: Copyright (C) 1998 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
diff --git a/debian/rules b/debian/rules
index 7d69bc4..4105eb7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,4 +1,7 @@
#!/usr/bin/make -f
-include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+
+install/ltrace::
+ rm -f debian/ltrace/usr/share/doc/ltrace/*
diff --git a/debug.c b/debug.c
index bdff766..59827d0 100644
--- a/debug.c
+++ b/debug.c
@@ -31,52 +31,7 @@ debug_(int level, const char *file, int line, const char *func, const char *fmt,
#include <stdlib.h>
#include <sys/ptrace.h>
-int xwrite(const char *string, size_t len)
-{
- int rc = 0;
- rc = write(1, string, len);
- return rc;
-}
-
-int xwrites(const char *string)
-{
- size_t len = 0;
- int rc = 0;
- const char *tstring = string;
-
- while (*tstring++ != '\0') {
- len++;
- }
-
- if (len > 0) {
- rc = xwrite(string, len);
- }
-
- return rc;
-}
-
-int xwritehexi(int i)
-{
- int rc = 0;
- char text[9];
- int j;
- unsigned int temp = (unsigned int)i;
-
- for (j = 7; j >= 0; j--) {
- char c;
- c = (char)((temp & 0x0f) + '0');
- if (c > '9') {
- c = (char)(c + ('a' - '9' - 1));
- }
- text[j] = c;
- temp = temp >> 4;
- }
-
- rc = write(1, text, 8);
- return rc;
-}
-
-int xwritehexl(long i)
+static int xwritehexl(long i)
{
int rc = 0;
char text[17];
@@ -97,7 +52,7 @@ int xwritehexl(long i)
return rc;
}
-int xwritec(char c)
+static int xwritec(char c)
{
char temp = c;
char *text = &temp;
@@ -106,12 +61,12 @@ int xwritec(char c)
return rc;
}
-int xwritecr(void)
+static int xwritecr(void)
{
return xwritec('\n');
}
-int xwritedump(void *ptr, long addr, int len)
+static int xwritedump(void *ptr, long addr, int len)
{
int rc = 0;
long *tprt = (long *)ptr;
diff --git a/debug.h b/debug.h
index 301c6c7..2e36f03 100644
--- a/debug.h
+++ b/debug.h
@@ -3,13 +3,6 @@
void debug_(int level, const char *file, int line, const char *func,
const char *fmt, ...) __attribute__((format(printf,5,6)));
-int xwrite(const char *, size_t);
-int xwrites(const char *);
-int xwritehexi(int);
-int xwritehexl(long);
-int xwritec(char);
-int xwritecr(void);
-int xwritedump(void *, long, int);
int xinfdump(long, void *, int);
# define debug(level, expr...) debug_(level, __FILE__, __LINE__, DEBUG_FUNCTION, expr)
diff --git a/display_args.c b/display_args.c
index 08c735a..bd050e7 100644
--- a/display_args.c
+++ b/display_args.c
@@ -176,12 +176,10 @@ int display_value(enum tof type, struct process *proc,
switch (info->type) {
case ARGTYPE_VOID:
return 0;
- case ARGTYPE_IGNORE:
- return 0; /* Empty gap between commas */
case ARGTYPE_INT:
- return fprintf(output, "%d", (int) value);
+ return fprintf(output, "%d", (int) value);
case ARGTYPE_UINT:
- return fprintf(output, "%u", (unsigned) value);
+ return fprintf(output, "%u", (unsigned) value);
case ARGTYPE_LONG:
if (proc->mask_32bit)
return fprintf(output, "%d", (int) value);
diff --git a/etc/ltrace.conf b/etc/ltrace.conf
index 1fe808e..96dc807 100644
--- a/etc/ltrace.conf
+++ b/etc/ltrace.conf
@@ -25,7 +25,6 @@
; string[retval] == (char *) [show only up to (return val) bytes]
; string[arg0] == (char *) [same as string[retval]]
; string[N] == (char *) [N>0] [show only up to N bytes]
-; ignore == (any) [ignore arg, output blank]
; type* == (type *) [pointer to any other type]
; enum (key=value,key=value,...) [enumeration, see below]
; array(type,argN)
@@ -525,3 +524,81 @@ int SYS_flistxattr(int,addr,uint);
int SYS_removexattr(string,string);
int SYS_lremovexattr(string,string);
int SYS_fremovexattr(int,string);
+int SYS_chdir(string);
+int SYS_fchdir(int);
+int SYS_chmod(string,octal);
+int SYS_fchmod(int,octal);
+int SYS_chown(string,int,int);
+int SYS_fchown(int,int,int);
+int SYS_lchown(string,int,int);
+int SYS_chroot(string);
+int SYS_dup(int);
+int SYS_dup2(int,int);
+int SYS_fdatasync(int);
+int SYS_fsync(int);
+int SYS_getpriority(int,int);
+int SYS_setpriority(int,int,int);
+int SYS_getrlimit(int,addr);
+int SYS_setrlimit(int,addr);
+int SYS_gettimeofday(addr,addr);
+int SYS_settimeofday(addr,addr);
+int SYS_setfsgid(int);
+int SYS_setfsuid(int);
+int SYS_getuid(void);
+int SYS_setuid(int);
+int SYS_getgid(void);
+int SYS_setgid(int);
+int SYS_getsid(int);
+int SYS_setsid(int);
+int SYS_setreuid(int,int);
+int SYS_setregid(int,int);
+int SYS_geteuid(void);
+int SYS_getegid(void);
+int SYS_setpgid(int,int);
+int SYS_getresuid(addr,addr,addr);
+int SYS_setresuid(int,int,int);
+int SYS_getresgid(addr,addr,addr);
+int SYS_setresgid(int,int,int);
+int SYS_kill(int,int);
+int SYS_link(string,string);
+int SYS_madvise(addr,ulong,int);
+int SYS_mkdir(string,octal);
+int SYS_mknod(string,octal,int);
+int SYS_msync(addr,ulong,int);
+int SYS_nice(int);
+int SYS_poll(addr,uint,int);
+int SYS_readdir(uint,addr,uint);
+int SYS_readlink(string,string,ulong);
+int SYS_reboot(int,int,int,addr);
+int SYS_rename(string,string);
+int SYS_rmdir(string);
+int SYS_sigaltstack(addr,addr);
+int SYS_statfs(string,addr);
+int SYS_fstatfs(int,addr);
+int SYS_fstat(int,addr);
+int SYS_lstat(string,addr);
+int SYS_stime(addr);
+int SYS_symlink(string, string);
+int SYS_sysinfo(addr);
+int SYS_syslog(int,string,int);
+int SYS_truncate(string,long);
+int SYS_ftruncate(int,long);
+int SYS_mount(string,string,string,ulong,addr);
+int SYS_umount(string);
+int SYS_umount2(string,int);
+int SYS_unlink(string);
+int SYS_utime(string,addr);
+long SYS_lseek(int,long,int);
+addr SYS_signal(int,addr);
+int SYS_sigaction(int,addr,addr);
+int SYS_pause(void);
+int SYS_sigpending(addr);
+int SYS_sigprocmask(int,addr,addr);
+int SYS_sigqueue(int,int,addr);
+int SYS_sigsuspend(addr);
+int SYS_wait(addr);
+int SYS_waitpid(int,addr,int);
+ulong SYS_readv(int,addr,int);
+ulong SYS_writev(int,addr,int);
+int SYS_mprotect(addr,int,int);
+int SYS_access(string,octal);
diff --git a/ltrace.1 b/ltrace.1
index 30f51e8..1a32df8 100644
--- a/ltrace.1
+++ b/ltrace.1
@@ -80,7 +80,7 @@ Print the instruction pointer at the time of the library call.
.I \-l, \-\-library filename
Display only the symbols included in the library
.I filename.
-Up to 20 library names can be specified with several instances
+Up to 30 library names can be specified with several instances
of this option.
.TP
.I \-L
diff --git a/ltrace.c b/ltrace.c
index 881ebc1..3c7d661 100644
--- a/ltrace.c
+++ b/ltrace.c
@@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <pwd.h>
#include <string.h>
#include <errno.h>
#include <sys/param.h>
@@ -37,7 +36,8 @@ static void signal_alarm(int sig)
if (!tmp) {
return;
}
- break;
+ tmp2 = opt_p;
+ continue;
}
tmp2 = tmp2->next;
}
@@ -51,6 +51,10 @@ static void signal_exit(int sig)
{
exiting = 1;
debug(1, "Received interrupt signal; exiting...");
+ if (opt_o) {
+ fclose(output);
+ opt_o = 0;
+ }
signal(SIGINT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
signal(SIGALRM, signal_alarm);
@@ -71,6 +75,9 @@ static void normal_exit(void)
if (opt_c) {
show_summary();
}
+ if (opt_o) {
+ fclose(output);
+ }
}
static void guess_cols(void)
@@ -102,24 +109,24 @@ int main(int argc, char **argv)
guess_cols();
argv = process_options(argc, argv);
- while (opt_F) {
- /* If filename begins with ~, expand it to the user's home */
- /* directory. This does not correctly handle ~yoda, but that */
- /* isn't as bad as it seems because the shell will normally */
- /* be doing the expansion for us; only the hardcoded */
- /* ~/.ltrace.conf should ever use this code. */
- if (opt_F->filename[0] == '~') {
- char path[PATH_MAX];
- char *home_dir = getpwuid(geteuid())->pw_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);
- }
- opt_F = opt_F->next;
+ while (opt_F) {
+ /* If filename begins with ~, expand it to the user's home */
+ /* directory. This does not correctly handle ~yoda, but that */
+ /* isn't as bad as it seems because the shell will normally */
+ /* be doing the expansion for us; only the hardcoded */
+ /* ~/.ltrace.conf should ever use this code. */
+ 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);
+ } else {
+ read_config_file(opt_F->filename);
+ }
+ opt_F = opt_F->next;
}
if (opt_e) {
struct opt_e_t *tmp = opt_e;
diff --git a/ltrace.h b/ltrace.h
index fa24f6e..5763645 100644
--- a/ltrace.h
+++ b/ltrace.h
@@ -46,59 +46,58 @@ enum arg_type {
ARGTYPE_FORMAT, /* printf-like format */
ARGTYPE_STRING, /* NUL-terminated string */
ARGTYPE_STRING_N, /* String of known maxlen */
- ARGTYPE_ARRAY, /* Series of values in memory */
- ARGTYPE_ENUM, /* Enumeration */
- ARGTYPE_STRUCT, /* Structure of values */
- ARGTYPE_IGNORE, /* Leave parameter blank */
- ARGTYPE_POINTER, /* Pointer to some other type */
- ARGTYPE_COUNT /* number of ARGTYPE_* values */
+ ARGTYPE_ARRAY, /* Series of values in memory */
+ ARGTYPE_ENUM, /* Enumeration */
+ ARGTYPE_STRUCT, /* Structure of values */
+ ARGTYPE_POINTER, /* Pointer to some other type */
+ ARGTYPE_COUNT /* number of ARGTYPE_* values */
};
typedef struct arg_type_info_t {
- enum arg_type type;
- int arg_num;
- union {
- // ARGTYPE_ENUM
- struct {
- size_t entries;
- char **keys;
- int *values;
- } enum_info;
-
- // ARGTYPE_ARRAY
- struct {
- struct arg_type_info_t *elt_type;
- size_t elt_size;
- int len_spec;
- } array_info;
-
- // ARGTYPE_STRING_N
- struct {
- int size_spec;
- } string_n_info;
-
- // ARGTYPE_STRUCT
- struct {
- struct arg_type_info_t **fields; // NULL-terminated
- size_t *offset;
- size_t size;
- } struct_info;
-
- // ARGTYPE_POINTER
- struct {
- struct arg_type_info_t *info;
- } ptr_info;
-
- // ARGTYPE_FLOAT
- struct {
- size_t float_index;
- } float_info;
-
- // ARGTYPE_DOUBLE
- struct {
- size_t float_index;
- } double_info;
- } u;
+ enum arg_type type;
+ int arg_num;
+ union {
+ // ARGTYPE_ENUM
+ struct {
+ size_t entries;
+ char **keys;
+ int *values;
+ } enum_info;
+
+ // ARGTYPE_ARRAY
+ struct {
+ struct arg_type_info_t *elt_type;
+ size_t elt_size;
+ int len_spec;
+ } array_info;
+
+ // ARGTYPE_STRING_N
+ struct {
+ int size_spec;
+ } string_n_info;
+
+ // ARGTYPE_STRUCT
+ struct {
+ struct arg_type_info_t **fields; // NULL-terminated
+ size_t *offset;
+ size_t size;
+ } struct_info;
+
+ // ARGTYPE_POINTER
+ struct {
+ struct arg_type_info_t *info;
+ } ptr_info;
+
+ // ARGTYPE_FLOAT
+ struct {
+ size_t float_index;
+ } float_info;
+
+ // ARGTYPE_DOUBLE
+ struct {
+ size_t float_index;
+ } double_info;
+ } u;
} arg_type_info;
enum tof {
diff --git a/options.c b/options.c
index ffe0f34..d112f3c 100644
--- a/options.c
+++ b/options.c
@@ -29,12 +29,12 @@ char *library[MAX_LIBRARY];
int library_num = 0;
static char *progname; /* Program name (`ltrace') */
FILE *output;
-int opt_a = DEFAULT_ACOLUMN; /* default alignment column for results */
-int opt_A = DEFAULT_ARRAYLEN; /* default maximum # array elements to print */
-int opt_c = 0; /* Count time, calls, and report a summary on program exit */
+int opt_a = DEFAULT_ACOLUMN; /* alignment column for results */
+int opt_A = DEFAULT_ARRAYLEN; /* maximum # array elements to print */
+int opt_c = 0; /* Report a summary on program exit */
int opt_d = 0; /* debug */
int opt_i = 0; /* instruction pointer */
-int opt_s = DEFAULT_STRLEN; /* default maximum # of bytes printed in strings */
+int opt_s = DEFAULT_STRLEN; /* maximum # of bytes printed in strings */
int opt_S = 0; /* display syscalls */
int opt_L = 1; /* display library calls */
int opt_f = 0; /* trace child processes as they are created */
@@ -42,10 +42,11 @@ char *opt_u = NULL; /* username to run command as */
int opt_r = 0; /* print relative timestamp */
int opt_t = 0; /* print absolute timestamp */
#ifdef USE_DEMANGLE
-int opt_C = 0; /* Demangle low-level symbol names into user-level names */
+int opt_C = 0; /* Demangle low-level symbol names */
#endif
-int opt_n = 0; /* indent trace output according to program flow */
+int opt_n = 0; /* indent output according to program flow */
int opt_T = 0; /* show the time spent inside each call */
+int opt_o = 0; /* output to a specific file */
/* List of pids given to option -p: */
struct opt_p_t *opt_p = NULL; /* attach to process with a given pid */
@@ -79,7 +80,7 @@ static void usage(void)
# else
" -a COLUMN align return values in a secific column.\n"
# endif
- " -A ARRAYLEN maximum number of array elements to print.\n"
+ " -A ARRAYLEN maximum number of array elements to print.\n"
" -c count time and calls, and report a summary on exit.\n"
# ifdef USE_DEMANGLE
# if HAVE_GETOPT_LONG
@@ -96,11 +97,11 @@ static void usage(void)
" -e expr modify which events to trace.\n"
" -f follow forks.\n"
# if HAVE_GETOPT_LONG
- " -F, --config=FILE load alternate configuration file\n"
+ " -F, --config=FILE load alternate configuration file\n"
# else
- " -F FILE load alternate configuration file\n"
+ " -F FILE load alternate configuration file\n"
# endif
- " (can be repeated).\n"
+ " (can be repeated).\n"
# if HAVE_GETOPT_LONG
" -h, --help display this help and exit.\n"
# else
@@ -188,7 +189,7 @@ char **process_options(int argc, char **argv)
int option_index = 0;
static struct option long_options[] = {
{"align", 1, 0, 'a'},
- {"config", 1, 0, 'F'},
+ {"config", 1, 0, 'F'},
{"debug", 0, 0, 'd'},
# ifdef USE_DEMANGLE
{"demangle", 0, 0, 'C'},
@@ -209,9 +210,9 @@ char **process_options(int argc, char **argv)
#else
c = getopt(argc, argv, "+cdfhiLrStTV"
# ifdef USE_DEMANGLE
- "C"
+ "C"
# endif
- "a:A:e:F:l:n:o:p:s:u:x:X:");
+ "a:A:e:F:l:n:o:p:s:u:x:X:");
#endif
if (c == -1) {
break;
@@ -220,7 +221,7 @@ char **process_options(int argc, char **argv)
case 'a':
opt_a = atoi(optarg);
break;
- case 'A':
+ case 'A':
opt_A = atoi(optarg);
break;
case 'c':
@@ -270,18 +271,18 @@ char **process_options(int argc, char **argv)
case 'f':
opt_f = 1;
break;
- case 'F':
- {
- struct opt_F_t *tmp = malloc(sizeof(struct opt_F_t));
- if (!tmp) {
- perror("ltrace: malloc");
- exit(1);
- }
- tmp->filename = strdup(optarg);
- tmp->next = opt_F;
- opt_F = tmp;
- break;
- }
+ case 'F':
+ {
+ struct opt_F_t *tmp = malloc(sizeof(struct opt_F_t));
+ if (!tmp) {
+ perror("ltrace: malloc");
+ exit(1);
+ }
+ tmp->filename = strdup(optarg);
+ tmp->next = opt_F;
+ opt_F = tmp;
+ break;
+ }
case 'h':
usage();
exit(0);
@@ -304,6 +305,7 @@ char **process_options(int argc, char **argv)
opt_n = atoi(optarg);
break;
case 'o':
+ opt_o++;
output = fopen(optarg, "w");
if (!output) {
fprintf(stderr,
@@ -316,8 +318,7 @@ char **process_options(int argc, char **argv)
break;
case 'p':
{
- struct opt_p_t *tmp =
- malloc(sizeof(struct opt_p_t));
+ struct opt_p_t *tmp = malloc(sizeof(struct opt_p_t));
if (!tmp) {
perror("ltrace: malloc");
exit(1);
@@ -347,15 +348,15 @@ char **process_options(int argc, char **argv)
break;
case 'V':
printf("ltrace version " PACKAGE_VERSION ".\n"
- "Copyright (C) 1997-2006 Juan Cespedes <cespedes@debian.org>.\n"
- "This is free software; see the GNU General Public Licence\n"
- "version 2 or later for copying conditions. There is NO warranty.\n");
+ "Copyright (C) 1997-2007 Juan Cespedes <cespedes@debian.org>.\n"
+ "This is free software; see the GNU General Public Licence\n"
+ "version 2 or later for copying conditions. There is NO warranty.\n");
exit(0);
case 'X':
#ifdef PLT_REINITALISATION_BP
PLTs_initialized_by_here = optarg;
#else
- fprintf(stderr, "WANRING: \"-X\" not used for this "
+ fprintf(stderr, "WARNING: \"-X\" not used for this "
"architecture: assuming you meant \"-x\"\n");
#endif
/* Fall Thru */
@@ -401,27 +402,27 @@ char **process_options(int argc, char **argv)
argv += optind;
#endif
- if (!opt_F) {
- opt_F = malloc(sizeof(struct opt_F_t));
- opt_F->next = malloc(sizeof(struct opt_F_t));
- opt_F->next->next = NULL;
- opt_F->filename = USER_CONFIG_FILE;
- opt_F->next->filename = SYSTEM_CONFIG_FILE;
- }
+ if (!opt_F) {
+ opt_F = malloc(sizeof(struct opt_F_t));
+ opt_F->next = malloc(sizeof(struct opt_F_t));
+ opt_F->next->next = NULL;
+ opt_F->filename = USER_CONFIG_FILE;
+ opt_F->next->filename = SYSTEM_CONFIG_FILE;
+ }
/* Reverse the config file list since it was built by
* prepending, and it would make more sense to process the
* files in the order they were given. Probably it would make
* more sense to keep a tail pointer instead? */
{
- struct opt_F_t *egg = NULL;
- struct opt_F_t *chicken;
- while (opt_F) {
- chicken = opt_F->next;
- opt_F->next = egg;
- egg = opt_F;
- opt_F = chicken;
- }
- opt_F = egg;
+ struct opt_F_t *egg = NULL;
+ struct opt_F_t *chicken;
+ while (opt_F) {
+ chicken = opt_F->next;
+ opt_F->next = egg;
+ egg = opt_F;
+ opt_F = chicken;
+ }
+ opt_F = egg;
}
if (!opt_p && argc < 1) {
diff --git a/options.h b/options.h
index 9ead6f3..da5c5aa 100644
--- a/options.h
+++ b/options.h
@@ -21,6 +21,7 @@ extern int opt_t; /* print absolute timestamp */
extern int opt_C; /* Demanglelow-level symbol names into user-level names */
extern int opt_n; /* indent trace output according to program flow */
extern int opt_T; /* show the time spent inside each call */
+extern int opt_o; /* output to a specific file */
struct opt_p_t {
pid_t pid;
diff --git a/proc.c b/proc.c
index a5f046b..fa8acc9 100644
--- a/proc.c
+++ b/proc.c
@@ -56,6 +56,6 @@ void open_pid(pid_t pid, int verbose)
#endif
proc = open_program(filename, pid);
- continue_process (pid);
+ continue_process(pid);
proc->breakpoints_enabled = 1;
}
diff --git a/process_event.c b/process_event.c
index fb2089f..c770647 100644
--- a/process_event.c
+++ b/process_event.c
@@ -185,7 +185,9 @@ static void process_syscall(struct event *event)
output_left(LT_TOF_SYSCALL, event->proc,
sysname(event->proc, event->e_un.sysnum));
}
- if (event->proc->breakpoints_enabled == 0) {
+ if (fork_p(event->proc, event->e_un.sysnum)) {
+ disable_all_breakpoints(event->proc);
+ } else if (event->proc->breakpoints_enabled == 0) {
enable_all_breakpoints(event->proc);
}
callstack_push_syscall(event->proc, event->e_un.sysnum);
diff --git a/read_config_file.c b/read_config_file.c
index 3c7c971..6c42ca5 100644
--- a/read_config_file.c
+++ b/read_config_file.c
@@ -44,7 +44,6 @@ static struct list_of_pt_t {
"array", ARGTYPE_ARRAY}, {
"struct", ARGTYPE_STRUCT}, {
"enum", ARGTYPE_ENUM}, {
- "ignore", ARGTYPE_IGNORE}, {
NULL, ARGTYPE_UNKNOWN} /* Must finish with NULL */
};
@@ -71,7 +70,6 @@ static arg_type_info arg_type_prototypes[] = {
{ ARGTYPE_ARRAY },
{ ARGTYPE_ENUM },
{ ARGTYPE_STRUCT },
- { ARGTYPE_IGNORE },
{ ARGTYPE_POINTER },
{ ARGTYPE_UNKNOWN }
};
@@ -590,7 +588,7 @@ static struct function *process_line(char *buf)
eat_spaces(&str);
fun.return_info = parse_type(&str);
if (fun.return_info == NULL)
- return NULL;
+ return NULL;
if (fun.return_info->type == ARGTYPE_UNKNOWN) {
debug(3, " Skipping line %d", line_no);
return NULL;
@@ -661,13 +659,13 @@ void read_config_file(char *file)
char buf[1024];
filename = file;
-
- debug(1, "Reading config file `%s'...", filename);
-
stream = fopen(filename, "r");
if (!stream) {
return;
}
+
+ debug(1, "Reading config file `%s'...", filename);
+
line_no = 0;
while (fgets(buf, 1024, stream)) {
struct function *tmp;
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index 466c0c2..38b4839 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -150,15 +150,6 @@ int trace_pid(pid_t pid)
return -1;
}
- /* man ptrace: PTRACE_ATTACH attaches to the process specified
- in pid. The child is sent a SIGSTOP, but will not
- necessarily have stopped by the completion of this call;
- use wait() to wait for the child to stop. */
- if (waitpid (pid, NULL, 0) != pid) {
- perror ("trace_pid: waitpid");
- exit (1);
- }
-
return 0;
}
diff --git a/testsuite/ltrace.main/parameters.c b/testsuite/ltrace.main/parameters.c
index d0fa483..dd63612 100644
--- a/testsuite/ltrace.main/parameters.c
+++ b/testsuite/ltrace.main/parameters.c
@@ -12,7 +12,6 @@
#include <string.h>
#include <stdlib.h>
-void func_ignore(int a, int b, int c);
void func_intptr(int *i);
void func_intptr_ret(int *i);
int func_strlen(char*);
@@ -46,8 +45,6 @@ main ()
int *ai;
float *af;
- func_ignore(1, 2, 3);
-
func_intptr(&x);
func_intptr_ret(&x);
diff --git a/testsuite/ltrace.main/parameters.conf b/testsuite/ltrace.main/parameters.conf
index e8bd3e2..33c1a1e 100644
--- a/testsuite/ltrace.main/parameters.conf
+++ b/testsuite/ltrace.main/parameters.conf
@@ -1,4 +1,3 @@
-void func_ignore(int,ignore,int)
void func_intptr(int*)
void func_intptr_ret(+int*)
int func_strlen(+string[retval])
@@ -11,6 +10,6 @@ void func_ushort(ushort, ushort)
void func_float(float,float)
typedef color = enum (RED=0,GREEN=1,BLUE=2,CHARTREUSE=3,PETUNIA=4)
void func_typedef(color)
-void func_arrayi(array(int,arg2)*,ignore)
-void func_arrayf(array(float,arg2)*,ignore)
+void func_arrayi(array(int,arg2)*,void)
+void func_arrayf(array(float,arg2)*,void)
void func_struct(struct(int,int,int,array(struct(int,int),elt2)*,array(struct(int,int),3),string[elt3])*)
diff --git a/testsuite/ltrace.main/parameters.exp b/testsuite/ltrace.main/parameters.exp
index f07c296..bb55e03 100644
--- a/testsuite/ltrace.main/parameters.exp
+++ b/testsuite/ltrace.main/parameters.exp
@@ -36,8 +36,6 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
}
# Verify the output
-set pattern "func_ignore(1, *, *3)"
-ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_intptr(17)"
ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1
set pattern "func_intptr_ret(42)"
diff --git a/testsuite/ltrace.minor/attach-process.exp b/testsuite/ltrace.minor/attach-process.exp
index ac6d37e..ab5460e 100644
--- a/testsuite/ltrace.minor/attach-process.exp
+++ b/testsuite/ltrace.minor/attach-process.exp
@@ -17,7 +17,7 @@ catch "exec $srcdir/$subdir/$binfile &" output
regexp {([0-9]+)} $output match PID
verbose "PID = $PID"
-# Run PUT for ltarce.
+# Run PUT for ltrace.
global LTRACE
catch "exec $LTRACE -S -p $PID -o ${srcdir}/${subdir}/${testfile}.ltrace" exec_output
diff --git a/testsuite/ltrace.minor/count-record.exp b/testsuite/ltrace.minor/count-record.exp
index 7150568..f8c4923 100644
--- a/testsuite/ltrace.minor/count-record.exp
+++ b/testsuite/ltrace.minor/count-record.exp
@@ -13,7 +13,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
# set options for ltrace.
ltrace_options "-c"
-# Run PUT for ltarce.
+# Run PUT for ltrace.
set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
# Check the output of this program.
diff --git a/testsuite/ltrace.minor/demangle.exp b/testsuite/ltrace.minor/demangle.exp
index 797353d..5077ac0 100644
--- a/testsuite/ltrace.minor/demangle.exp
+++ b/testsuite/ltrace.minor/demangle.exp
@@ -21,7 +21,7 @@ if { [ltrace_compile_shlib $libsrc $lib_sl [list debug c++]] != ""
# set options for ltrace.
ltrace_options "-C"
-# Run PUT for ltarce.
+# Run PUT for ltrace.
set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
# Check the output of this program.
diff --git a/testsuite/ltrace.minor/print-instruction-pointer.exp b/testsuite/ltrace.minor/print-instruction-pointer.exp
index ff505ae..87cc8f7 100644
--- a/testsuite/ltrace.minor/print-instruction-pointer.exp
+++ b/testsuite/ltrace.minor/print-instruction-pointer.exp
@@ -13,7 +13,7 @@ if { [ltrace_compile "${srcdir}/${subdir}/${srcfile}" "${srcdir}/${subdir}/${bin
# set options for ltrace.
ltrace_options "-i"
-# Run PUT for ltarce.
+# Run PUT for ltrace.
set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
# Check the output of this program.
diff --git a/testsuite/ltrace.minor/time-record-T.exp b/testsuite/ltrace.minor/time-record-T.exp
index db7f797..b411add 100644
--- a/testsuite/ltrace.minor/time-record-T.exp
+++ b/testsuite/ltrace.minor/time-record-T.exp
@@ -13,7 +13,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
# set options for ltrace.
ltrace_options "-T"
-# Run PUT for ltarce.
+# Run PUT for ltrace.
set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
verbose "ltrace runtest output: $exec_output\n"
diff --git a/testsuite/ltrace.minor/time-record-tt.exp b/testsuite/ltrace.minor/time-record-tt.exp
index 3d40523..332704a 100644
--- a/testsuite/ltrace.minor/time-record-tt.exp
+++ b/testsuite/ltrace.minor/time-record-tt.exp
@@ -13,7 +13,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
# Set options for ltrace.
ltrace_options "-tt"
-# Run PUT for ltarce.
+# Run PUT for ltrace.
set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
# Check the output of this program.
diff --git a/testsuite/ltrace.minor/time-record-ttt.exp b/testsuite/ltrace.minor/time-record-ttt.exp
index cd24e0f..2aee9d3 100644
--- a/testsuite/ltrace.minor/time-record-ttt.exp
+++ b/testsuite/ltrace.minor/time-record-ttt.exp
@@ -13,7 +13,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
# Set options for ltrace.
ltrace_options "-ttt"
-# Run PUT for ltarce.
+# Run PUT for ltrace.
set exec_output [ltrace_runtest $srcdir/$subdir $srcdir/$subdir/$binfile]
diff --git a/testsuite/ltrace.minor/trace-clone.c b/testsuite/ltrace.minor/trace-clone.c
index 91a27a5..e3c5f39 100644
--- a/testsuite/ltrace.minor/trace-clone.c
+++ b/testsuite/ltrace.minor/trace-clone.c
@@ -11,6 +11,7 @@
int child ()
{
+ sleep(1);
return 0;
}
diff --git a/testsuite/ltrace.minor/trace-clone.exp b/testsuite/ltrace.minor/trace-clone.exp
index efd2ed2..bda036f 100644
--- a/testsuite/ltrace.minor/trace-clone.exp
+++ b/testsuite/ltrace.minor/trace-clone.exp
@@ -12,7 +12,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
}
global LTRACE
-#Run PUT for ltarce.
+#Run PUT for ltrace.
spawn $LTRACE -f $srcdir/$subdir/$binfile
set timeout 4
expect timeout {
diff --git a/testsuite/ltrace.minor/trace-exec.exp b/testsuite/ltrace.minor/trace-exec.exp
index 096c9fc..c9de6f3 100644
--- a/testsuite/ltrace.minor/trace-exec.exp
+++ b/testsuite/ltrace.minor/trace-exec.exp
@@ -15,15 +15,15 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}1.c" "${srcdir}/${subdir}
global LTRACE
set exec_output ""
-#Run PUT for ltarce.
-spawn $LTRACE -f $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1
+#Run PUT for ltrace.
+spawn $LTRACE $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1
set timeout 4
expect timeout {
fail "Time out! Maybe caused by ltrace segment fault or improper timeout value here!"
return
}
-catch "exec $LTRACE -f $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1" exec_output
+catch "exec $LTRACE $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1" exec_output
#check the output of this program.
verbose "ltrace runtest output: $exec_output\n"
diff --git a/testsuite/ltrace.minor/trace-fork.exp b/testsuite/ltrace.minor/trace-fork.exp
index a66b8dc..5f30061 100644
--- a/testsuite/ltrace.minor/trace-fork.exp
+++ b/testsuite/ltrace.minor/trace-fork.exp
@@ -13,7 +13,7 @@ if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/
global LTRACE
set exec_output ""
-#Run PUT for ltarce.
+#Run PUT for ltrace.
spawn $LTRACE -f $srcdir/$subdir/$binfile
set timeout 4
expect timeout {