This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH, RFC] Add support for choosing disassembler cpu in GDB for POWER.
On 10/28/16 9:30 AM, Pedro Alves wrote:
On 10/28/2016 03:24 PM, Peter Bergner wrote:
On 10/28/16 9:10 AM, Pedro Alves wrote:
Maybe not. Where are the per-arch settings stored?
They're stored in the gdbarch...
You mean, as a new string member of gdbarch? That sounds
problematic, since you can have multiple different gdbarch
instances for the same architecture live at the same time.
BTC, I'm talking about where does the FOO
in "set disassembler-options FOO" end up stored.
The way the code is now, I create a static var in _initialize_disasm
to hold it:
+ static char *prospective_options = NULL;
Only after we have validated FOO is ok, I copy it to the gdbarch
+set_disassembler_options (struct gdbarch *gdbarch, char *args,
+ int from_tty, struct cmd_list_element *c)
+ char *options = *(char **)c->var;
<validate FOO and if valid...>
+ free (gdbarch_disassembler_options (gdbarch));
+ set_gdbarch_disassembler_options (gdbarch, xstrdup (options));
I didn't realize we could have multiple gdbarchs for the same
arch live at the same time. Do you have a suggestion on how
to fix this? Maybe each arch will have its own *-tdep.c global
var to hold it and maybe store a pointer to that in the gdbarch?