This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Remove cleanups from check_fast_tracepoint_sals


On 2018-02-22 12:02 PM, Tom Tromey wrote:
> This changes the gdbarch fast_tracepoint_valid_at method to use a
> std::string as its out parameter, and then updates all the uses.  This
> allows removing a cleanup from breakpoint.c.
> 
> Regression tested by the buildbot.
> 
> ChangeLog
> 2018-02-21  Tom Tromey  <tom@tromey.com>
> 
> 	* i386-tdep.c (i386_fast_tracepoint_valid_at): "msg" now a
> 	std::string.
> 	* gdbarch.sh (fast_tracepoint_valid_at): Change "msg" to a
> 	std::string*.
> 	* gdbarch.c: Rebuild.
> 	* gdbarch.h: Rebuild.
> 	* breakpoint.c (check_fast_tracepoint_sals): Use std::string.
> 	* arch-utils.h (default_fast_tracepoint_valid_at): Update.
> 	* arch-utils.c (default_fast_tracepoint_valid_at): "msg" now a
> 	std::string*.
> ---
>  gdb/ChangeLog    | 13 +++++++++++++
>  gdb/arch-utils.c |  4 ++--
>  gdb/arch-utils.h |  2 +-
>  gdb/breakpoint.c | 12 +++---------
>  gdb/gdbarch.c    |  2 +-
>  gdb/gdbarch.h    |  4 ++--
>  gdb/gdbarch.sh   |  2 +-
>  gdb/i386-tdep.c  | 10 +++++-----
>  8 files changed, 28 insertions(+), 21 deletions(-)
> 
> diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
> index 693d7e3dc8..2ff0f4d623 100644
> --- a/gdb/arch-utils.c
> +++ b/gdb/arch-utils.c
> @@ -813,12 +813,12 @@ default_has_shared_address_space (struct gdbarch *gdbarch)
>  
>  int
>  default_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr,
> -				  char **msg)
> +				  std::string *msg)
>  {
>    /* We don't know if maybe the target has some way to do fast
>       tracepoints that doesn't need gdbarch, so always say yes.  */
>    if (msg)
> -    *msg = NULL;
> +    msg->clear ();
>    return 1;
>  }
>  
> diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
> index b51a4ec1ee..3407a165e0 100644
> --- a/gdb/arch-utils.h
> +++ b/gdb/arch-utils.h
> @@ -202,7 +202,7 @@ extern struct gdbarch *get_current_arch (void);
>  extern int default_has_shared_address_space (struct gdbarch *);
>  
>  extern int default_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
> -					     CORE_ADDR addr, char **msg);
> +					     CORE_ADDR addr, std::string *msg);
>  
>  extern const gdb_byte *default_breakpoint_from_pc (struct gdbarch *gdbarch,
>  						   CORE_ADDR *pcptr,
> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index 91ecca62fc..61c86fe5fc 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -9178,8 +9178,6 @@ check_fast_tracepoint_sals (struct gdbarch *gdbarch,
>  			    gdb::array_view<const symtab_and_line> sals)
>  {
>    int rslt;

The rslt variable can be removed.

Otherwise, LGTM.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]