Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
	 gdb-patches@sourceware.org,
	 Jerome Guitton <guitton@adacore.com>
Subject: Re: [RFA v2] arm-pikeos: software single step
Date: Tue, 11 Sep 2018 15:41:00 -0000	[thread overview]
Message-ID: <871sa0rqie.fsf@tromey.com> (raw)
In-Reply-To: <20180911085612.GA3379@adacore.com> (Joel Brobecker's message of	"Tue, 11 Sep 2018 10:56:12 +0200")

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> +  long max_number_of_symbols
Joel> +    = bfd_get_symtab_upper_bound (abfd) / sizeof (asymbol *);
Joel> +  if (max_number_of_symbols <= 0)
Joel> +    return GDB_OSABI_UNKNOWN;

Joel> +  std::vector<asymbol *> symbol_table (max_number_of_symbols);
Joel> +  number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table.data ());
Joel> +  if (number_of_symbols <= 0)
Joel> +    return GDB_OSABI_UNKNOWN;
Joel> +  gdb_assert (number_of_symbols <= max_number_of_symbols);
Joel> +  symbol_table.resize (number_of_symbols);

I looked, and some spots doing this just use xmalloc and manage it
manually.  machoread though uses gdb::def_vector; which is nice since it
doesn't clear the memory.

Joel> +  for (i = 0; i < number_of_symbols; i++)

If you have an explicit bound on the loop then you don't need to resize
the vector to be smaller.

No idea why it isn't working for you, the patch looks ok to me.
Sorry about this.  If you'd rather get it in, I can remove the cleanup later.

Tom


  parent reply	other threads:[~2018-09-11 15:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10 15:13 [RFA] " Joel Brobecker
2018-09-10 17:28 ` Tom Tromey
2018-09-10 17:43   ` Joel Brobecker
2018-09-10 18:39     ` [RFA v2] " y
2018-09-10 20:01       ` Simon Marchi
2018-09-10 20:53         ` Tom Tromey
2018-09-11  8:56         ` Joel Brobecker
2018-09-11  9:58           ` Simon Marchi
2018-09-11 13:51             ` Joel Brobecker
2018-09-11 15:41           ` Tom Tromey [this message]
2018-09-11 21:17             ` Joel Brobecker
2018-09-14  0:47               ` Joel Brobecker
2018-09-14 10:57                 ` Simon Marchi
2018-11-01 21:44                 ` Joel Brobecker
2018-09-11  9:08 ` [RFA] " Pedro Alves
2018-09-11 11:04   ` Joel Brobecker
2018-09-11 11:27     ` Pedro Alves
2018-09-11 20:57       ` Joel Brobecker
2018-09-12 13:22         ` Pedro Alves
2018-09-14  0:38           ` Joel Brobecker

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=871sa0rqie.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guitton@adacore.com \
    --cc=simon.marchi@polymtl.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