[PATCH 1/2] Debugging without a binary (regression)

Pedro Alves palves@redhat.com
Thu Feb 25 02:09:00 GMT 2016


On 02/25/2016 01:36 AM, Luis Machado wrote:
> That's what i originally did with a single try/catch block, but i 
> noticed with two of them we are prone to having two warnings of the same 
> kind, one after the other. So i ended up leaving them empty.
> 
> For example:
> 
> warning: 
> /home/test/build-binutils-gdb/gdb/testsuite/outputs/gdb.server/attach-with-no-symbol/attach-with-no-symbol: 
> Permission denied.^M
> warning: 
> /home/test/build-binutils-gdb/gdb/testsuite/outputs/gdb.server/attach-with-no-symbol/attach-with-no-symbol: 
> Permission denied.^M
> 
> Shouldn't we go back to a single block? 

I'd think not.  Pedantically, the file could fail to load as executable
but load as symbol file.  Also, if both fail, and the errors are different,
having both may give a better hint to the user to fix whatever needs fixing.

> Checking if both exceptions' messages match seems a bit too much.

That doesn't sound so bad to me.

static int
exception_print_same (struct gdb_exception e1, struct gdb_exception e2)
{
  const char *msg1 = e1.message;
  const char *msg2 = e2.message;

  if (msg1 == NULL)
    msg1 = "";
  if (msg2 == NULL)
    msg2 = "";

   return (e1.reason == e2.reason
           && e1.error == e2.error
           && strcmp (e1.message, e2.message) == 0);
}

...
  CATCH (err, ...)
    {
      warn err;
      prev_err = err;
    }
...
  CATCH (err, ...)
    {
      if (!exception_print_same (prev_err, err))
        warn err;
    }

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list