|
From: Konstantin S. <kon...@gm...> - 2009-05-22 07:04:20
|
On Thu, May 21, 2009 at 1:09 PM, Tom Hughes <to...@co...> wrote:
> Nicholas Nethercote wrote:
>>
>> On Wed, May 20, 2009 at 9:58 PM, Konstantin Serebryany
>> <kon...@gm...> wrote:
>>>
>>> Can valgrind driver issue a warning and exit if requested to run on a
>>> static binary (only for those tools that use LD_PRELOAD)?
>>> This will at least avoid confusion...
>>> ?
>>
>> That's a good idea. Not sure how to do it, though...
>
> Well for ELF executables the program won't have an interpreter. So something
> like this would do it:
>
> Index: coregrind/m_ume/elf.c
> ===================================================================
> --- coregrind/m_ume/elf.c (revision 10072)
> +++ coregrind/m_ume/elf.c (working copy)
> @@ -487,8 +487,10 @@
>
> VG_(free)(interp->p);
> VG_(free)(interp);
> - } else
> + } else {
> + VG_(message)(Vg_UserMsg, "Warning: %s is a static executable", name);
Thanks Tom!
This might not be 100% general (as John says), but it works for me.
Would you consider submitting this (or similar) to trunk?
--kcc
> entry = (void *)(ebase + e->e.e_entry);
> + }
>
> info->exe_base = minaddr + ebase;
> info->exe_end = maxaddr + ebase;
>
> Obviously that isn't conditional on the tool, but it shows where you need to
> be
> looking to detect if the program is statically linked.
>
> Tom
>
> --
> Tom Hughes (to...@co...)
> http://www.compton.nu/
>
|