public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Guinevere Larsen <blarsen@redhat.com>, gdb-patches@sourceware.org
Cc: Simon Marchi <simark@simark.ca>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [PATCH v3] gdb: Change "list ." command's error when no debuginfo is available
Date: Fri, 10 May 2024 20:53:28 +0100	[thread overview]
Message-ID: <cbf1301d-214d-493b-9344-1944bdd1b14a@palves.net> (raw)
In-Reply-To: <20240430183557.342813-2-blarsen@redhat.com>

On 2024-04-30 19:35, Guinevere Larsen wrote:

>  	      /* The inferior is not running, so reset the current source
>  		 location to the default (usually the main function).  */
>  	      clear_current_source_symtab_and_line ();
> -	      set_default_source_symtab_and_line ();
> -	      cursal = get_current_source_symtab_and_line ();
> +	      try
> +		{
> +		  set_default_source_symtab_and_line ();
> +		}
> +	      catch (const gdb_exception &e)

Catching gdb_exception is usually a red flag.  That catches Ctrl-C and force-quit
 (for SIGTERM) too.  Please don't do that unless there's a good reason.

Maybe we should rename gdb_exception -> gdb_exception_avoid_catching_me.  :-P


> +		{
> +		  error (_("Insufficient debug info for showing source "
> +			   "lines at default location"));

Speaking of catching errors...  This looks brittle -- how can we be sure
that the error is about missing debug info?  Is this all about this error:

 void
 set_default_source_symtab_and_line (void)
 {
   if (!have_full_symbols () && !have_partial_symbols ())
     error (_("No symbol table is loaded.  Use the \"file\" command."));

?

It would be much simpler and clearer to make set_default_source_symtab_and_line
(or a variant of it) return false instead.


      parent reply	other threads:[~2024-05-10 19:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 18:35 Guinevere Larsen
2024-05-02  7:54 ` Andrew Burgess
2024-05-02 20:19   ` Guinevere Larsen
2024-05-08 14:25 ` Andrew Burgess
2024-05-08 17:13   ` Guinevere Larsen
2024-05-10  6:26     ` Tom de Vries
2024-05-10 19:53 ` 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=cbf1301d-214d-493b-9344-1944bdd1b14a@palves.net \
    --to=pedro@palves.net \
    --cc=blarsen@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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).