aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
l---------ChangeLog1
-rw-r--r--Makefile.in2
-rwxr-xr-xconfigure53
-rw-r--r--configure.in3
-rw-r--r--debian/changelog7
-rwxr-xr-xdebian/rules2
-rw-r--r--etc/ltrace.conf1
-rw-r--r--ltrace.17
-rw-r--r--ltrace.spec49
-rw-r--r--options.c10
-rw-r--r--options.h1
-rw-r--r--output.c28
12 files changed, 133 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
new file mode 120000
index 0000000..d526672
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1 @@
+debian/changelog \ No newline at end of file
diff --git a/Makefile.in b/Makefile.in
index 6e878ca..7a582d7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -40,7 +40,7 @@ install: ltrace
@INSTALL@ -d $(DESTDIR)/etc
@INSTALL@ -s ltrace $(DESTDIR)/usr/bin
@INSTALL@ -m 644 etc/ltrace.conf $(DESTDIR)/etc
- @INSTALL@ -m 644 COPYING README TODO BUGS $(DESTDIR)/usr/doc/ltrace
+ @INSTALL@ -m 644 COPYING README TODO BUGS ChangeLog $(DESTDIR)/usr/doc/ltrace
@INSTALL@ -m 644 ltrace.1 $(DESTDIR)/usr/man/man1
dummy:
diff --git a/configure b/configure
index f495703..f420dfe 100755
--- a/configure
+++ b/configure
@@ -822,6 +822,9 @@ echo $ac_n "checking ltrace version""... $ac_c" 1>&6
echo "configure:823: checking ltrace version" >&5
ltrace_version=`sed -n '1s/ltrace (\([0-9.]\+\)).*/\1/p' ${srcdir}/debian/changelog`
+sed -e "s/^%define version .*$/%define version ${ltrace_version}/" \
+ < ${srcdir}/ltrace.spec > ${srcdir}/ltrace.spec2
+mv ltrace.spec2 ltrace.spec
cat >> confdefs.h <<EOF
#define VERSION "$ltrace_version"
@@ -831,7 +834,7 @@ echo "$ac_t""$ltrace_version" 1>&6
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:835: checking how to run the C preprocessor" >&5
+echo "configure:838: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -846,13 +849,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 850 "configure"
+#line 853 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -863,13 +866,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 867 "configure"
+#line 870 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -892,12 +895,12 @@ fi
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:896: checking for ANSI C header files" >&5
+echo "configure:899: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 901 "configure"
+#line 904 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -905,7 +908,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:909: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -922,7 +925,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 926 "configure"
+#line 929 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -940,7 +943,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 944 "configure"
+#line 947 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -961,7 +964,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 965 "configure"
+#line 968 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -972,7 +975,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -999,17 +1002,17 @@ for ac_hdr in getopt.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1003: checking for $ac_hdr" >&5
+echo "configure:1006: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1008 "configure"
+#line 1011 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1036,12 +1039,12 @@ fi
done
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1040: checking for working const" >&5
+echo "configure:1043: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1045 "configure"
+#line 1048 "configure"
#include "confdefs.h"
int main() {
@@ -1090,7 +1093,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:1094: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1097: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -1111,12 +1114,12 @@ EOF
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:1115: checking for uid_t in sys/types.h" >&5
+echo "configure:1118: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1120 "configure"
+#line 1123 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -1145,12 +1148,12 @@ EOF
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1149: checking for pid_t" >&5
+echo "configure:1152: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1154 "configure"
+#line 1157 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1180,12 +1183,12 @@ fi
for ac_func in getopt getopt_long
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1184: checking for $ac_func" >&5
+echo "configure:1187: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1189 "configure"
+#line 1192 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1208,7 +1211,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
diff --git a/configure.in b/configure.in
index 12abe97..89f342b 100644
--- a/configure.in
+++ b/configure.in
@@ -12,6 +12,9 @@ AC_CHECK_LIB(iberty, cplus_demangle)
AC_MSG_CHECKING(ltrace version)
changequote(<<, >>)
ltrace_version=`sed -n '1s/ltrace (\([0-9.]\+\)).*/\1/p' ${srcdir}/debian/changelog`
+sed -e "s/^%define version .*$/%define version ${ltrace_version}/" \
+ < ${srcdir}/ltrace.spec > ${srcdir}/ltrace.spec2
+mv ltrace.spec2 ltrace.spec
changequote([, ])
AC_DEFINE_UNQUOTED(VERSION,"$ltrace_version")
AC_MSG_RESULT($ltrace_version)
diff --git a/debian/changelog b/debian/changelog
index 108922d..e6fceac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ltrace (0.3.4) unstable; urgency=low
+
+ * Added "ltrace.spec" to build a .rpm binary file.
+ * Added "-r" option
+
+ -- Juan Cespedes <cespedes@debian.org> Sun, 20 Sep 1998 21:22:05 +0200
+
ltrace (0.3.3) unstable; urgency=low
* Fixed a little bug in display_string
diff --git a/debian/rules b/debian/rules
index 87dfe4f..e5f9e32 100755
--- a/debian/rules
+++ b/debian/rules
@@ -31,7 +31,7 @@ binary-arch: build
cp debian/conffiles debian/tmp/DEBIAN
$(MAKE) install DESTDIR=`pwd`/debian/tmp
$(RM) debian/tmp/usr/doc/ltrace/COPYING
- cp -p debian/changelog debian/tmp/usr/doc/ltrace
+ mv debian/tmp/usr/doc/ltrace/ChangeLog debian/tmp/usr/doc/ltrace/changelog
gzip -9f debian/tmp/usr/doc/ltrace/README debian/tmp/usr/doc/ltrace/changelog
cp -p debian/copyright debian/tmp/usr/doc/ltrace
gzip -9f debian/tmp/usr/man/man1/*
diff --git a/etc/ltrace.conf b/etc/ltrace.conf
index 1d9c177..38ae931 100644
--- a/etc/ltrace.conf
+++ b/etc/ltrace.conf
@@ -196,6 +196,7 @@ int fchdir(int);
int fork(void);
int ftruncate(int,uint);
string2 getcwd(addr,uint);
+int getdomainname(+string2,int);
int geteuid(void);
int getegid(void);
int getgid(void);
diff --git a/ltrace.1 b/ltrace.1
index f84ab4d..3264929 100644
--- a/ltrace.1
+++ b/ltrace.1
@@ -6,7 +6,7 @@ ltrace \- A library call tracer
.SH SYNOPSIS
.B ltrace
-.I "[-dfiLStttChV] [-a column] [-s strsize] [-o filename] [-u username] [-p pid] ... [-e expr] [--debug] [--demangle] [--align=column] [--output=filename] [--help] [--version] [command [arg ...]]"
+.I "[-dfiLSrtttChV] [-a column] [-s strsize] [-o filename] [-u username] [-p pid] ... [-e expr] [--debug] [--demangle] [--align=column] [--output=filename] [--help] [--version] [command [arg ...]]"
.SH DESCRIPTION
.B ltrace
@@ -42,6 +42,11 @@ option).
.I \-S
Display system calls as well as library calls
.TP
+.I \-r
+Print a relative timestamp with each line of the trace.
+This records the time difference between the beginning of
+successive lines.
+.TP
.I \-t
Prefix each line of the trace with the time of day.
.TP
diff --git a/ltrace.spec b/ltrace.spec
new file mode 100644
index 0000000..edef6dd
--- /dev/null
+++ b/ltrace.spec
@@ -0,0 +1,49 @@
+Summary: A library call tracer
+Name: ltrace
+%define version 0.3.4
+Version: %{version}
+Release: 1
+Copyright: GPL
+Group: Development/Debuggers
+Source: ftp://ftp.debian.org/debian/dists/unstable/main/source/utils/ltrace_%{version}.tar.gz
+BuildRoot: /tmp/ltrace
+
+%description
+ltrace is a library call tracer, i.e. a debugging tool which prints out
+a trace of all the dynamic library calls made by another process/program.
+
+It also displays system calls, as well as `strace', but strace still
+does a better job displaying arguments to system calls.
+
+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.
+
+This is still a work in progress, so some things may fail or don't work
+as expected.
+
+%changelog
+%prep
+%setup
+
+%build
+./configure --prefix=/usr
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+gzip -9 $RPM_BUILD_ROOT/usr/doc/ltrace/ChangeLog
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%config /etc/ltrace.conf
+/usr/bin/ltrace
+/usr/doc/ltrace/ChangeLog.gz
+/usr/doc/ltrace/BUGS
+/usr/doc/ltrace/COPYING
+/usr/doc/ltrace/README
+/usr/doc/ltrace/TODO
+/usr/man/man1/ltrace.1
diff --git a/options.c b/options.c
index fe74dc6..025e909 100644
--- a/options.c
+++ b/options.c
@@ -26,6 +26,7 @@ int opt_S = 0; /* display syscalls */
int opt_L = 1; /* display library calls */
int opt_f = 0; /* trace child processes as they are created */
char * opt_u = NULL; /* username to run command as */
+int opt_r = 0; /* print relative timestamp */
int opt_t = 0; /* print absolute timestamp */
#if HAVE_LIBIBERTY
int opt_C = 0; /* Demangle low-level symbol names into user-level names */
@@ -56,6 +57,7 @@ static void usage(void)
" -i print instruction pointer at time of library call.\n"
" -L do NOT display library calls.\n"
" -S display system calls.\n"
+" -r print relative timestamps.\n"
" -t, -tt, -ttt print absolute timestamps.\n"
# if HAVE_LIBIBERTY
# if HAVE_GETOPT_LONG
@@ -140,7 +142,7 @@ char ** process_options(int argc, char **argv)
{ "version", 0, 0, 'V'},
{ 0, 0, 0, 0}
};
- c = getopt_long(argc, argv, "+dfiLSthV"
+ c = getopt_long(argc, argv, "+dfiLSrthV"
# if HAVE_LIBIBERTY
"C"
# endif
@@ -166,6 +168,8 @@ char ** process_options(int argc, char **argv)
break;
case 'S': opt_S = 1;
break;
+ case 'r': opt_r++;
+ break;
case 't': opt_t++;
break;
#if HAVE_LIBIBERTY
@@ -265,6 +269,10 @@ char ** process_options(int argc, char **argv)
#endif
exit(1);
}
+ if (opt_r && opt_t) {
+ fprintf(stderr, "%s: Incompatible options -r and -t\n", progname);
+ exit(1);
+ }
if (argc>0) {
command = search_for_command(argv[0]);
}
diff --git a/options.h b/options.h
index 881465a..f4fbc96 100644
--- a/options.h
+++ b/options.h
@@ -13,6 +13,7 @@ extern int opt_L; /* display library calls */
extern int opt_S; /* display system calls */
extern int opt_f; /* trace child processes */
extern char * opt_u; /* username to run command as */
+extern int opt_r; /* print relative timestamp */
extern int opt_t; /* print absolute timestamp */
#if HAVE_LIBIBERTY
extern int opt_C; /* Demanglelow-level symbol names into user-level names */
diff --git a/output.c b/output.c
index 856f43c..a16a29a 100644
--- a/output.c
+++ b/output.c
@@ -30,20 +30,44 @@ static void begin_of_line(enum tof type, struct process * proc)
} else if (list_of_processes->next) {
current_column += fprintf(output, "[pid %u] ", proc->pid);
}
+ if (opt_r) {
+ struct timeval tv;
+ struct timezone tz;
+ static struct timeval old_tv={0,0};
+ struct timeval diff;
+
+ gettimeofday(&tv, &tz);
+
+ if (old_tv.tv_sec==0 && old_tv.tv_usec==0) {
+ old_tv.tv_sec=tv.tv_sec;
+ old_tv.tv_usec=tv.tv_usec;
+ }
+ diff.tv_sec = tv.tv_sec - old_tv.tv_sec;
+ if (tv.tv_usec >= old_tv.tv_usec) {
+ diff.tv_usec = tv.tv_usec - old_tv.tv_usec;
+ } else {
+ diff.tv_sec++;
+ diff.tv_usec = 1000000 + tv.tv_usec - old_tv.tv_usec;
+ }
+ old_tv.tv_sec = tv.tv_sec;
+ old_tv.tv_usec = tv.tv_usec;
+ current_column += fprintf(output, "%3lu.%06d ",
+ diff.tv_sec, (int)diff.tv_usec);
+ }
if (opt_t) {
struct timeval tv;
struct timezone tz;
- struct tm * tmp;
gettimeofday(&tv, &tz);
- tmp = localtime(&tv.tv_sec);
if (opt_t>2) {
current_column += fprintf(output, "%lu.%06d ",
tv.tv_sec, (int)tv.tv_usec);
} else if (opt_t>1) {
+ struct tm * tmp = localtime(&tv.tv_sec);
current_column += fprintf(output, "%02d:%02d:%02d.%06d ",
tmp->tm_hour, tmp->tm_min, tmp->tm_sec, (int)tv.tv_usec);
} else {
+ struct tm * tmp = localtime(&tv.tv_sec);
current_column += fprintf(output, "%02d:%02d:%02d ",
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
}