[PATCH] fix PR gdb/19914

Doug Evans dje@google.com
Fri Apr 8 22:54:00 GMT 2016


Yunlian Jiang writes:
  > Hi.
  >
  > This tries to fix PR gdb/19914. When the object file is not
  > a binary but a .debug file, the function to try to find the .dwp
  > file in the debug directory does not work. This one tries to solve
  > this problem.
  >
  > 2016-04-05  Yunlian Jiang <yunlian@google.com>
  >                * gdb/dwarf2read.c: Try to find .dwp for .debug
  >
  >
  > diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
  > index dcd49e3..551376a 100644
  > --- a/gdb/dwarf2read.c
  > +++ b/gdb/dwarf2read.c
  > @@ -10854,6 +10854,18 @@ open_and_init_dwp_file (void)
  >        dbfd = open_dwp_file (dwp_name);
  >      }
  >
  > +  if (dbfd == NULL && strlen(dwp_name) > 10)
  > +    {
  > +      /* Try to find .dwp for the debug file.  */
  > +      if (!strcmp(dwp_name + strlen(dwp_name) - 10, ".debug.dwp"))
  > +        {
  > +           dwp_name[strlen(dwp_name) - 10] = '\0';
  > +           dwp_name = xstrprintf ("%s.dwp", dwp_name);
  > +           make_cleanup (xfree, dwp_name);
  > +           dbfd = open_dwp_file (dwp_name);
  > +        }
  > +    }
  > +
  >    if (dbfd == NULL)
  >      {
  >        if (dwarf_read_debug)

Hi.

I've looked at this a little bit.
I don't have time for a complete review at the moment,
but one thing I'm wondering about is whether this extra
test should go in open_dwp_file instead.

Plus, while we're making the assumption that the separate debug
file ends with ".debug" that's not necessarily true.
Not sure we can do better, but one thought is to look in
separate_debug_objfile_backlink and use that.



More information about the Gdb-patches mailing list