diff options
-rw-r--r-- | KK | 489 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | display_args.c | 24 | ||||
-rw-r--r-- | etc/ltrace.conf | 36 |
5 files changed, 534 insertions, 24 deletions
@@ -0,0 +1,489 @@ +Reading config file `/etc/ltrace.conf'... +Reading line 1 of `/etc/ltrace.conf' + Skipping line 1 +Reading line 2 of `/etc/ltrace.conf' + Skipping line 2 +Reading line 3 of `/etc/ltrace.conf' + Skipping line 3 +Reading line 4 of `/etc/ltrace.conf' + Skipping line 4 +Reading line 5 of `/etc/ltrace.conf' + Skipping line 5 +Reading line 6 of `/etc/ltrace.conf' + Skipping line 6 +Reading line 7 of `/etc/ltrace.conf' + Skipping line 7 +Reading line 8 of `/etc/ltrace.conf' + Skipping line 8 +Reading line 9 of `/etc/ltrace.conf' + Skipping line 9 +Reading line 10 of `/etc/ltrace.conf' + Skipping line 10 +Reading line 11 of `/etc/ltrace.conf' + Skipping line 11 +Reading line 12 of `/etc/ltrace.conf' + Skipping line 12 +Reading line 13 of `/etc/ltrace.conf' + Skipping line 13 +Reading line 14 of `/etc/ltrace.conf' + Skipping line 14 +Reading line 15 of `/etc/ltrace.conf' + Skipping line 15 +Reading line 16 of `/etc/ltrace.conf' + Skipping line 16 +Reading line 17 of `/etc/ltrace.conf' + name = __errno_location +New function: `__errno_location' +Reading line 18 of `/etc/ltrace.conf' + Skipping line 18 +Reading line 19 of `/etc/ltrace.conf' + Skipping line 19 +Reading line 20 of `/etc/ltrace.conf' + name = open +New function: `open' +Reading line 21 of `/etc/ltrace.conf' + Skipping line 21 +Reading line 22 of `/etc/ltrace.conf' + Skipping line 22 +Reading line 23 of `/etc/ltrace.conf' + name = getopt_long +New function: `getopt_long' +Reading line 24 of `/etc/ltrace.conf' + Skipping line 24 +Reading line 25 of `/etc/ltrace.conf' + Skipping line 25 +Reading line 26 of `/etc/ltrace.conf' + name = bindtextdomain +New function: `bindtextdomain' +Reading line 27 of `/etc/ltrace.conf' + name = textdomain +New function: `textdomain' +Reading line 28 of `/etc/ltrace.conf' + Skipping line 28 +Reading line 29 of `/etc/ltrace.conf' + Skipping line 29 +Reading line 30 of `/etc/ltrace.conf' + name = _IO_putc +New function: `_IO_putc' +Reading line 31 of `/etc/ltrace.conf' + Skipping line 31 +Reading line 32 of `/etc/ltrace.conf' + Skipping line 32 +Reading line 33 of `/etc/ltrace.conf' + name = setlocale +New function: `setlocale' +Reading line 34 of `/etc/ltrace.conf' + Skipping line 34 +Reading line 35 of `/etc/ltrace.conf' + Skipping line 35 +Reading line 36 of `/etc/ltrace.conf' + name = fclose +New function: `fclose' +Reading line 37 of `/etc/ltrace.conf' + name = fgets +New function: `fgets' +Reading line 38 of `/etc/ltrace.conf' + name = fprintf +New function: `fprintf' +Reading line 39 of `/etc/ltrace.conf' + name = fputs +New function: `fputs' +Reading line 40 of `/etc/ltrace.conf' + name = printf +New function: `printf' +Reading line 41 of `/etc/ltrace.conf' + Skipping line 41 +Reading line 42 of `/etc/ltrace.conf' + Skipping line 42 +Reading line 43 of `/etc/ltrace.conf' + name = close +New function: `close' +Reading line 44 of `/etc/ltrace.conf' + name = fork +New function: `fork' +Reading line 45 of `/etc/ltrace.conf' + name = geteuid +New function: `geteuid' +Reading line 46 of `/etc/ltrace.conf' + name = gethostname +New function: `gethostname' +Reading line 47 of `/etc/ltrace.conf' + name = mkdir +New function: `mkdir' +Reading line 48 of `/etc/ltrace.conf' + name = read +New function: `read' +Reading line 49 of `/etc/ltrace.conf' + name = sethostname +New function: `sethostname' +Reading line 50 of `/etc/ltrace.conf' + name = sleep +New function: `sleep' +Reading line 51 of `/etc/ltrace.conf' + name = sync +New function: `sync' +Reading line 52 of `/etc/ltrace.conf' + name = write +New function: `write' +Reading line 53 of `/etc/ltrace.conf' + Skipping line 53 +Reading line 54 of `/etc/ltrace.conf' + Skipping line 54 +Reading line 55 of `/etc/ltrace.conf' + name = atexit +New function: `atexit' +Reading line 56 of `/etc/ltrace.conf' + name = exit +New function: `exit' +Reading line 57 of `/etc/ltrace.conf' + name = free +New function: `free' +Reading line 58 of `/etc/ltrace.conf' + name = malloc +New function: `malloc' +Reading line 59 of `/etc/ltrace.conf' + Skipping line 59 +Reading line 60 of `/etc/ltrace.conf' + Skipping line 60 +Reading line 61 of `/etc/ltrace.conf' + name = memset +New function: `memset' +Reading line 62 of `/etc/ltrace.conf' + name = rindex +New function: `rindex' +Reading line 63 of `/etc/ltrace.conf' + name = strcmp +New function: `strcmp' +Reading line 64 of `/etc/ltrace.conf' + name = strcpy +New function: `strcpy' +Reading line 65 of `/etc/ltrace.conf' + name = strdup +New function: `strdup' +Reading line 66 of `/etc/ltrace.conf' + name = strncmp +New function: `strncmp' +Reading line 67 of `/etc/ltrace.conf' + name = strncpy +New function: `strncpy' +Reading line 68 of `/etc/ltrace.conf' + name = strrchr +New function: `strrchr' +Reading line 69 of `/etc/ltrace.conf' + name = strstr +New function: `strstr' +Reading line 70 of `/etc/ltrace.conf' + Skipping line 70 +Reading line 71 of `/etc/ltrace.conf' + Skipping line 71 +Reading line 72 of `/etc/ltrace.conf' + name = time +New function: `time' +Reading line 73 of `/etc/ltrace.conf' + Skipping line 73 +Reading line 74 of `/etc/ltrace.conf' + Skipping line 74 +Reading line 75 of `/etc/ltrace.conf' + name = SYS_brk +New function: `SYS_brk' +Reading line 76 of `/etc/ltrace.conf' + name = SYS_close +New function: `SYS_close' +Reading line 77 of `/etc/ltrace.conf' + name = SYS_execve +New function: `SYS_execve' +Reading line 78 of `/etc/ltrace.conf' + name = SYS_exit +New function: `SYS_exit' +Reading line 79 of `/etc/ltrace.conf' + name = SYS_fork +New function: `SYS_fork' +Reading line 80 of `/etc/ltrace.conf' + name = SYS_getpid +New function: `SYS_getpid' +Reading line 81 of `/etc/ltrace.conf' + Skipping line 81 +Reading line 82 of `/etc/ltrace.conf' + name = SYS_munmap +New function: `SYS_munmap' +Reading line 83 of `/etc/ltrace.conf' + name = SYS_open +New function: `SYS_open' +Reading line 84 of `/etc/ltrace.conf' + name = SYS_personality +New function: `SYS_personality' +Reading line 85 of `/etc/ltrace.conf' + name = SYS_read +New function: `SYS_read' +Reading line 86 of `/etc/ltrace.conf' + name = SYS_write +New function: `SYS_write' +Reading line 87 of `/etc/ltrace.conf' + name = SYS_sync +New function: `SYS_sync' +Reading config file `/home/cespedes/.ltrace.conf'... +Reading line 1 of `/home/cespedes/.ltrace.conf' + Skipping line 1 +Reading line 2 of `/home/cespedes/.ltrace.conf' + Skipping line 2 +Reading line 3 of `/home/cespedes/.ltrace.conf' + Skipping line 3 +Reading line 4 of `/home/cespedes/.ltrace.conf' + Skipping line 4 +Reading line 5 of `/home/cespedes/.ltrace.conf' + Skipping line 5 +Reading line 6 of `/home/cespedes/.ltrace.conf' + Skipping line 6 +Reading line 7 of `/home/cespedes/.ltrace.conf' + Skipping line 7 +Reading line 8 of `/home/cespedes/.ltrace.conf' + Skipping line 8 +Reading line 9 of `/home/cespedes/.ltrace.conf' + Skipping line 9 +Reading line 10 of `/home/cespedes/.ltrace.conf' + Skipping line 10 +Reading line 11 of `/home/cespedes/.ltrace.conf' + Skipping line 11 +Reading line 12 of `/home/cespedes/.ltrace.conf' + Skipping line 12 +Reading line 13 of `/home/cespedes/.ltrace.conf' + Skipping line 13 +Reading line 14 of `/home/cespedes/.ltrace.conf' + Skipping line 14 +Reading line 15 of `/home/cespedes/.ltrace.conf' + Skipping line 15 +Reading line 16 of `/home/cespedes/.ltrace.conf' + Skipping line 16 +Reading line 17 of `/home/cespedes/.ltrace.conf' + name = execlp +New function: `execlp' +Reading line 18 of `/home/cespedes/.ltrace.conf' + Skipping line 18 +Reading line 19 of `/home/cespedes/.ltrace.conf' + Skipping line 19 +Reading line 20 of `/home/cespedes/.ltrace.conf' + name = uname +New function: `uname' +Reading line 21 of `/home/cespedes/.ltrace.conf' + Skipping line 21 +Reading line 22 of `/home/cespedes/.ltrace.conf' + Skipping line 22 +Reading line 23 of `/home/cespedes/.ltrace.conf' + name = SYS_uname +New function: `SYS_uname' +Reading symbol table from /bin/arch... +symtab: 0x400b5184 +symtab_len: 320 +strtab: 0x400b52c4 +addr: 0x0804843c, symbol: "__libc_init_first" +addr: 0x0804845c, symbol: "exit" +addr: 0x0804844c, symbol: "atexit" +addr: 0x0804840c, symbol: "printf" +addr: 0x0804841c, symbol: "perror" +addr: 0x0804842c, symbol: "uname" +Executing `/bin/arch'... +PID=943 +signal from pid 943 +Enabling breakpoints for pid 943... +signal from pid 943 +event: syscall (45) +SYS_brk(NULL <unfinished ...> +signal from pid 943 +event: sysret (45) +<... SYS_brk resumed> ) = 0x08049688 +signal from pid 943 +event: syscall (5) +SYS_open("/etc/ld.so.preload", 0, 010000130160 <unfinished ...> +signal from pid 943 +event: sysret (5) +<... SYS_open resumed> ) = -2 +signal from pid 943 +event: syscall (5) +SYS_open("/usr/lib/miniutils/lib/libc.so.6", 0, 016234672457 <unfinished ...> +signal from pid 943 +event: sysret (5) +<... SYS_open resumed> ) = -2 +signal from pid 943 +event: syscall (5) +SYS_open("/etc/ld.so.cache", 0, 010000130160 <unfinished ...> +signal from pid 943 +event: sysret (5) +<... SYS_open resumed> ) = 6 +signal from pid 943 +event: syscall (108) +SYS_fstat(6, 0xbffff64c, 0x4000b070, 0xbffff6ac, 6 <unfinished ...> +signal from pid 943 +event: sysret (108) +<... SYS_fstat resumed> ) = 0 +signal from pid 943 +event: syscall (90) +SYS_mmap(0xbffff688, 0, 0x4000b070, 1, 6 <unfinished ...> +signal from pid 943 +event: sysret (90) +<... SYS_mmap resumed> ) = 0x4000c000 +signal from pid 943 +event: syscall (6) +SYS_close(6 <unfinished ...> +signal from pid 943 +event: sysret (6) +<... SYS_close resumed> ) = 0 +signal from pid 943 +event: syscall (5) +SYS_open("/lib/libc.so.6", 0, 010000130160 <unfinished ...> +signal from pid 943 +event: sysret (5) +<... SYS_open resumed> ) = 6 +signal from pid 943 +event: syscall (90) +SYS_mmap(0xbffff690, 0xbffff71c, 0x4000b070, 0xbffff71c, 52 <unfinished ...> +signal from pid 943 +event: sysret (90) +<... SYS_mmap resumed> ) = 0x4000f000 +signal from pid 943 +event: syscall (91) +SYS_munmap(0x4000f000, 4096 <unfinished ...> +signal from pid 943 +event: sysret (91) +<... SYS_munmap resumed> ) = 0 +signal from pid 943 +event: syscall (90) +SYS_mmap(0xbffff63c, 0, 0x4000b070, 667384, 6 <unfinished ...> +signal from pid 943 +event: sysret (90) +<... SYS_mmap resumed> ) = 0x4000f000 +signal from pid 943 +event: syscall (125) +SYS_mprotect(0x4009f000, 77560, 0, 0x4000f000, 0x4000b810 <unfinished ...> +signal from pid 943 +event: sysret (125) +<... SYS_mprotect resumed> ) = 0 +signal from pid 943 +event: syscall (90) +SYS_mmap(0xbffff63c, 28672, 0x4000b070, 0x4009f000, 6 <unfinished ...> +signal from pid 943 +event: sysret (90) +<... SYS_mmap resumed> ) = 0x4009f000 +signal from pid 943 +event: syscall (90) +SYS_mmap(0xbffff63c, 0, 0x4000b070, 0x400a6000, 48888 <unfinished ...> +signal from pid 943 +event: sysret (90) +<... SYS_mmap resumed> ) = 0x400a6000 +signal from pid 943 +event: syscall (6) +SYS_close(6 <unfinished ...> +signal from pid 943 +event: sysret (6) +<... SYS_close resumed> ) = 0 +signal from pid 943 +event: syscall (125) +SYS_mprotect(0x4000f000, 589824, 3, 0, -4096 <unfinished ...> +signal from pid 943 +event: sysret (125) +<... SYS_mprotect resumed> ) = 0 +signal from pid 943 +event: syscall (125) +SYS_mprotect(0x4000f000, 589824, 5, 4096, 0x4000f000 <unfinished ...> +signal from pid 943 +event: sysret (125) +<... SYS_mprotect resumed> ) = 0 +signal from pid 943 +event: syscall (136) +SYS_personality(0 <unfinished ...> +signal from pid 943 +event: sysret (136) +<... SYS_personality resumed> ) = 0 +signal from pid 943 +event: syscall (20) +SYS_getpid( <unfinished ...> +signal from pid 943 +event: sysret (20) +<... SYS_getpid resumed> ) = 943 +signal from pid 943 +event: breakpoint (0x0804844c) +atexit(0x40006150 <unfinished ...> +signal from pid 943 +event: breakpoint (0x08048451) +signal from pid 943 +event: breakpoint (0x0804847c) +<... atexit resumed> ) = 0 +signal from pid 943 +event: breakpoint (0x0804843c) +__libc_init_first(1, 0xbffffb76, 0, 0xbffffb80, 0xbffffba8 <unfinished ...> +signal from pid 943 +event: breakpoint (0x08048441) +signal from pid 943 +event: breakpoint (0x08048482) +<... __libc_init_first resumed> ) = 0x40006150 +signal from pid 943 +event: breakpoint (0x0804844c) +atexit(0x08048590 <unfinished ...> +signal from pid 943 +event: breakpoint (0x4002c34f) +signal from pid 943 +event: breakpoint (0x080484a4) +<... atexit resumed> ) = 0 +signal from pid 943 +event: breakpoint (0x0804842c) +uname(0xbffff8f4 <unfinished ...> +signal from pid 943 +event: breakpoint (0x08048431) +signal from pid 943 +event: syscall (122) +SYS_uname(0xbffff8f4 <unfinished ...> +signal from pid 943 +event: sysret (122) +<... SYS_uname resumed> ) = 0 +signal from pid 943 +event: breakpoint (0x0804850e) +<... uname resumed> ) = 0 +signal from pid 943 +event: breakpoint (0x0804840c) +printf("%s\n" <unfinished ...> +signal from pid 943 +event: breakpoint (0x08048411) +signal from pid 943 +event: syscall (108) +SYS_fstat(1, 0xbffff14c, 0x400a5254, 0xbffff1c0, -1 <unfinished ...> +signal from pid 943 +event: sysret (108) +<... SYS_fstat resumed> ) = 0 +signal from pid 943 +event: syscall (90) +SYS_mmap(0xbffff19c, 0, 0x400a5254, 4096, 1 <unfinished ...> +signal from pid 943 +event: sysret (90) +<... SYS_mmap resumed> ) = 0x400b2000 +signal from pid 943 +event: syscall (54) +SYS_ioctl(1, 21505, 0xbffff12c, 0xbffff16c, 0 <unfinished ...> +signal from pid 943 +event: sysret (54) +<... SYS_ioctl resumed> ) = 0 +signal from pid 943 +event: syscall (4) +SYS_write(1, "i586\n", 5 <unfinished ...> +signal from pid 943 +event: sysret (4) +<... SYS_write resumed> ) = 5 +signal from pid 943 +event: breakpoint (0x08048542) +<... printf resumed> ) = 5 +signal from pid 943 +event: breakpoint (0x0804845c) +exit(0) = <void> +signal from pid 943 +event: breakpoint (0x08048461) +signal from pid 943 +event: syscall (91) +SYS_munmap(0x400b2000, 4096 <unfinished ...> +signal from pid 943 +event: sysret (91) +<... SYS_munmap resumed> ) = 0 +signal from pid 943 +event: syscall (1) +SYS_exit(0) = <void> +signal from pid 943 +event: exit (0) ++++ exited (status 0) +++ +No more children @@ -5,7 +5,7 @@ + execve() <- trace new program * Display different argument types: + format - + stringN should not display `...' when limit of bytes is reached + + how to display execl...? * Update /etc/ltrace.conf * SPARC: + almost all... diff --git a/debian/changelog b/debian/changelog index 41ef965..c1f2d3c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ltrace (0.2.3) unstable; urgency=low + + * Don't display `...' in strings when limit of bytes is reached + * Added some functions to /etc/ltrace.conf + + -- Juan Cespedes <cespedes@debian.org> Wed, 11 Mar 1998 23:33:14 +0100 + ltrace (0.2.2) unstable; urgency=low * After a successful execve(), syscalls are now logged correctly diff --git a/display_args.c b/display_args.c index e5ca197..dde6e6d 100644 --- a/display_args.c +++ b/display_args.c @@ -1,5 +1,6 @@ #include <stdio.h> #include <stdlib.h> +#include <limits.h> #include "ltrace.h" #include "options.h" @@ -70,6 +71,10 @@ static int display_char(char what) } } +static int string_maxlength=INT_MAX; + +#define MIN(a,b) (((a)<(b)) ? (a) : (b)) + static int display_string(enum tof type, struct process * proc, int arg_num) { void * addr; @@ -82,13 +87,13 @@ static int display_string(enum tof type, struct process * proc, int arg_num) return fprintf(output, "NULL"); } - str1 = malloc(opt_s+3); + str1 = malloc(MIN(opt_s,string_maxlength)+3); if (!str1) { return fprintf(output, "???"); } - umovestr(proc, addr, opt_s+1, str1); + umovestr(proc, addr, MIN(opt_s,string_maxlength)+1, str1); len = fprintf(output, "\""); - for(i=0; len<opt_s+1; i++) { + for(i=0; len<MIN(opt_s,string_maxlength)+1; i++) { if (str1[i]) { len += display_char(str1[i]); } else { @@ -96,23 +101,20 @@ static int display_string(enum tof type, struct process * proc, int arg_num) } } len += fprintf(output, "\""); - if (str1[i]) { + if (str1[i] && (opt_s <= string_maxlength)) { len += fprintf(output, "..."); } free(str1); return len; } -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) - static int display_stringN(int arg2, enum tof type, struct process * proc, int arg_num) { - int a,b; - a = gimme_arg(type, proc, arg2-1); - b = opt_s; - opt_s = MIN(opt_s, a); + int a; + + string_maxlength=gimme_arg(type, proc, arg2-1); a = display_string(type, proc, arg_num); - opt_s = b; + string_maxlength=INT_MAX; return a; } diff --git a/etc/ltrace.conf b/etc/ltrace.conf index 1ce3e6c..bed0bf1 100644 --- a/etc/ltrace.conf +++ b/etc/ltrace.conf @@ -41,6 +41,7 @@ int printf(format); ; unistd.h int close(int); +int execlp(string,string,addr,addr,addr); int fork(void); int geteuid(void); int gethostname(+string2,int); @@ -55,11 +56,14 @@ int write(int, string3, uint); int atexit(addr); void exit(int); void free(addr); +string getenv(string); addr malloc(int); ; string.h +string basename(string); addr memset(addr,char,int); string rindex(string,char); +addr stpcpy(addr,string); int strcmp(string,string); addr strcpy(addr,string); addr strdup(string); @@ -68,20 +72,28 @@ addr strncpy(addr,string3,uint); string strrchr(string,char); string strstr(string,string); +; sys/stat.h +octal umask(octal); + +; sys/utsname.h +int uname(addr); + ; time.h int time(addr); ; SYSCALLS -addr SYS_brk(addr); -int SYS_close(int); -int SYS_execve(string,addr,addr); -void SYS_exit(int); -int SYS_fork(void); -int SYS_getpid(void); +addr SYS_brk(addr); +int SYS_close(int); +int SYS_execve(string,addr,addr); +void SYS_exit(int); +int SYS_fork(void); +int SYS_getpid(void); ;addr SYS_mmap(addr,int,int,int,int,int); -int SYS_munmap(addr,uint); -int SYS_open(string,int,octal); -int SYS_personality(uint); -int SYS_read(int,+string0,uint); -int SYS_write(int,string3,uint); -int SYS_sync(void); +int SYS_munmap(addr,uint); +int SYS_open(string,int,octal); +int SYS_personality(uint); +int SYS_read(int,+string0,uint); +octal SYS_umask(octal); +int SYS_uname(addr); +int SYS_write(int,string3,uint); +int SYS_sync(void); |