public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Luis Machado <lgustavo@codesourcery.com>, gdb-patches@sourceware.org
Cc: gbenson@redhat.com
Subject: Re: [PATCH 1/2] Debugging without a binary (regression)
Date: Thu, 25 Feb 2016 02:09:00 -0000	[thread overview]
Message-ID: <56CE6241.2060305@redhat.com> (raw)
In-Reply-To: <56CE5A9E.6030306@codesourcery.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

      reply	other threads:[~2016-02-25  2:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 14:27 Luis Machado
2016-02-24 14:27 ` [PATCH 2/2] Test GDB connection to GDBserver with no symbol files Luis Machado
2016-02-25  1:26   ` Pedro Alves
2016-02-25  1:06 ` [PATCH 1/2] Debugging without a binary (regression) Pedro Alves
2016-02-25  1:36   ` Luis Machado
2016-02-25  2:09     ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CE6241.2060305@redhat.com \
    --to=palves@redhat.com \
    --cc=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).