Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: strace completion (Re: grouping/joining _values)
- X-seq: zsh-users 12977
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: strace completion (Re: grouping/joining _values)
- Date: Wed, 18 Jun 2008 12:29:22 +0100
- In-reply-to: <20080615124959.GT5113@xxxxxxxxxxxxxxx>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080613113302.GA40053@xxxxxxxxxxxxxxxxxxxx> <20080613121226.GA18890@xxxxxxxx> <20080613131851.GA12764@xxxxxxxxxxxxxxxxxxxx> <20080613160458.GM5113@xxxxxxxxxxxxxxx> <20080613191905.GN5113@xxxxxxxxxxxxxxx> <20080613235914.GP5113@xxxxxxxxxxxxxxx> <20080614084949.GQ5113@xxxxxxxxxxxxxxx> <080614084154.ZM11958@xxxxxxxxxxxxxxxxxxxxxx> <20080615083712.GR5113@xxxxxxxxxxxxxxx> <20080615124959.GT5113@xxxxxxxxxxxxxxx>
On Sun, Jun 15, 2008 at 01:49:59PM +0100, Stephane Chazelas wrote:
> On Sun, Jun 15, 2008 at 09:37:12AM +0100, Stephane Chazelas wrote:
> [...]
> > how disapointing. Could you please send me your binary of strace
> > so that I can try and understand how this can happen?
> >
> > I was quite confident it would work as it worked on old RHEL
> > x86, new debian x86 and old Solaris sparc (with truss).
> [...]
>
> You must be on x86_64? I observe the same on
> td152.testdrive.hp.com (debian)
>
> Anyway, I also found that if it's built without optimisation or
> older gccs, it fails early because strcmp is then called and
> strace fails before it have a chance to compare the system
> call names.
[...]
I found a way to work around those problems.
Bart's problem was due (I think) to "prelink" (which
short-circuits dynamic name resolution) and can be worked around
by undoing the prelink with prelink -u. The second can be worked
around by replacing strcmp with rename (a syscall so something
that strace can trace), make sure the first renames don't fail
by touching the relevant files and then use strace to trace the
other renames and get the syscall from there.
Of course, it's probably still precarious. I've tested it on
Linux on i386, x86_64 and ia64, redhat and debian.
list_strace_syscalls() {
tmp==(:)
rm -f -- "$tmp"
(umask 077 && exec mkdir -- "$tmp") || return
(
cd -P -- "$tmp" || return
zmodload -i zsh/mapfile || return
print -rn -- "${mapfile[/usr/bin/strace]//strcmp/rename}" > strace || return
chmod +x strace
PATH=$PATH:/usr/sbin:/sbin:/usr/local/sbin prelink -u strace 2> /dev/null
touch time all none
/usr/bin/strace -e rename ./strace -e xxx |&
awk -F\" '/xxx/{print $4}' | sort -u
)
local ret="$?"
rm -rf "$tmp"
return "$ret"
}
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author