From: Jim Ingham <jingham@apple.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: add set cp-abi command
Date: Thu, 14 Mar 2002 13:14:00 -0000 [thread overview]
Message-ID: <6CC0BB4C-3790-11D6-8354-000393540DDC@apple.com> (raw)
In-Reply-To: <20020313151130.B18842@nevyn.them.org>
Daniel,
On Wednesday, March 13, 2002, at 12:11 PM, Daniel Jacobowitz wrote:
> On Wed, Mar 13, 2002 at 10:56:22AM -0800, Jim Ingham wrote:
>> Hi, all...
>>
>> gdb assumes that it will never see a mix of gcc2 & gcc3 compiled C++
>> code in a single executable. So it determines which abi to use by
>> setting it to gnu-v2, and then if it EVER sees a v3 style mangled name,
>> it switches it to v3. This breaks down in the case where you have some
>> shared libraries compiled with gcc3, but the user code is compiled with
>> gcc2. This is a perfectly okay thing to do if the libraries don't
>> export any C++ symbols, but gdb will get the abi wrong, and you won't
>> be
>> able to print any C++ objects in the user code. Ouch!
>>
>> I am not currently proposing any fancy mechanism to try to switch on
>> the
>> fly between the two. The problem is temporary so I don't really think
>> it is worth the effort to cook up such a scheme. Rather, I just
>> added a
>> "set cp-abi" command so that my users can fix the problem by hand when
>> they notice it arising.
>
> We could reasonably have an ABI per-objfile. In fact, we probably
> should... it's not clear how that would interact with this patch. But
> I'm not going to ask you to do that.
Thanks... I am not sure it is really worth the effort. It is not
really something we want to encourage folks to do, after all, and in
time the issue will fade away...
>
> I think it might be wiser to have cp-abi default to "auto" and
> condition the autoselection magic based on that. Otherwise, if you set
> it to v2, it is likely to autorevert to v3 unexpectedly. Could you add
> that change?
Okay. I almost got this working last night, and thought I would have
time to finish it today, but got hung up on some other emergency...
>
>> 2002-03-12 James Ingham <jingham@apple.com>
>>
>> * cp-abi.c (set_cp_abi_cmd, show_cp_abi_cmd,
>> show_cp_abis_cmd): New functions, allow you to set & show
>> cplus abi's in case gdb gets it wrong.
>> (_initialize_cp_abi): Define the cp-abi switching commands.
>
> Also, a couple of small changes (below).
>
>> ***************
>> *** 103,109 ****
>> --- 106,164 ----
>> int i;
>> for (i = 0; i < num_cp_abis; i++)
>> if (strcmp (cp_abis[i].shortname, short_name) == 0)
>> + {
>> current_cp_abi = cp_abis[i];
>> return 1;
>> + }
>> +
>> + return 0;
>> + }
>
> Indentation, of course.
This is actually mailer mangling, it was right in the sources. $%#$#$$#
GUI mailers...
>
>> +
>> + void
>> + set_cp_abi_cmd (char *args, int from_tty)
>> + {
>> +
>> + if (!switch_to_cp_abi (args))
>> + error ("Could not find ABI: \"%s\" in ABI list\n", args);
>> + }
>> +
>> + void
>> + show_cp_abi_cmd (char *args, int from_tty)
>> + {
>> + ui_out_text (uiout, "The current cplus abi is: ");
>
> "currently selected C++ ABI", please.
As you wish...
>
>> +
>> + ui_out_field_string (uiout, "cp-abi", current_cp_abi.shortname);
>> + ui_out_text (uiout, ".\n");
>> + }
>> +
>> + void
>> + show_cp_abis_cmd (char *args, int from_tty)
>> + {
>> + int i;
>> + ui_out_text (uiout, "The valid cplus abi's are:\n");
>
> "C++ ABIs" (or ABI's? ABIs, I think, if there isn't a precedent)
We actually checked Strunk & White, and as of the mid 30's, this should
be ABIs...
>
>> +
>> + ui_out_tuple_begin (uiout, "cp-abi-list");
>> + for (i = 0; i < num_cp_abis; i++)
>> + {
>> + ui_out_field_string (uiout, "cp-abi", cp_abis[i].shortname);
>> + ui_out_text (uiout, "\n");
>> + }
>> + ui_out_tuple_end (uiout);
>> +
>> + }
>> +
>> + void
>> + _initialize_cp_abi (void)
>> + {
>> + struct cmd_list_element *cmd;
>> +
>> + cmd = add_cmd ("cp-abi", class_obscure , set_cp_abi_cmd,
>> + "Set the ABI used for inspecting C++ objects",
>> &setlist);
>> +
>> + cmd = add_cmd ("cp-abi", class_obscure, show_cp_abi_cmd,
>> + "Show the ABI used for inspecting C++ objects",
>> &showlist);
>> + cmd = add_cmd ("cp-abis", class_obscure, show_cp_abis_cmd,
>> + "List the available ABIs for inspecting C++ objects",
>> &showlist);
>
> I believe 'show cp-abi' should show the available ABIs. That's more in
> keeping with existing code.
How would you find out the current ABI, then? Probably better is to
chuck the show abis, and let "set cp-abi" (with no arguments) perform
this function. This is the way "set language" works, so it has
precedent. I was sure that there was another command that used the
singular lists current, plural lists all, but I can't find it so maybe I
was just out of my mind...
Jim
--
Jim Ingham jingham@apple.com
Developer Tools - gdb
Apple Computer
next prev parent reply other threads:[~2002-03-14 21:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-13 10:56 Jim Ingham
2002-03-13 12:11 ` Eli Zaretskii
2002-03-13 12:11 ` Daniel Jacobowitz
2002-03-14 13:14 ` Jim Ingham [this message]
2002-03-14 13:26 ` Daniel Jacobowitz
2002-03-15 15:53 ` Jim Ingham
2002-03-15 19:41 ` Daniel Jacobowitz
2002-03-18 12:01 ` Jim Ingham
2002-03-20 15:19 ` Daniel Jacobowitz
2002-03-20 19:02 ` Jim Ingham
2002-03-22 10:34 ` Daniel Jacobowitz
2002-03-22 11:04 ` Andrew Cagney
2002-03-22 11:09 ` Daniel Jacobowitz
2002-03-22 11:29 ` Jim Ingham
2002-04-09 17:27 ` Jim Ingham
2002-04-09 17:54 ` Daniel Jacobowitz
2002-04-10 11:10 ` Jim Ingham
2002-04-10 11:58 ` Daniel Jacobowitz
2002-04-09 22:33 ` Eli Zaretskii
2002-04-10 11:14 ` Jim Ingham
2002-04-11 12:25 ` Eli Zaretskii
2002-03-15 17:11 ` Jim Ingham
2002-03-14 15:29 ` Andrew Cagney
2002-03-15 10:33 ` Jim Ingham
2002-03-15 17:29 ` Andrew Cagney
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=6CC0BB4C-3790-11D6-8354-000393540DDC@apple.com \
--to=jingham@apple.com \
--cc=drow@mvista.com \
--cc=gdb-patches@sources.redhat.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