This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix build and tests on non-Linux (Hurd)


Hi,

On Sat, Jun 27, 2015 at 07:39:29PM +0200, Pino Toscano wrote:
> In data sabato 27 giugno 2015 15:30:00, Mark Wielaard ha scritto:
> > > The remaining issue is in src/strings.c, the unconditional usage of
> > > MAP_POPULATE. which is Linux-only. A local workaround of defining it
> > > to 0 if not already defined seemed to not cause further issues.
> > 
> > Yeah, it is slightly ugly, but it really is only a hint. So defining
> > it to zero if it isn't defined aleady seems fine. This is done on the
> > portable branch. Which I want to get rid of. So lets just do this on
> > master.
> 
> Ok -- commit attached.

Thanks. Pushed.

> > > I get a clearer error message about this with:
> > > 
> > > diff --git a/tests/allregs.c b/tests/allregs.c
> > > index 901d4e8..d3d459e 100644
> > > --- a/tests/allregs.c
> > > +++ b/tests/allregs.c
> > > @@ -158,6 +158,8 @@ main (int argc, char **argv)
> > > 
> > >    Dwfl_Module *mod = NULL;
> > >    if (dwfl_getmodules (dwfl, &first_module, &mod, 0) < 0)
> > >      error (EXIT_FAILURE, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1));
> > > +  if (mod == NULL)
> > > +    error (EXIT_FAILURE, 0, "dwfl_getmodules: module not found");
> > > 
> > >    if (remaining == argc)
> > >      {
> > 
> > Better to see first if dwfl_errno () == 0. It it is non-zero we do
> > want to print the actual error reported.
> 
> Do you mean if dwfl_getmodules fails (i.e. in the existing error()
> message), or before the check I proposed?

I meant something like:

  if (dwfl_getmodules (dwfl, &first_module, &mod, 0) < 0)
    {
      int de = dwfl_errno ();
      if (de != 0)
        error (EXIT_FAILURE, 0, "dwfl_getmodules: module not found");
      else
        error (EXIT_FAILURE, 0, "dwfl_getmodules: %s", dwfl_errmsg (de));
    }

> Also, would be an option to skip the test if no modules are available?
> Or that is considered a mandatory condition?

Maybe we could make it exit with 77 (SKIP), assuming this only happens
in the -p case. In the -e case it really should work. I would be happier
if we could also detect/report what is really going wrong (I assume
the maps file parsing).
 
> > > @@ -65,7 +65,10 @@ elfutils_open (pid_t pid, Dwarf_Addr address)
> > >      }
> > >    else
> > >      {
> > > -      Elf *elf = dwfl_module_getelf (dwfl_addrmodule (dwfl, address), &bias);
> > > +      Dwfl_Module *module = dwfl_addrmodule (dwfl, address);
> > > +      if (module == NULL)
> > > +       error (2, 0, "dwfl_addrmodule: no module available for 0x%llx", address);
> > > +      Elf *elf = dwfl_module_getelf (module, &bias);
> > >        if (elf == NULL)
> > >         error (2, 0, "dwfl_module_getelf: %s", dwfl_errmsg (-1));
> > >      }
> > 
> > That looks like the correct check to me.
> 
> OK -- commit attached.

Pushed with one change. Printing an Dwarf_Addr should be done with
PRIx64 (%llx is architecture specific).
 
> > It isn't really correct to do it that way, but we do already depend on
> > the string representation of some error messages in some other tests.
> > Lets just use it here too.
> 
> OK -- commit attached, done only in run-deleted.sh itself now (more
> logic).

Pushed.

Thanks,

Mark

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]