From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2722927340228211309==" MIME-Version: 1.0 From: Mark Wielaard To: elfutils-devel@lists.fedorahosted.org Subject: Re: [patch] Fix resolving ELF symbols for live PIDs with deleted files Date: Fri, 29 Aug 2014 11:55:32 +0200 Message-ID: <1409306132.4981.13.camel@bordewijk.wildebeest.org> In-Reply-To: 20140828201216.GA2549@host2.jankratochvil.net --===============2722927340228211309== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, 2014-08-28 at 22:12 +0200, Jan Kratochvil wrote: > Formerly shared libraries did not get resolved properly: > #2 0x00007fc4d86c56d6 > #3 0x0000000000400938 main > = > Fixed elfutils produce: > #2 0x00007f61094876d6 libfunc > #3 0x0000000000400938 main > = > Signed-off-by: Jan Kratochvil Nice, thanks. I would add the why to the commit message. "For deleted shared library files the offsets to the symbol table were calculated wrongly from the phdrs because the main_bias wasn't taken into account." +2014-08-28 Jan Kratochvil > + > + * dwfl_module_getdwarf.c (find_offsets): Add parameter main_bias, use > + it. > + (find_dynsym): Pass the new parameter main_bias. > = Looks good. +# Older Linux (such as 2.6.32) required PTRACE_ATTACH to read /proc/PID/me= m. > +sleep 60 & p=3D$!; sleep 0.1 > +addr=3D0x$(cat /proc/$p/maps|sed -n 's#^\([0-9a-f]*\)-[0-9a-f]* r[^ ]* 0= 0* .*/sleep$#\1#p'|head -n1) > +supported=3D$[$(dd if=3D/proc/$p/mem bs=3D1 skip=3D$[$addr] count=3D1|wc= -c)] > +kill -9 $p > +if [ $supported -eq 0 ]; then > + exit 77 > +fi = I don't think this check is needed. eu-stack needs to be attached to get the register values and dwfl_linux_proc_find_elf makes sure the process is attached before calling elf_from_remote_memory. Cheers, Mark --===============2722927340228211309==--