Hello community, here is the log from the commit of package ltrace checked in at Mon Nov 20 18:57:52 CET 2006. -------- --- ltrace/ltrace.changes 2006-10-12 20:59:20.000000000 +0200 +++ /mounts/work_src_done/STABLE/ltrace/ltrace.changes 2006-11-20 15:05:39.000000000 +0100 @@ -1,0 +2,5 @@ +Mon Nov 20 15:05:19 CET 2006 - olh@suse.de + +- add ltrace.trace_exec.patch (201282 - LTC25640) + +------------------------------------------------------------------- @@ -34 +39 @@ -- update to ltrace mainline r65 +- update to ltrace mainline r65 (201272) New: ---- ltrace.trace_exec.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ltrace.spec ++++++ --- /var/tmp/diff_new_pack.9UWonM/_old 2006-11-20 18:57:33.000000000 +0100 +++ /var/tmp/diff_new_pack.9UWonM/_new 2006-11-20 18:57:33.000000000 +0100 @@ -14,12 +14,12 @@ BuildRequires: gcc-c++ libelf BuildRequires: dejagnu URL: http://packages.debian.org/unstable/utils/ltrace.html -License: GPL +License: GNU General Public License (GPL) Group: Development/Tools/Debuggers Autoreqprov: on Summary: Trace the Library and System Calls a Program Makes Version: 0.4 -Release: 13 +Release: 25 BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: %ix86 sparc s390 s390x ppc ppc64 armv4l x86_64 alpha ia64 Prefix: /usr @@ -66,6 +66,7 @@ Patch139: ltrace.trunk-r68.patch Patch200: ltrace.ltrace.conf.patch Patch202: ltrace.ltrace-opd.patch +Patch203: ltrace.trace_exec.patch %description Ltrace is a program that runs the specified command until it exits. It @@ -129,6 +130,7 @@ %patch139 %patch200 -p1 %patch202 -p1 +%patch203 -p1 %build autoreconf -fi @@ -170,6 +172,8 @@ %config /etc/ltrace.conf %changelog -n ltrace +* Mon Nov 20 2006 - olh@suse.de +- add ltrace.trace_exec.patch (201282 - LTC25640) * Thu Oct 12 2006 - olh@suse.de - better opd handling add arch name to mack check results @@ -186,7 +190,7 @@ * Thu Sep 14 2006 - olh@suse.de - run make check, do not abort the build if it fails * Thu Sep 14 2006 - olh@suse.de -- update to ltrace mainline r65 +- update to ltrace mainline r65 (201272) implement ignored arguments, pointer parameters, enumerated parameters short, ushort and float types, typedefs, array arguments and struct support improve string handling @@ -228,10 +232,10 @@ - Use version number from config.h * Mon Apr 04 2005 - pth@suse.de - Update to ltrace 0.3.36: -- All SUSE patches integrated -- Alpha support, -- Uses elfutils. -- list of functions expanded. + - All SUSE patches integrated + - Alpha support, + - Uses elfutils. + - list of functions expanded. * Thu Mar 24 2005 - pth@suse.de - Adapt patch from Jakub Jellinek to make ltrace handle long/ulong values and thus work on AMD64 (#74374). ++++++ ltrace.trace_exec.patch ++++++ Bug 201282 - ltrace for execl call does not work Hello Ian, While trying out different programs with trunk-68 level, observed that ltrace is not able to trace properly a new process created by "exec" call. Output is showing "unexpected breakpoints" and library calls of the new process is not getting displayed in ppc64. I have prepared a patch for this using PTRACE_O_TRACEEXEC option. Tested this in ppc64 architecture with no make check errors. Man page of execve says "There shall be no return from a successful exec, because the calling process image is overlaid by the new process image". In S390 arch, the return value of execve is not predictable. In ppc64, the program is not even hitting Sys_ret of execve. So instead of having the processing of exec in process_sysret(), moved that block to wait_for_something.c file. I was intending to use the following explained in man page, to capture the event of execl getting executed. PTRACE_O_TRACEEXEC (since Linux 2.5.46) Stop the child at the next exec() call with SIGTRAP | PTRACE_EVENT_EXEC << 8. But unfortunately ltrace is not getting this signal. SIGTRAP is not getting modified as mentioned here during an execl call. Hence for now, for confirming whether the SIGTRAP received by ltrace is the one after execution of an execl call, the last entry in the system call stack in used. --- proc.c | 5 +++-- process_event.c | 19 ------------------- sysdeps/linux-gnu/trace.c | 5 ++++- wait_for_something.c | 23 +++++++++++++++++++++++ 4 files changed, 30 insertions(+), 22 deletions(-) Index: ltrace-0.4/proc.c =================================================================== --- ltrace-0.4.orig/proc.c +++ ltrace-0.4/proc.c @@ -22,10 +22,11 @@ struct process *open_program(char *filen } proc->filename = filename; proc->breakpoints_enabled = -1; + proc->pid = 0; + breakpoints_init(proc); if (pid) { proc->pid = pid; } - breakpoints_init(proc); proc->next = list_of_processes; list_of_processes = proc; @@ -56,5 +57,5 @@ void open_pid(pid_t pid, int verbose) #endif proc = open_program(filename, pid); - proc->breakpoints_enabled = 1; + proc->breakpoints_enabled = -1; } Index: ltrace-0.4/process_event.c =================================================================== --- ltrace-0.4.orig/process_event.c +++ ltrace-0.4/process_event.c @@ -241,25 +241,6 @@ static void process_sysret(struct event output_right(LT_TOF_SYSCALLR, event->proc, sysname(event->proc, event->e_un.sysnum)); } - if (exec_p(event->proc, event->e_un.sysnum)) { - arg_type_info info; - info.arg_num = -1; /* Return value */ - info.type = ARGTYPE_LONG; - if (gimme_arg(LT_TOF_SYSCALLR, event->proc, &info) == 0) { - pid_t saved_pid; - event->proc->mask_32bit = 0; - event->proc->personality = 0; - /* FIXME: Leak, should have arch_dep_free. - But we are leaking here much more than that. */ - event->proc->arch_ptr = NULL; - event->proc->filename = pid2name(event->proc->pid); - saved_pid = event->proc->pid; - event->proc->pid = 0; - breakpoints_init(event->proc); - event->proc->pid = saved_pid; - } else - enable_all_breakpoints(event->proc); - } continue_process(event->proc->pid); } Index: ltrace-0.4/sysdeps/linux-gnu/trace.c =================================================================== --- ltrace-0.4.orig/sysdeps/linux-gnu/trace.c +++ ltrace-0.4/sysdeps/linux-gnu/trace.c @@ -101,9 +101,12 @@ void trace_set_options(struct process *p #ifndef PTRACE_O_TRACESYSGOOD #define PTRACE_O_TRACESYSGOOD 0x00000001 #endif +#ifndef PTRACE_O_TRACEEXEC +#define PTRACE_O_TRACEEXEC 0x00000010 +#endif if (proc->tracesysgood & 0x80) return; - if (ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD) < 0 && + if (ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC) < 0 && ptrace(PTRACE_OLDSETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD) < 0) { perror("PTRACE_SETOPTIONS"); return; Index: ltrace-0.4/wait_for_something.c =================================================================== --- ltrace-0.4.orig/wait_for_something.c +++ ltrace-0.4/wait_for_something.c @@ -92,6 +92,29 @@ struct event *wait_for_something(void) event.e_un.signum = WSTOPSIG(status); return &event; } + if (WSTOPSIG(status) == SIGTRAP){ + /* Check whether this SIGTRAP is received just after execve is called for this process */ + struct callstack_element *elem; + + elem = &event.proc->callstack[event.proc->callstack_depth - 1]; + if( elem && elem->is_syscall && exec_p(event.proc, elem->c_un.syscall)){ + pid_t saved_pid; + + event.thing = LT_EV_NONE; + event.e_un.signum = WSTOPSIG(status); + event.proc->mask_32bit = 0; + event.proc->personality = 0; + event.proc->arch_ptr = NULL; + event.proc->filename = pid2name(event.proc->pid); + saved_pid = event.proc->pid; + event.proc->pid = 0; + breakpoints_init(event.proc); + event.proc->pid = saved_pid; + continue_after_signal(event.proc->pid, event.e_un.signum); + return &event; + } + } + event.thing = LT_EV_BREAKPOINT; if (!event.proc->instruction_pointer) { event.proc->instruction_pointer = ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org