Re: add set cp-abi command

Daniel Jacobowitz
2002-03-20T23:19:04Z

On Mon, Mar 18, 2002 at 12:01:04PM -0800, Jim Ingham wrote:
> In fact, since the ABI's are all added in _initialize functions, it would be
> even simpler just to fix the size of the array. When somebody adds the
> "last straw" ABI to gdb, we can just spit out a message saying increase this
> number, and that developer can do so and recompile. This is safe since I
> don't think we really have the intention that we are adding these things
> dynamically at runtime...

Definitely not as GDB stands, and I don't see a point. This bit is
fine.

> >
> >> const char *name = SYMBOL_NAME (&objfile->msymbols[i]);
> >> if (name[0] == '_' && name[1] == 'Z')
> >> {
> >> + if (cp_abi_is_auto_p ())
> >> switch_to_cp_abi ("gnu-v3");
> >> break;
> >> }
> >
> > This bit, of course, is great :)
>
> Way too much work to get there, however. Another point that is unclear to
> me, should this instead be:
>
> if (cp_abi_is_auto_p ())
> set_cp_abi_as_auto_default ("gnu_v3");
> break;
>
> I would have to change set_... to take the name rather than a structure, and
> look it up (and add a lookup_cp_abi to be nice). But it fits with the set
> lang more. OTOH, I have already spent more time on this that it deserves by
> a long shot, so...

I suppose that this would be best; if we set cp-abi to auto it should
remain v3.

> I am including a new patch, with just the cp-abi.c bits to keep it smaller,
> and I didn't edit this one to change the indentation goofs that the mailer
> added (I did with the last patch, oh fun...).

Mangled patches are a pain to read. If you can't get a mailer that
won't mangle it inline, can you at least get them attached in some
vaguely sane MIME-ish way?

Other than set_cp_abi_as_auto_default, my only remaining nits are
grammatical again:
! error ("Too many CP ABI's, please increase CP_ABI_MAX in cp-abi.c");

internal_error(), and "C++ ABIs".

+ if (!switch_to_cp_abi (args))
+ error ("Could not find ABI: \"%s\" in ABI list\n", args);

"Could not find \"%s\" in ABI list" (and no \n)

+ ui_out_text (uiout, "The currently selected C++ abi is: ");

"ABI", not "abi".

And show_cp_abis should probably mention "auto".

With the above changes it should be OK, although I would like to see
it. Thanks for following this through.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer