Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Always fetch Ada "main" name from the executable
Date: Fri, 07 Aug 2026 07:55:23 -0600	[thread overview]
Message-ID: <87tsp6xcfo.fsf@tromey.com> (raw)
In-Reply-To: <87qzkclcm8.fsf@redhat.com> (Andrew Burgess's message of "Wed, 05 Aug 2026 18:07:43 +0100")

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew>     gdb/ada: avoid rereading stale main name data in edge case
    
Andrew> diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
Andrew> index 906c5cd3465..174e04af04c 100644
Andrew> --- a/gdb/ada-lang.c
Andrew> +++ b/gdb/ada-lang.c
Andrew> @@ -806,8 +806,7 @@ ada_main_name ()
Andrew>  					      sections)
Andrew>  	   == TARGET_XFER_OK)
Andrew>  	  && xferred > 0
Andrew> -	  && (strnlen ((char *) main_program_name, sizeof (main_program_name))
Andrew> -	      < sizeof (main_program_name)))
Andrew> +	  && (strnlen ((char *) main_program_name, xferred) < xferred))
Andrew>  	return (char *) main_program_name;
Andrew>      }

Looks good to me.

I suppose xferred < sizeof (main_program_name) and so the first strnlen
is probably now redundant.  However this doesn't really matter, the main
name is not examined very often.

Approved-By: Tom Tromey <tom@tromey.com>

Tom

  reply	other threads:[~2026-08-07 13:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 17:03 Tom Tromey
2026-07-31 10:48 ` Pedro Alves
2026-08-05 17:07 ` Andrew Burgess
2026-08-07 13:55   ` Tom Tromey [this message]
2026-08-07 15:03     ` Andrew Burgess

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=87tsp6xcfo.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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