aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Cespedes <cespedes@debian.org>2002-03-01 19:54:23 +0100
committerJuan Cespedes <cespedes@debian.org>2002-03-01 19:54:23 +0100
commit8cc1b9d456c8f41e3a8cc0d3ec0d77eb779cb7bb (patch)
treead52599fd70a115bbe3837fc0aca4fb2ba4ba3e2
parent5916fda0d07da90cac8a78cbfa73374d81b150be (diff)
downloadltrace-8cc1b9d456c8f41e3a8cc0d3ec0d77eb779cb7bb.tar.gz
Version: 0.3.18
* Simplified arch-dependent stuff * Updated list of syscalls and signals to Linux 2.4.18 * Unified coding-style of all function declarations * Do not indent lines indicating signals, exit codes, etc * Updated description * fix off-by-one problem in checking syscall number (Tim Waugh <twaugh@redhat.com> fixed this problem in RedHat two years ago; thank you for NOT noticing me...)
-rw-r--r--breakpoints.c51
-rw-r--r--debian/changelog13
-rw-r--r--debian/control13
-rw-r--r--demangle.c24
-rw-r--r--display_args.c24
-rw-r--r--elf.c39
-rw-r--r--execute_program.c8
-rw-r--r--ltrace.c16
-rw-r--r--ltrace.spec14
-rw-r--r--options.c12
-rw-r--r--output.c30
-rw-r--r--proc.c16
-rw-r--r--process_event.c2
-rw-r--r--read_config_file.c19
-rw-r--r--sysdeps/linux-gnu/arm/breakpoint.c8
-rw-r--r--sysdeps/linux-gnu/arm/regs.c13
-rw-r--r--sysdeps/linux-gnu/arm/syscallent.h4
-rw-r--r--sysdeps/linux-gnu/arm/trace.c22
-rw-r--r--sysdeps/linux-gnu/i386/regs.c13
-rw-r--r--sysdeps/linux-gnu/i386/syscallent.h16
-rw-r--r--sysdeps/linux-gnu/i386/trace.c24
-rw-r--r--sysdeps/linux-gnu/m68k/breakpoint.c8
-rw-r--r--sysdeps/linux-gnu/m68k/regs.c13
-rw-r--r--sysdeps/linux-gnu/m68k/trace.c22
-rw-r--r--sysdeps/linux-gnu/proc.c4
-rw-r--r--sysdeps/linux-gnu/trace.c54
26 files changed, 232 insertions, 250 deletions
diff --git a/breakpoints.c b/breakpoints.c
index 9d1f114..28bdb4b 100644
--- a/breakpoints.c
+++ b/breakpoints.c
@@ -17,8 +17,7 @@
FIXME: should we merge with dictionary code in demangle.c? 19990704 mortene.
*/
-struct dict_entry
-{
+struct dict_entry {
struct process * proc;
struct breakpoint brk; /* addr field of struct is the hash key. */
struct dict_entry * next;
@@ -35,16 +34,16 @@ static struct breakpoint * dict_find_entry(struct process * proc, void * brkaddr
static void dict_apply_to_all(void (* func)(struct process *, struct breakpoint *, void * data), void * data);
-static void dict_init(void)
-{
+static void
+dict_init(void) {
int i;
/* FIXME: is this necessary? Check with ANSI C spec. 19990702 mortene. */
for (i = 0; i < DICTTABLESIZE; i++) dict_buckets[i] = NULL;
dict_initialized = 1;
}
-static void dict_clear(void)
-{
+static void
+dict_clear(void) {
int i;
struct dict_entry * entry, * nextentry;
@@ -57,8 +56,8 @@ static void dict_clear(void)
}
}
-static struct breakpoint * dict_enter(struct process * proc, void * brkaddr)
-{
+static struct breakpoint *
+dict_enter(struct process * proc, void * brkaddr) {
struct dict_entry * entry, * newentry;
unsigned int bucketpos = ((unsigned long int)brkaddr) % DICTTABLESIZE;
@@ -85,8 +84,8 @@ static struct breakpoint * dict_enter(struct process * proc, void * brkaddr)
return &(newentry->brk);
}
-static struct breakpoint * dict_find_entry(struct process * proc, void * brkaddr)
-{
+static struct breakpoint *
+dict_find_entry(struct process * proc, void * brkaddr) {
unsigned int bucketpos = ((unsigned long int)brkaddr) % DICTTABLESIZE;
struct dict_entry * entry = dict_buckets[bucketpos];
while (entry) {
@@ -96,8 +95,8 @@ static struct breakpoint * dict_find_entry(struct process * proc, void * brkaddr
return entry ? &(entry->brk) : NULL;
}
-static void dict_apply_to_all(void (* func)(struct process *, struct breakpoint *, void * data), void * data)
-{
+static void
+dict_apply_to_all(void (* func)(struct process *, struct breakpoint *, void * data), void * data) {
int i;
for (i = 0; i < DICTTABLESIZE; i++) {
@@ -113,13 +112,13 @@ static void dict_apply_to_all(void (* func)(struct process *, struct breakpoint
/*****************************************************************************/
-struct breakpoint * address2bpstruct(struct process * proc, void * addr)
-{
+struct breakpoint *
+address2bpstruct(struct process * proc, void * addr) {
return dict_find_entry(proc, addr);
}
-void insert_breakpoint(struct process * proc, void * addr)
-{
+void
+insert_breakpoint(struct process * proc, void * addr) {
struct breakpoint * sbp;
if (!dict_initialized) {
@@ -135,8 +134,8 @@ void insert_breakpoint(struct process * proc, void * addr)
if (sbp->enabled==1 && proc->pid) enable_breakpoint(proc->pid, sbp);
}
-void delete_breakpoint(struct process * proc, void * addr)
-{
+void
+delete_breakpoint(struct process * proc, void * addr) {
struct breakpoint * sbp = dict_find_entry(proc, addr);
assert(sbp); /* FIXME: remove after debugging has been done. */
/* This should only happen on out-of-memory conditions. */
@@ -147,14 +146,14 @@ void delete_breakpoint(struct process * proc, void * addr)
assert(sbp->enabled >= 0);
}
-static void enable_bp_cb(struct process * proc, struct breakpoint * sbp, void * data)
-{
+static void
+enable_bp_cb(struct process * proc, struct breakpoint * sbp, void * data) {
struct process * myproc = (struct process *)data;
if (myproc == proc && sbp->enabled) enable_breakpoint(proc->pid, sbp);
}
-void enable_all_breakpoints(struct process * proc)
-{
+void
+enable_all_breakpoints(struct process * proc) {
if (proc->breakpoints_enabled <= 0) {
if (opt_d>0) {
output_line(0, "Enabling breakpoints for pid %u...", proc->pid);
@@ -164,14 +163,14 @@ void enable_all_breakpoints(struct process * proc)
proc->breakpoints_enabled = 1;
}
-static void disable_bp_cb(struct process * proc, struct breakpoint * sbp, void * data)
-{
+static void
+disable_bp_cb(struct process * proc, struct breakpoint * sbp, void * data) {
struct process * myproc = (struct process *)data;
if (myproc == proc && sbp->enabled) disable_breakpoint(proc->pid, sbp);
}
-void disable_all_breakpoints(struct process * proc)
-{
+void
+disable_all_breakpoints(struct process * proc) {
if (proc->breakpoints_enabled) {
if (opt_d>0) {
output_line(0, "Disabling breakpoints for pid %u...", proc->pid);
diff --git a/debian/changelog b/debian/changelog
index 26925b7..046187a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+ltrace (0.3.18) unstable; urgency=low
+
+ * Simplified arch-dependent stuff
+ * Updated list of syscalls and signals to Linux 2.4.18
+ * Unified coding-style of all function declarations
+ * Do not indent lines indicating signals, exit codes, etc
+ * Updated description
+ * fix off-by-one problem in checking syscall number (Tim Waugh
+ <twaugh@redhat.com> fixed this problem in RedHat two years ago;
+ thank you for NOT noticing me...)
+
+ -- Juan Cespedes <cespedes@debian.org> Fri, 1 Mar 2002 19:52:43 +0100
+
ltrace (0.3.17) unstable; urgency=low
* Added a bit more debugging
diff --git a/debian/control b/debian/control
index deb5c06..56e3d32 100644
--- a/debian/control
+++ b/debian/control
@@ -8,11 +8,16 @@ Build-Depends: binutils-dev
Package: ltrace
Architecture: i386 arm m68k
Depends: ${shlibs:Depends}
-Description: Shows runtime library calls in dynamically linked programs
- ltrace is a program that simply runs the specified command until it exits.
- It intercepts and records the dynamic library calls which are called by
- the executed process and the signals which are received by that process.
+Description: Tracks runtime library calls in dynamically linked programs
+ ltrace is a debugging program which runs a specified command until it
+ exits. While the command is executing, ltrace intercepts and records
+ the dynamic library calls which are called by
+ the executed process and the signals received by that process.
It can also intercept and print the system calls executed by the program.
.
The program to be traced need not be recompiled for this, so you can
use it on binaries for which you don't have the source handy.
+ .
+ You should install ltrace if you need a sysadmin tool for tracking the
+ execution of processes.
+
diff --git a/demangle.c b/demangle.c
index cb10d73..8f0d24e 100644
--- a/demangle.c
+++ b/demangle.c
@@ -40,16 +40,16 @@ static const char * dict_find_entry(const char * mangled);
static unsigned int dict_hash_string(const char * s);
-static void dict_init(void)
-{
+static void
+dict_init(void) {
int i;
/* FIXME: is this necessary? Check with ANSI C spec. 19990702 mortene. */
for (i = 0; i < DICTTABLESIZE; i++) dict_buckets[i] = NULL;
dict_initialized = 1;
}
-static void dict_clear(void)
-{
+static void
+dict_clear(void) {
int i;
struct dict_entry * entry, * nextentry;
@@ -65,8 +65,8 @@ static void dict_clear(void)
}
}
-static void dict_enter(const char * mangled, const char * demangled)
-{
+static void
+dict_enter(const char * mangled, const char * demangled) {
struct dict_entry * entry, * newentry;
unsigned int key = dict_hash_string(mangled);
@@ -91,8 +91,8 @@ static void dict_enter(const char * mangled, const char * demangled)
output_line(0, "new dict entry: '%s' -> '%s'\n", mangled, demangled);
}
-static const char * dict_find_entry(const char * mangled)
-{
+static const char *
+dict_find_entry(const char * mangled) {
unsigned int key = dict_hash_string(mangled);
struct dict_entry * entry = dict_buckets[key % DICTTABLESIZE];
while (entry) {
@@ -102,8 +102,8 @@ static const char * dict_find_entry(const char * mangled)
return entry ? entry->demangled : NULL;
}
-static unsigned int dict_hash_string(const char * s)
-{
+static unsigned int
+dict_hash_string(const char * s) {
unsigned int total = 0, shift = 0;
while (*s) {
@@ -119,8 +119,8 @@ static unsigned int dict_hash_string(const char * s)
/*****************************************************************************/
-const char * my_demangle(const char * function_name)
-{
+const char *
+my_demangle(const char * function_name) {
const char * tmp, * fn_copy;
if (!dict_initialized) {
diff --git a/display_args.c b/display_args.c
index 1ea10fd..de1a1c4 100644
--- a/display_args.c
+++ b/display_args.c
@@ -15,8 +15,8 @@ static int display_stringN(int arg2, enum tof type, struct process * proc, int a
static int display_unknown(enum tof type, struct process * proc, int arg_num);
static int display_format(enum tof type, struct process * proc, int arg_num);
-int display_arg(enum tof type, struct process * proc, int arg_num, enum arg_type at)
-{
+int
+display_arg(enum tof type, struct process * proc, int arg_num, enum arg_type at) {
int tmp;
long arg;
@@ -60,8 +60,8 @@ int display_arg(enum tof type, struct process * proc, int arg_num, enum arg_type
return fprintf(output, "?");
}
-static int display_char(int what)
-{
+static int
+display_char(int what) {
switch(what) {
case -1: return fprintf(output, "EOF");
case '\r': return fprintf(output, "\\r");
@@ -82,8 +82,8 @@ 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)
-{
+static int
+display_string(enum tof type, struct process * proc, int arg_num) {
void * addr;
char * str1;
int i;
@@ -115,8 +115,8 @@ static int display_string(enum tof type, struct process * proc, int arg_num)
return len;
}
-static int display_stringN(int arg2, enum tof type, struct process * proc, int arg_num)
-{
+static int
+display_stringN(int arg2, enum tof type, struct process * proc, int arg_num) {
int a;
string_maxlength=gimme_arg(type, proc, arg2-1);
@@ -125,8 +125,8 @@ static int display_stringN(int arg2, enum tof type, struct process * proc, int a
return a;
}
-static int display_unknown(enum tof type, struct process * proc, int arg_num)
-{
+static int
+display_unknown(enum tof type, struct process * proc, int arg_num) {
long tmp;
tmp = gimme_arg(type, proc, arg_num);
@@ -138,8 +138,8 @@ static int display_unknown(enum tof type, struct process * proc, int arg_num)
}
}
-static int display_format(enum tof type, struct process * proc, int arg_num)
-{
+static int
+display_format(enum tof type, struct process * proc, int arg_num) {
void * addr;
char * str1;
int i;
diff --git a/elf.c b/elf.c
index e8b446b..b3f7a12 100644
--- a/elf.c
+++ b/elf.c
@@ -38,8 +38,8 @@ static void add_library_symbol(
static struct ltelf library_lte[MAX_LIBRARY];
-static void do_init_elf(struct ltelf *lte, const char *filename)
-{
+static void
+do_init_elf(struct ltelf *lte, const char *filename) {
struct stat sbuf;
if (opt_d > 0) {
@@ -109,13 +109,13 @@ static void do_init_elf(struct ltelf *lte, const char *filename)
lte->symtab_len = 0;
}
-static void do_close_elf(struct ltelf *lte)
-{
+static void
+do_close_elf(struct ltelf *lte) {
close(lte->fd);
}
-static void do_load_elf_symtab(struct ltelf *lte)
-{
+static void
+do_load_elf_symtab(struct ltelf *lte) {
void *maddr = lte->maddr;
Elf32_Ehdr *ehdr = lte->ehdr;
Elf32_Shdr *shdr = (Elf32_Shdr *)(maddr + ehdr->e_shoff);
@@ -144,12 +144,11 @@ static void do_load_elf_symtab(struct ltelf *lte)
}
}
-static void add_library_symbol(
- struct ltelf *lte,
- int i,
- struct library_symbol **library_symbolspp
-)
-{
+static void
+add_library_symbol(
+ struct ltelf *lte,
+ int i,
+ struct library_symbol **library_symbolspp) {
struct library_symbol *tmp = *library_symbolspp;
struct library_symbol *library_symbols;
@@ -182,8 +181,8 @@ static void add_library_symbol(
so its not that bad - silvio
*/
-static void do_init_load_libraries(void)
-{
+static void
+do_init_load_libraries(void) {
int i;
for (i = 0; i < library_num; i++) {
@@ -192,8 +191,8 @@ static void do_init_load_libraries(void)
}
}
-static void do_close_load_libraries(void)
-{
+static void
+do_close_load_libraries(void) {
int i;
for (i = 0; i < library_num; i++) {
@@ -201,8 +200,8 @@ static void do_close_load_libraries(void)
}
}
-static int in_load_libraries(const char *func)
-{
+static int
+in_load_libraries(const char *func) {
int i, j;
/*
if no libraries are specified, assume we want all
@@ -231,8 +230,8 @@ static int in_load_libraries(const char *func)
this is the main function
*/
-struct library_symbol * read_elf(const char *filename)
-{
+struct library_symbol *
+read_elf(const char *filename) {
struct library_symbol *library_symbols = NULL;
struct ltelf lte;
int i;
diff --git a/execute_program.c b/execute_program.c
index 77e30b3..0306678 100644
--- a/execute_program.c
+++ b/execute_program.c
@@ -18,8 +18,8 @@
static void change_uid(struct process * proc);
-void execute_program(struct process * sp, char **argv)
-{
+void
+execute_program(struct process * sp, char **argv) {
pid_t pid;
if (opt_d) {
@@ -47,8 +47,8 @@ void execute_program(struct process * sp, char **argv)
return;
}
-static void change_uid(struct process * proc)
-{
+static void
+change_uid(struct process * proc) {
uid_t run_uid, run_euid;
gid_t run_gid, run_egid;
diff --git a/ltrace.c b/ltrace.c
index 568e75d..060e2b3 100644
--- a/ltrace.c
+++ b/ltrace.c
@@ -21,8 +21,8 @@ struct process * list_of_processes = NULL;
int exiting=0; /* =1 if a SIGINT or SIGTERM has been received */
-static void signal_alarm(int sig)
-{
+static void
+signal_alarm(int sig) {
struct process * tmp = list_of_processes;
signal(SIGALRM,SIG_DFL);
@@ -46,8 +46,8 @@ static void signal_alarm(int sig)
}
}
-static void signal_exit(int sig)
-{
+static void
+signal_exit(int sig) {
exiting=1;
if (opt_d) {
output_line(0,"Received interrupt signal; exiting...");
@@ -68,13 +68,13 @@ static void signal_exit(int sig)
alarm(1);
}
-static void normal_exit(void)
-{
+static void
+normal_exit(void) {
output_line(0,0);
}
-int main(int argc, char **argv)
-{
+int
+main(int argc, char **argv) {
struct opt_p_t * opt_p_tmp;
atexit(normal_exit);
diff --git a/ltrace.spec b/ltrace.spec
index 6c2832a..6f577f0 100644
--- a/ltrace.spec
+++ b/ltrace.spec
@@ -1,6 +1,6 @@
-Summary: Shows runtime library call information for dynamically linked executables
+Summary: Tracks runtime library calls for dynamically linked executables
Name: ltrace
-%define version 0.3.17
+%define version 0.3.18
Version: %{version}
Release: 1
Source: ftp://ftp.debian.org/debian/dists/unstable/main/source/utils/ltrace_%{version}.tar.gz
@@ -9,14 +9,18 @@ Group: Development/Debuggers
BuildRoot: /tmp/ltrace-root
%description
-ltrace is a program that simply runs the specified command until it exits.
-It intercepts and records the dynamic library calls which are called by
-the executed process and the signals which are received by that process.
+ltrace is a debugging program which runs a specified command until it
+exits. While the command is executing, ltrace intercepts and records
+the dynamic library calls which are called by
+the executed process and the signals received by that process.
It can also intercept and print the system calls executed by the program.
The program to be traced need not be recompiled for this, so you can
use it on binaries for which you don't have the source handy.
+You should install ltrace if you need a sysadmin tool for tracking the
+execution of processes.
+
%prep
%setup -q
./configure --prefix=/usr
diff --git a/options.c b/options.c
index 20ffeec..d3e53fd 100644
--- a/options.c
+++ b/options.c
@@ -48,8 +48,8 @@ struct opt_p_t * opt_p = NULL; /* attach to process with a given pid */
struct opt_e_t * opt_e = NULL;
int opt_e_enable=1;
-static void usage(void)
-{
+static void
+usage(void) {
#if !(HAVE_GETOPT || HAVE_GETOPT_LONG)
fprintf(stdout, "Usage: %s [command [arg ...]]\n"
"Trace library calls of a given program.\n\n", progname);
@@ -114,8 +114,8 @@ static void usage(void)
#endif
}
-static char * search_for_command(char * filename)
-{
+static char *
+search_for_command(char * filename) {
static char pathname[1024];
char *path;
int m, n;
@@ -142,8 +142,8 @@ static char * search_for_command(char * filename)
return filename;
}
-char ** process_options(int argc, char **argv)
-{
+char **
+process_options(int argc, char **argv) {
progname = argv[0];
output = stderr;
diff --git a/output.c b/output.c
index e1a9238..d3196ad 100644
--- a/output.c
+++ b/output.c
@@ -21,13 +21,13 @@ static pid_t current_pid = 0;
static int current_depth = 0;
static int current_column = 0;
-static void output_indent(struct process * proc)
-{
+static void
+output_indent(struct process * proc) {
current_column += fprintf(output, "%*s", opt_n * proc->callstack_depth, "");
}
-static void begin_of_line(enum tof type, struct process * proc)
-{
+static void
+begin_of_line(enum tof type, struct process * proc) {
current_column = 0;
if (!proc) {
return;
@@ -88,13 +88,13 @@ static void begin_of_line(enum tof type, struct process * proc)
(unsigned)proc->instruction_pointer);
}
}
- if (opt_n > 0) {
+ if (opt_n > 0 && type!=LT_TOF_NONE) {
output_indent(proc);
}
}
-static struct function * name2func(char * name)
-{
+static struct function *
+name2func(char * name) {
struct function * tmp;
const char * str1, * str2;
@@ -116,8 +116,8 @@ static struct function * name2func(char * name)
return NULL;
}
-void output_line(struct process * proc, char *fmt, ...)
-{
+void
+output_line(struct process * proc, char *fmt, ...) {
va_list args;
if (current_pid) {
@@ -136,15 +136,15 @@ void output_line(struct process * proc, char *fmt, ...)
current_column=0;
}
-static void tabto(int col)
-{
+static void
+tabto(int col) {
if (current_column < col) {
fprintf(output, "%*s", col-current_column, "");
}
}
-void output_left(enum tof type, struct process * proc, char * function_name)
-{
+void
+output_left(enum tof type, struct process * proc, char * function_name) {
struct function * func;
if (current_pid) {
@@ -186,8 +186,8 @@ void output_left(enum tof type, struct process * proc, char * function_name)
}
}
-void output_right(enum tof type, struct process * proc, char * function_name)
-{
+void
+output_right(enum tof type, struct process * proc, char * function_name) {
struct function * func = name2func(function_name);
if ((current_pid && current_pid!=proc->pid) ||
diff --git a/proc.c b/proc.c
index 48a942f..3c0a936 100644
--- a/proc.c
+++ b/proc.c
@@ -12,8 +12,8 @@
#include "options.h"
#include "elf.h"
-struct process * open_program(char * filename)
-{
+struct process *
+open_program(char * filename) {
struct process * proc;
struct library_symbol * sym;
proc = malloc(sizeof(struct process));
@@ -62,19 +62,13 @@ struct process * open_program(char * filename)
return proc;
}
-void open_pid(pid_t pid, int verbose)
-{
+void
+open_pid(pid_t pid, int verbose) {
struct process * proc;
char * filename;
if (trace_pid(pid)<0) {
-#if 0
- if (verbose) {
-#endif
- fprintf(stderr, "Cannot attach to pid %u: %s\n", pid, strerror(errno));
-#if 0
- }
-#endif
+ fprintf(stderr, "Cannot attach to pid %u: %s\n", pid, strerror(errno));
return;
}
diff --git a/process_event.c b/process_event.c
index 0f0fac4..fb9792a 100644
--- a/process_event.c
+++ b/process_event.c
@@ -83,7 +83,7 @@ shortsignal(int signum) {
};
int nsignals0 = sizeof signalent0 / sizeof signalent0[0];
- if (signum<0 || signum>nsignals0) {
+ if (signum<0 || signum>=nsignals0) {
return "UNKNOWN_SIGNAL";
} else {
return signalent0[signum];
diff --git a/read_config_file.c b/read_config_file.c
index da831a8..931d9cf 100644
--- a/read_config_file.c
+++ b/read_config_file.c
@@ -44,8 +44,8 @@ static struct list_of_pt_t {
{ NULL, ARGTYPE_UNKNOWN } /* Must finish with NULL */
};
-static enum arg_type str2type(char ** str)
-{
+static enum arg_type
+str2type(char ** str) {
struct list_of_pt_t * tmp = &list_of_pt[0];
while(tmp->name) {
@@ -59,8 +59,8 @@ static enum arg_type str2type(char ** str)
return ARGTYPE_UNKNOWN;
}
-static void eat_spaces(char ** str)
-{
+static void
+eat_spaces(char ** str) {
while(**str==' ') {
(*str)++;
}
@@ -70,8 +70,8 @@ static void eat_spaces(char ** str)
Returns position in string at the left parenthesis which starts the
function's argument signature. Returns NULL on error.
*/
-static char * start_of_arg_sig(char * str)
-{
+static char *
+start_of_arg_sig(char * str) {
char * pos;
int stacked = 0;
@@ -95,7 +95,8 @@ static char * start_of_arg_sig(char * str)
static int line_no;
static char * filename;
-struct function * process_line (char * buf) {
+struct function *
+process_line (char * buf) {
struct function fun;
struct function * fun_p;
char * str = buf;
@@ -163,8 +164,8 @@ struct function * process_line (char * buf) {
return fun_p;
}
-void read_config_file(char * file)
-{
+void
+read_config_file(char * file) {
FILE * stream;
char buf[1024];
diff --git a/sysdeps/linux-gnu/arm/breakpoint.c b/sysdeps/linux-gnu/arm/breakpoint.c
index 446c38b..f2eed98 100644
--- a/sysdeps/linux-gnu/arm/breakpoint.c
+++ b/sysdeps/linux-gnu/arm/breakpoint.c
@@ -5,8 +5,8 @@
#include <sys/ptrace.h>
#include "ltrace.h"
-void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
-{
+void
+enable_breakpoint(pid_t pid, struct breakpoint * sbp) {
int a;
a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
@@ -18,8 +18,8 @@ void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
}
-void disable_breakpoint(pid_t pid, const struct breakpoint * sbp)
-{
+void
+disable_breakpoint(pid_t pid, const struct breakpoint * sbp) {
int a;
a = sbp->orig_value[0] + (sbp->orig_value[1]<<8) + (sbp->orig_value[2]<<16) + (sbp->orig_value[3]<<24);
diff --git a/sysdeps/linux-gnu/arm/regs.c b/sysdeps/linux-gnu/arm/regs.c
index 78ee60f..97a3bfe 100644
--- a/sysdeps/linux-gnu/arm/regs.c
+++ b/sysdeps/linux-gnu/arm/regs.c
@@ -18,20 +18,19 @@
#define off_lr 56
#define off_sp 52
-void * get_instruction_pointer(pid_t pid)
-{
+void *
+get_instruction_pointer(pid_t pid) {
return (void *)ptrace(PTRACE_PEEKUSER, pid, off_pc, 0);
}
-void * get_stack_pointer(pid_t pid)
-{
+void *
+get_stack_pointer(pid_t pid) {
return (void *)ptrace(PTRACE_PEEKUSER, pid, off_sp, 0);
}
/* really, this is given the *stack_pointer expecting
* a CISC architecture; in our case, we don't need that */
-void * get_return_addr(pid_t pid, void * stack_pointer)
-{
+void *
+get_return_addr(pid_t pid, void * stack_pointer) {
return (void *)ptrace(PTRACE_PEEKUSER, pid, off_lr, 0);
}
-
diff --git a/sysdeps/linux-gnu/arm/syscallent.h b/sysdeps/linux-gnu/arm/syscallent.h
index 5f61c6d..26d7bbf 100644
--- a/sysdeps/linux-gnu/arm/syscallent.h
+++ b/sysdeps/linux-gnu/arm/syscallent.h
@@ -74,7 +74,7 @@
"sigpending", /* 73 */
"sethostname", /* 74 */
"setrlimit", /* 75 */
- "old_getrlimit", /* 76 */
+ "getrlimit", /* 76 */
"getrusage", /* 77 */
"gettimeofday", /* 78 */
"settimeofday", /* 79 */
@@ -189,7 +189,7 @@
"188", /* 188 */
"189", /* 189 */
"vfork", /* 190 */
- "getrlimit", /* 191 */
+ "ugetrlimit", /* 191 */
"mmap2", /* 192 */
"truncate64", /* 193 */
"ftruncate64", /* 194 */
diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c
index 49d2f20..5e48b2e 100644
--- a/sysdeps/linux-gnu/arm/trace.c
+++ b/sysdeps/linux-gnu/arm/trace.c
@@ -84,25 +84,3 @@ long gimme_arg(enum tof type, struct process * proc, int arg_num)
return 0;
}
-
-int umovestr(struct process * proc, void * addr, int len, void * laddr)
-{
- long a;
- int i;
- int offset=0;
-
- while(offset<len) {
- a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr+offset, 0);
- for(i=0; i<sizeof(long); i++) {
- if (((char*)&a)[i] && offset+i < len) {
- *(char *)(laddr+offset+i) = ((char*)&a)[i];
- } else {
- *(char *)(laddr+offset+i) = '\0';
- return 0;
- }
- }
- offset += sizeof(long);
- }
- *(char *)(laddr+offset) = '\0';
- return 0;
-}
diff --git a/sysdeps/linux-gnu/i386/regs.c b/sysdeps/linux-gnu/i386/regs.c
index f36be55..e60634b 100644
--- a/sysdeps/linux-gnu/i386/regs.c
+++ b/sysdeps/linux-gnu/i386/regs.c
@@ -14,18 +14,17 @@
# define PTRACE_POKEUSER PTRACE_POKEUSR
#endif
-void * get_instruction_pointer(pid_t pid)
-{
+void *
+get_instruction_pointer(pid_t pid) {
return (void *)ptrace(PTRACE_PEEKUSER, pid, 4*EIP, 0);
}
-void * get_stack_pointer(pid_t pid)
-{
+void *
+get_stack_pointer(pid_t pid) {
return (void *)ptrace(PTRACE_PEEKUSER, pid, 4*UESP, 0);
}
-void * get_return_addr(pid_t pid, void * stack_pointer)
-{
+void *
+get_return_addr(pid_t pid, void * stack_pointer) {
return (void *)ptrace(PTRACE_PEEKTEXT, pid, stack_pointer, 0);
}
-
diff --git a/sysdeps/linux-gnu/i386/syscallent.h b/sysdeps/linux-gnu/i386/syscallent.h
index 52f69c4..e27b529 100644
--- a/sysdeps/linux-gnu/i386/syscallent.h
+++ b/sysdeps/linux-gnu/i386/syscallent.h
@@ -220,3 +220,19 @@
"madvise1", /* 219 */
"getdents64", /* 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 */
diff --git a/sysdeps/linux-gnu/i386/trace.c b/sysdeps/linux-gnu/i386/trace.c
index 047ae51..1e38a27 100644
--- a/sysdeps/linux-gnu/i386/trace.c
+++ b/sysdeps/linux-gnu/i386/trace.c
@@ -22,8 +22,6 @@
*/
int syscall_p(struct process * proc, int status, int * sysnum)
{
- static int syscall_active = 0;
-
if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4*ORIG_EAX, 0);
@@ -81,25 +79,3 @@ long gimme_arg(enum tof type, struct process * proc, int arg_num)
return 0;
}
-
-int umovestr(struct process * proc, void * addr, int len, void * laddr)
-{
- long a;
- int i;
- int offset=0;
-
- while(offset<len) {
- a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr+offset, 0);
- for(i=0; i<sizeof(long); i++) {
- if (((char*)&a)[i] && offset+i < len) {
- *(char *)(laddr+offset+i) = ((char*)&a)[i];
- } else {
- *(char *)(laddr+offset+i) = '\0';
- return 0;
- }
- }
- offset += sizeof(long);
- }
- *(char *)(laddr+offset) = '\0';
- return 0;
-}
diff --git a/sysdeps/linux-gnu/m68k/breakpoint.c b/sysdeps/linux-gnu/m68k/breakpoint.c
index 46c84ce..c74c4d2 100644
--- a/sysdeps/linux-gnu/m68k/breakpoint.c
+++ b/sysdeps/linux-gnu/m68k/breakpoint.c
@@ -5,8 +5,8 @@
#include <sys/ptrace.h>
#include "ltrace.h"
-void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
-{
+void
+enable_breakpoint(pid_t pid, struct breakpoint * sbp) {
int a;
a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
@@ -17,8 +17,8 @@ void enable_breakpoint(pid_t pid, struct breakpoint * sbp)
ptrace(PTRACE_POKETEXT, pid, sbp->addr, a);
}
-void disable_breakpoint(pid_t pid, const struct breakpoint * sbp)
-{
+void
+disable_breakpoint(pid_t pid, const struct breakpoint * sbp) {
int a;
a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr, 0);
diff --git a/sysdeps/linux-gnu/m68k/regs.c b/sysdeps/linux-gnu/m68k/regs.c
index f046f19..1f51417 100644
--- a/sysdeps/linux-gnu/m68k/regs.c
+++ b/sysdeps/linux-gnu/m68k/regs.c
@@ -14,18 +14,17 @@
# define PTRACE_POKEUSER PTRACE_POKEUSR
#endif
-void * get_instruction_pointer(pid_t pid)
-{
+void *
+get_instruction_pointer(pid_t pid) {
return (void *)ptrace(PTRACE_PEEKUSER, pid, 4*PT_PC, 0);
}
-void * get_stack_pointer(pid_t pid)
-{
+void *
+get_stack_pointer(pid_t pid) {
return (void *)ptrace(PTRACE_PEEKUSER, pid, 4*PT_USP, 0);
}
-void * get_return_addr(pid_t pid, void * stack_pointer)
-{
+void *
+get_return_addr(pid_t pid, void * stack_pointer) {
return (void *)ptrace(PTRACE_PEEKTEXT, pid, stack_pointer, 0);
}
-
diff --git a/sysdeps/linux-gnu/m68k/trace.c b/sysdeps/linux-gnu/m68k/trace.c
index 8d8af67..43586de 100644
--- a/sysdeps/linux-gnu/m68k/trace.c
+++ b/sysdeps/linux-gnu/m68k/trace.c
@@ -84,25 +84,3 @@ long gimme_arg(enum tof type, struct process * proc, int arg_num)
return 0;
}
-
-int umovestr(struct process * proc, void * addr, int len, void * laddr)
-{
- long a;
- int i;
- int offset=0;
-
- while(offset<len) {
- a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr+offset, 0);
- for(i=0; i<sizeof(long); i++) {
- if (((char*)&a)[i] && offset+i < len) {
- *(char *)(laddr+offset+i) = ((char*)&a)[i];
- } else {
- *(char *)(laddr+offset+i) = '\0';
- return 0;
- }
- }
- offset += sizeof(long);
- }
- *(char *)(laddr+offset) = '\0';
- return 0;
-}
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index 8390136..a5c18f6 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -18,8 +18,8 @@
/*
* Returns a file name corresponding to a running pid
*/
-char * pid2name(pid_t pid)
-{
+char *
+pid2name(pid_t pid) {
char proc_exe[1024];
if (!kill(pid, 0)) {
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index e9397dd..797fc13 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -12,8 +12,8 @@
* (ie, with fork() or clone())
* Returns 0 otherwise.
*/
-int fork_p(int sysnum)
-{
+int
+fork_p(int sysnum) {
return 0
#if defined(__NR_fork)
|| (sysnum == __NR_fork)
@@ -29,45 +29,67 @@ int fork_p(int sysnum)
/* Returns 1 if the sysnum may make the process exec other program
*/
-int exec_p(int sysnum)
-{
+int
+exec_p(int sysnum) {
return (sysnum == __NR_execve);
}
-void trace_me(void)
-{
+void
+trace_me(void) {
if (ptrace(PTRACE_TRACEME, 0, 1, 0)<0) {
perror("PTRACE_TRACEME");
exit(1);
}
}
-int trace_pid(pid_t pid)
-{
+int
+trace_pid(pid_t pid) {
if (ptrace(PTRACE_ATTACH, pid, 1, 0) < 0) {
return -1;
}
return 0;
}
-void untrace_pid(pid_t pid)
-{
+void
+untrace_pid(pid_t pid) {
ptrace(PTRACE_DETACH, pid, 1, 0);
}
-void continue_after_signal(pid_t pid, int signum)
-{
+void
+continue_after_signal(pid_t pid, int signum) {
/* We should always trace syscalls to be able to control fork(), clone(), execve()... */
ptrace(PTRACE_SYSCALL, pid, 0, signum);
}
-void continue_process(pid_t pid)
-{
+void
+continue_process(pid_t pid) {
continue_after_signal(pid, 0);
}
-void continue_enabling_breakpoint(pid_t pid, struct breakpoint * sbp)
-{
+void
+continue_enabling_breakpoint(pid_t pid, struct breakpoint * sbp) {
enable_breakpoint(pid, sbp);
continue_process(pid);
}
+
+int
+umovestr(struct process * proc, void * addr, int len, void * laddr) {
+ long a;
+ int i;
+ int offset=0;
+
+ while(offset<len) {
+ a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr+offset, 0);
+ for(i=0; i<sizeof(long); i++) {
+ if (((char*)&a)[i] && offset+i < len) {
+ *(char *)(laddr+offset+i) = ((char*)&a)[i];
+ } else {
+ *(char *)(laddr+offset+i) = '\0';
+ return 0;
+ }
+ }
+ offset += sizeof(long);
+ }
+ *(char *)(laddr+offset) = '\0';
+ return 0;
+}