This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] Debugging without a binary (regression)
- From: Pedro Alves <palves at redhat dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>, gdb-patches at sourceware dot org
- Cc: gbenson at redhat dot com
- Date: Thu, 25 Feb 2016 02:09:05 +0000
- Subject: Re: [PATCH 1/2] Debugging without a binary (regression)
- Authentication-results: sourceware.org; auth=none
- References: <1456324014-17961-1-git-send-email-lgustavo at codesourcery dot com> <56CE5399 dot 5060907 at redhat dot com> <56CE5A9E dot 6030306 at codesourcery dot com>
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