Re: [PATCH] Always fetch Ada "main" name from the executable

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
>>>>> "Andrew" == Andrew Burgess <[email protected]> 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 <[email protected]>

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.