Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Andrew Burgess <andrew.burgess@embecosm.com>,
	Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Remove VEC from breakpoint
Date: Wed, 04 Jul 2018 04:40:00 -0000	[thread overview]
Message-ID: <65452ba0-5ff9-bdc6-ce43-164777e9407c@simark.ca> (raw)
In-Reply-To: <20180703143301.GA2675@embecosm.com>

On 2018-07-03 10:33 AM, Andrew Burgess wrote:
> * Tom Tromey <tom@tromey.com> [2018-06-05 13:23:16 -0600]:
> 
>> This removes a use of VEC from breakpoint.h, also removing the
>> now-unnecessary breakpoint_p typedef.
>>
>> This patch fixes a latent memory leak in
>> find_matching_tracepoint_location, which neglected to free the vector
>> returned by all_tracepoints.
>>
>> Tested by the buildbot.
>>
>> gdb/ChangeLog
>> 2018-06-05  Tom Tromey  <tom@tromey.com>
>>
>> 	* tracepoint.c (process_tracepoint_on_disconnect, start_tracing)
>> 	(stop_tracing, tstatus_command)
>> 	(find_matching_tracepoint_location, merge_uploaded_tracepoints)
>> 	(print_one_static_tracepoint_marker): Update.
>> 	* breakpoint.c (static_tracepoints_here, all_tracepoints): Return
>> 	std::vector.
>> 	* breakpoint.h (breakpoint_p): Remove typedef.  Don't declare
>> 	VEC.
>> 	(all_tracepoints, static_tracepoints_here): Return std::vector.
> 
> FWIW this looks fine to me, except for one nit below...

[snip]

>> @@ -3094,9 +3063,8 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
>>  {
>>    struct uploaded_tp *utp;
>>    /* A set of tracepoints which are modified.  */
>> -  VEC(breakpoint_p) *modified_tp = NULL;
>> +  std::vector<breakpoint *> modified_tp;
>>    int ix;
>> -  struct breakpoint *b;
> 
> The 'ix' is no longer used and could be deleted.
> 
> While I was double checking this I also spotted another 'ix' in
> merge_uploaded_trace_state_variables that's not used... :)

Agreed, the patch LGTM in any case.  Compiling tracepoint.c with -Wunused shows a
few more:


/home/simark/src/binutils-gdb/gdb/tracepoint.c:1546:32: error: unused variable 'tsv' [-Werror,-Wunused-variable]
  struct trace_state_variable *tsv;
                               ^
/home/simark/src/binutils-gdb/gdb/tracepoint.c:2755:28: error: unused variable 'default_collect_action' [-Werror,-Wunused-variable]
      struct command_line *default_collect_action;
                           ^
/home/simark/src/binutils-gdb/gdb/tracepoint.c:3067:7: error: unused variable 'ix' [-Werror,-Wunused-variable]
  int ix;
      ^
/home/simark/src/binutils-gdb/gdb/tracepoint.c:3183:7: error: unused variable 'ix' [-Werror,-Wunused-variable]
  int ix;
      ^
/home/simark/src/binutils-gdb/gdb/tracepoint.c:3686:26: error: unused variable 'b' [-Werror,-Wunused-variable]
      struct breakpoint *b;
                         ^

It looks like an obvious patch to clean these up is in order, so it doesn't really
matter if this patch or an eventual cleanup patch removes these ix variables.

Thanks!

Simon



  reply	other threads:[~2018-07-04  4:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 19:23 Tom Tromey
2018-07-03 14:33 ` Andrew Burgess
2018-07-04  4:40   ` Simon Marchi [this message]
2018-07-04  5:39     ` Tom Tromey
2018-07-04 17:29       ` Tom Tromey
2018-07-09  4:09         ` Tom Tromey
2018-07-09  4:21           ` Tom Tromey
2018-07-11  2:25             ` Simon Marchi

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=65452ba0-5ff9-bdc6-ce43-164777e9407c@simark.ca \
    --to=simark@simark.ca \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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