aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Cespedes <cespedes@debian.org>2003-02-01 19:02:37 +0100
committerJuan Cespedes <cespedes@debian.org>2003-02-01 19:02:37 +0100
commita0ccf39a68c0fcdf2165bde0f9b70ed12fc61cd8 (patch)
treeafe23bec662ac61ab1a8c1bdb6463c3c017f775b
parent7186e2af704f4458e6383e8a92482594db29b597 (diff)
downloadltrace-a0ccf39a68c0fcdf2165bde0f9b70ed12fc61cd8.tar.gz
Version 0.3.29
* Align return values depending on screen width * Updated list of syscalls and signals to Linux 2.4.20 * Fixed bug introduced in 0.3.27 which caused -L option to segfault
-rw-r--r--TODO5
-rw-r--r--breakpoints.c4
-rw-r--r--debian/changelog8
-rw-r--r--defs.h10
-rw-r--r--dict.c8
-rw-r--r--etc/ltrace.conf1
-rw-r--r--ltrace.12
-rw-r--r--ltrace.c21
-rw-r--r--options.c2
-rw-r--r--output.c4
-rw-r--r--sysdeps/linux-gnu/arm/syscallent.h17
-rw-r--r--sysdeps/linux-gnu/i386/syscallent.h15
-rw-r--r--sysdeps/linux-gnu/m68k/syscallent.h16
-rw-r--r--sysdeps/linux-gnu/ppc/syscallent.h10
-rw-r--r--sysdeps/linux-gnu/s390/syscallent.h17
15 files changed, 126 insertions, 14 deletions
diff --git a/TODO b/TODO
index f591d47..80c5ff2 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+* Option -T (print time spent in each libcall)
+* Option -c (summary)
* BFD:
+ New executable formats
+ Read list of libraries needed
@@ -16,10 +18,7 @@
* netscape:
+ Why does it show so many `breakpointed at:' messages?
\- Is this still true?
-* Option -T (print time spent in each libcall)
-* Option -c (summary)
* More architectures: sparc, alpha
* More operating systems (solaris?)
* Option -I (inter-library calls)
* Modify ARGTYPE_STRING[0-5] types so that they not stop displaying chars when '\0' is encountered
-* Version number guessing does no longer work with autoconf :-(
diff --git a/breakpoints.c b/breakpoints.c
index dc2f09e..f91e62c 100644
--- a/breakpoints.c
+++ b/breakpoints.c
@@ -83,7 +83,9 @@ enable_all_breakpoints(struct process * proc) {
#endif
debug(1, "Enabling breakpoints for pid %u...", proc->pid);
- dict_apply_to_all(proc->breakpoints, enable_bp_cb, proc);
+ if (proc->breakpoints) {
+ dict_apply_to_all(proc->breakpoints, enable_bp_cb, proc);
+ }
}
proc->breakpoints_enabled = 1;
}
diff --git a/debian/changelog b/debian/changelog
index 1743df0..942f214 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ltrace (0.3.29) unstable; urgency=low
+
+ * Align return values depending on screen width
+ * Updated list of syscalls and signals to Linux 2.4.20
+ * Fixed bug introduced in 0.3.27 which caused -L option to segfault
+
+ -- Juan Cespedes <cespedes@debian.org> Sat, 01 Feb 2003 19:01:39 +0100
+
ltrace (0.3.28) unstable; urgency=medium
* Fixed memory corruption when using execve() in a traced program
diff --git a/defs.h b/defs.h
index 85986f3..601c8b0 100644
--- a/defs.h
+++ b/defs.h
@@ -1,13 +1,13 @@
#ifndef DEFAULT_ACOLUMN
-#define DEFAULT_ACOLUMN 50 /* default alignment column for results */
-#endif /* (-a switch) */
+#define DEFAULT_ACOLUMN 50 /* default alignment column for results */
+#endif /* (-a switch) */
#ifndef MAX_ARGS
-#define MAX_ARGS 32 /* maximum number of args to a syscall */
+#define MAX_ARGS 32 /* maximum number of args for a function */
#endif
#ifndef DEFAULT_STRLEN
-#define DEFAULT_STRLEN 32 /* default maximum # of bytes printed in */
-#endif /* strings (-s switch) */
+#define DEFAULT_STRLEN 32 /* default maximum # of bytes printed in */
+#endif /* strings (-s switch) */
diff --git a/dict.c b/dict.c
index ae7d220..d4676f3 100644
--- a/dict.c
+++ b/dict.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "debug.h"
@@ -52,6 +53,7 @@ dict_clear(struct dict * d) {
int i;
struct dict_entry * entry, * nextentry;
+ assert(d);
for (i = 0; i < DICTTABLESIZE; i++) {
for (entry = d->buckets[i]; entry != NULL; entry = nextentry) {
nextentry = entry->next;
@@ -68,6 +70,7 @@ dict_enter(struct dict * d, void * key, void * value) {
unsigned int hash = d->key2hash(key);
unsigned int bucketpos = hash % DICTTABLESIZE;
+ assert(d);
newentry = malloc(sizeof(struct dict_entry));
if (!newentry) {
perror("malloc");
@@ -95,6 +98,7 @@ dict_find_entry(struct dict * d, void * key) {
unsigned int bucketpos = hash % DICTTABLESIZE;
struct dict_entry * entry;
+ assert(d);
for (entry = d->buckets[bucketpos]; entry; entry = entry->next) {
if (hash != entry->hash) {
continue;
@@ -110,6 +114,7 @@ void
dict_apply_to_all(struct dict * d, void (*func)(void *key, void *value, void *data), void *data) {
int i;
+ assert(d);
for (i = 0; i < DICTTABLESIZE; i++) {
struct dict_entry * entry = d->buckets[i];
while (entry) {
@@ -126,6 +131,7 @@ dict_key2hash_string(void * key) {
const char * s = (const char *)key;
unsigned int total = 0, shift = 0;
+ assert(key);
while (*s) {
total = total ^ ((*s) << shift);
shift += 5;
@@ -137,6 +143,8 @@ dict_key2hash_string(void * key) {
int
dict_key_cmp_string(void * key1, void * key2) {
+ assert(key1);
+ assert(key2);
return strcmp((const char *)key1, (const char *)key2);
}
diff --git a/etc/ltrace.conf b/etc/ltrace.conf
index 5441220..9e6fb40 100644
--- a/etc/ltrace.conf
+++ b/etc/ltrace.conf
@@ -312,6 +312,7 @@ addr SYS_brk(addr);
int SYS_close(int);
int SYS_execve(string,addr,addr);
void SYS_exit(int);
+void SYS_exit_group(int);
int SYS_fork(void);
int SYS_getcwd(+string2,uint);
int SYS_getpid(void);
diff --git a/ltrace.1 b/ltrace.1
index 220bbda..ed7f967 100644
--- a/ltrace.1
+++ b/ltrace.1
@@ -67,7 +67,7 @@ Besides removing any initial underscore prepended by the system,
this makes C++ function names readable.
.TP
.I \-a, \-\-align column
-Align return values in a secific column (default column 50).
+Align return values in a secific column (default column is 5/8 of screen width).
.TP
.I \-s
Specify the maximum string size to print (the default is 32).
diff --git a/ltrace.c b/ltrace.c
index fbd6ca4..461e745 100644
--- a/ltrace.c
+++ b/ltrace.c
@@ -10,6 +10,7 @@
#include <sys/param.h>
#include <signal.h>
#include <sys/wait.h>
+#include <sys/ioctl.h>
#include "ltrace.h"
#include "output.h"
@@ -72,6 +73,25 @@ normal_exit(void) {
output_line(0,0);
}
+static void
+guess_cols(void) {
+ struct winsize ws;
+ char * c;
+
+ opt_a = DEFAULT_ACOLUMN;
+ c = getenv("COLUMNS");
+ if (c && *c) {
+ char * endptr;
+ int cols;
+ cols = strtol(c, &endptr, 0);
+ if (cols>0 && !*endptr) {
+ opt_a = cols * 5/8;
+ }
+ } else if (ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col>0) {
+ opt_a = ws.ws_col * 5/8;
+ }
+}
+
int
main(int argc, char **argv) {
struct opt_p_t * opt_p_tmp;
@@ -81,6 +101,7 @@ main(int argc, char **argv) {
signal(SIGINT,signal_exit); /* Detach processes when interrupted */
signal(SIGTERM,signal_exit); /* ... or killed */
+ guess_cols();
argv = process_options(argc, argv);
read_config_file(SYSCONFDIR "/ltrace.conf");
home = getenv("HOME");
diff --git a/options.c b/options.c
index 6338092..fe4aee7 100644
--- a/options.c
+++ b/options.c
@@ -3,7 +3,7 @@
#endif
#ifndef VERSION
-# define VERSION "0.3.28"
+# define VERSION "0.3.29"
#endif
#include <string.h>
diff --git a/output.c b/output.c
index 6a5eb5d..4a773a7 100644
--- a/output.c
+++ b/output.c
@@ -206,7 +206,7 @@ output_right(enum tof type, struct process * proc, char * function_name) {
if (!func) {
current_column += fprintf(output, ") ");
- tabto(opt_a);
+ tabto(opt_a-1);
fprintf(output, "= ");
display_arg(type, proc, -1, ARGTYPE_UNKNOWN);
fprintf(output, "\n");
@@ -220,7 +220,7 @@ output_right(enum tof type, struct process * proc, char * function_name) {
current_column += display_arg(type, proc, i, func->arg_types[i]);
}
current_column += fprintf(output, ") ");
- tabto(opt_a);
+ tabto(opt_a-1);
fprintf(output, "= ");
if (func->return_type == ARGTYPE_VOID) {
fprintf(output, "<void>");
diff --git a/sysdeps/linux-gnu/arm/syscallent.h b/sysdeps/linux-gnu/arm/syscallent.h
index 26d7bbf..d6019a1 100644
--- a/sysdeps/linux-gnu/arm/syscallent.h
+++ b/sysdeps/linux-gnu/arm/syscallent.h
@@ -220,3 +220,20 @@
"mincore", /* 219 */
"madvise", /* 220 */
"fcntl64", /* 221 */
+ "222", /* 222 */
+ "security", /* 223 */
+ "gettid", /* 224 */
+ "readahead", /* 225 */
+ "setxattr", /* 226 */
+ "lsetxattr", /* 227 */
+ "fsetxattr", /* 228 */
+ "getxattr", /* 229 */
+ "lgetxattr", /* 230 */
+ "fgetxattr", /* 231 */
+ "listxattr", /* 232 */
+ "llistxattr", /* 233 */
+ "flistxattr", /* 234 */
+ "removexattr", /* 235 */
+ "lremovexattr", /* 236 */
+ "fremovexattr", /* 237 */
+ "tkill", /* 238 */
diff --git a/sysdeps/linux-gnu/i386/syscallent.h b/sysdeps/linux-gnu/i386/syscallent.h
index e27b529..0a6d9cc 100644
--- a/sysdeps/linux-gnu/i386/syscallent.h
+++ b/sysdeps/linux-gnu/i386/syscallent.h
@@ -236,3 +236,18 @@
"removexattr", /* 235 */
"lremovexattr", /* 236 */
"fremovexattr", /* 237 */
+ "tkill", /* 238 */
+ "sendfile64", /* 239 */
+ "futex", /* 240 */
+ "sched_setaffinity", /* 241 */
+ "sched_getaffinity", /* 242 */
+ "set_thread_area", /* 243 */
+ "get_thread_area", /* 244 */
+ "io_setup", /* 245 */
+ "io_destroy", /* 246 */
+ "io_getevents", /* 247 */
+ "io_submit", /* 248 */
+ "io_cancel", /* 249 */
+ "alloc_hugepages", /* 250 */
+ "free_hugepages", /* 251 */
+ "exit_group", /* 252 */
diff --git a/sysdeps/linux-gnu/m68k/syscallent.h b/sysdeps/linux-gnu/m68k/syscallent.h
index 2265d28..faef969 100644
--- a/sysdeps/linux-gnu/m68k/syscallent.h
+++ b/sysdeps/linux-gnu/m68k/syscallent.h
@@ -215,7 +215,21 @@
"setgid32", /* 214 */
"setfsuid32", /* 215 */
"setfsgid32", /* 216 */
- "217", /* 217 */
+ "pivot_root", /* 217 */
"218", /* 218 */
"219", /* 219 */
"getdents64", /* 220 */
+ "gettid", /* 221 */
+ "tkill", /* 222 */
+ "setxattr", /* 223 */
+ "lsetxattr", /* 224 */
+ "fsetxattr", /* 225 */
+ "getxattr", /* 226 */
+ "lgetxattr", /* 227 */
+ "fgetxattr", /* 228 */
+ "listxattr", /* 229 */
+ "llistxattr", /* 230 */
+ "flistxattr", /* 231 */
+ "removexattr", /* 232 */
+ "lremovexattr", /* 233 */
+ "fremovexattr", /* 234 */
diff --git a/sysdeps/linux-gnu/ppc/syscallent.h b/sysdeps/linux-gnu/ppc/syscallent.h
index acbb4bc..e709aab 100644
--- a/sysdeps/linux-gnu/ppc/syscallent.h
+++ b/sysdeps/linux-gnu/ppc/syscallent.h
@@ -220,3 +220,13 @@
"lremovexattr", /* 219 */
"fremovexattr", /* 220 */
"futex", /* 221 */
+ "sched_setaffinity", /* 222 */
+ "sched_getaffinity", /* 223 */
+ "security", /* 224 */
+ "tuxcall", /* 225 */
+ "sendfile64", /* 226 */
+ "io_setup", /* 227 */
+ "io_destroy", /* 228 */
+ "io_getevents", /* 229 */
+ "io_submit", /* 230 */
+ "io_cancel", /* 231 */
diff --git a/sysdeps/linux-gnu/s390/syscallent.h b/sysdeps/linux-gnu/s390/syscallent.h
index 219b719..bcc404c 100644
--- a/sysdeps/linux-gnu/s390/syscallent.h
+++ b/sysdeps/linux-gnu/s390/syscallent.h
@@ -219,3 +219,20 @@
"mincore", /* 218 */
"madvise", /* 219 */
"getdents64", /* 220 */
+ "fcntl64", /* 221 */
+ "222", /* 222 */
+ "223", /* 223 */
+ "224", /* 224 */
+ "225", /* 225 */
+ "226", /* 226 */
+ "227", /* 227 */
+ "228", /* 228 */
+ "229", /* 229 */
+ "230", /* 230 */
+ "231", /* 231 */
+ "232", /* 232 */
+ "233", /* 233 */
+ "234", /* 234 */
+ "235", /* 235 */
+ "gettid", /* 236 */
+ "tkill", /* 237 */