<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 25, 2016, at 4:39 PM, Zachary Turner <<a href="mailto:zturner@google.com" class="">zturner@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Any particular reason this has the word Itanium baked into the name of the class </div></div></blockquote><div><br class=""></div><div>The name of the C++ language runtime is ItaniumABI</div><div>I don’t think we have a language runtime for the C++ MSVC ABI</div><div>We can revisit where this command lives at that time</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">and description?</div></div></blockquote><div><br class=""></div><div>It shouldn’t - it should be “language cplusplus demangle”, no mention of Itanium</div><div>If you are referring to the description of the plugin overall, that is correct, and should stay as-is</div><div><br class=""></div><div>Again, the hierarchy can be revisited when a C++ MSVC ABI runtime plugin exists.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""> MSVC doesn't use the Itanium ABI, but but AFAICT from looking at this code, it should work for MSVC's abi as well. <div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>I have no way to test it, but I would assume so, yes.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Sicne this command isn't actually Itanium ABI specific, I don't think it should make references to Itanium ABI in its C++ class name </div></div></div></blockquote><div><br class=""></div><div>This seems nitpicking to me, since the entire file is named ItaniumABILanguageRuntime.cpp</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">or help / description</div></div></div></blockquote><div><br class=""></div><div>I don’t think it does</div><br class=""><blockquote type="cite" class=""><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Mar 25, 2016 at 4:19 PM Enrico Granata via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: enrico<br class="">
Date: Fri Mar 25 18:14:24 2016<br class="">
New Revision: 264474<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=264474&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=264474&view=rev</a><br class="">
Log:<br class="">
Add a 'language cplusplus demangle' command. This can be useful to provide a low-friction reproduction for issues with the LLDB demangling of C++ symbols<br class="">
<br class="">
Modified:<br class="">
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp<br class="">
<br class="">
Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=264474&r1=264473&r2=264474&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=264474&r1=264473&r2=264474&view=diff</a><br class="">
==============================================================================<br class="">
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)<br class="">
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Fri Mar 25 18:14:24 2016<br class="">
@@ -13,11 +13,15 @@<br class="">
#include "lldb/Core/ConstString.h"<br class="">
#include "lldb/Core/Error.h"<br class="">
#include "lldb/Core/Log.h"<br class="">
+#include "lldb/Core/Mangled.h"<br class="">
#include "lldb/Core/Module.h"<br class="">
#include "lldb/Core/PluginManager.h"<br class="">
#include "lldb/Core/Scalar.h"<br class="">
#include "lldb/Core/ValueObject.h"<br class="">
#include "lldb/Core/ValueObjectMemory.h"<br class="">
+#include "lldb/Interpreter/CommandObject.h"<br class="">
+#include "lldb/Interpreter/CommandObjectMultiword.h"<br class="">
+#include "lldb/Interpreter/CommandReturnObject.h"<br class="">
#include "lldb/Symbol/ClangASTContext.h"<br class="">
#include "lldb/Symbol/Symbol.h"<br class="">
#include "lldb/Symbol/SymbolFile.h"<br class="">
@@ -340,12 +344,96 @@ ItaniumABILanguageRuntime::CreateInstanc<br class="">
return NULL;<br class="">
}<br class="">
<br class="">
+class CommandObjectMultiwordItaniumABI_Demangle : public CommandObjectParsed<br class="">
+{<br class="">
+public:<br class="">
+ CommandObjectMultiwordItaniumABI_Demangle (CommandInterpreter &interpreter) :<br class="">
+ CommandObjectParsed (interpreter,<br class="">
+ "demangle",<br class="">
+ "Demangle a C++ mangled name.",<br class="">
+ "language cplusplus demangle")<br class="">
+ {<br class="">
+ CommandArgumentEntry arg;<br class="">
+ CommandArgumentData index_arg;<br class="">
+<br class="">
+ // Define the first (and only) variant of this arg.<br class="">
+ index_arg.arg_type = eArgTypeSymbol;<br class="">
+ index_arg.arg_repetition = eArgRepeatPlus;<br class="">
+<br class="">
+ // There is only one variant this argument could be; put it into the argument entry.<br class="">
+ arg.push_back (index_arg);<br class="">
+<br class="">
+ // Push the data for the first argument into the m_arguments vector.<br class="">
+ m_arguments.push_back (arg);<br class="">
+ }<br class="">
+<br class="">
+ ~CommandObjectMultiwordItaniumABI_Demangle() override = default;<br class="">
+<br class="">
+protected:<br class="">
+ bool<br class="">
+ DoExecute(Args& command, CommandReturnObject &result) override<br class="">
+ {<br class="">
+ bool demangled_any = false;<br class="">
+ bool error_any = false;<br class="">
+ for (size_t i = 0; i < command.GetArgumentCount(); i++)<br class="">
+ {<br class="">
+ auto arg = command.GetArgumentAtIndex(i);<br class="">
+ if (arg && *arg)<br class="">
+ {<br class="">
+ ConstString mangled_cs(arg);<br class="">
+<br class="">
+ // the actual Mangled class should be strict about this, but on the command line<br class="">
+ // if you're copying mangled names out of 'nm' on Darwin, they will come out with<br class="">
+ // an extra underscore - be willing to strip this on behalf of the user<br class="">
+ // This is the moral equivalent of the -_/-n options to c++filt<br class="">
+ if (mangled_cs.GetStringRef().startswith("__Z"))<br class="">
+ mangled_cs.SetCString(arg+1);<br class="">
+<br class="">
+ Mangled mangled(mangled_cs, true);<br class="">
+ if (mangled.GuessLanguage() == lldb::eLanguageTypeC_plus_plus)<br class="">
+ {<br class="">
+ ConstString demangled(mangled.GetDisplayDemangledName(lldb::eLanguageTypeC_plus_plus));<br class="">
+ demangled_any = true;<br class="">
+ result.AppendMessageWithFormat("%s ---> %s\n", arg, demangled.GetCString());<br class="">
+ }<br class="">
+ else<br class="">
+ {<br class="">
+ error_any = true;<br class="">
+ result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n", arg);<br class="">
+ }<br class="">
+ }<br class="">
+ }<br class="">
+<br class="">
+ result.SetStatus(error_any ? lldb::eReturnStatusFailed :<br class="">
+ (demangled_any ? lldb::eReturnStatusSuccessFinishResult : lldb::eReturnStatusSuccessFinishNoResult));<br class="">
+ return result.Succeeded();<br class="">
+ }<br class="">
+};<br class="">
+<br class="">
+class CommandObjectMultiwordItaniumABI : public CommandObjectMultiword<br class="">
+{<br class="">
+public:<br class="">
+ CommandObjectMultiwordItaniumABI (CommandInterpreter &interpreter) :<br class="">
+ CommandObjectMultiword (interpreter,<br class="">
+ "cplusplus",<br class="">
+ "A set of commands for operating on the C++ Language Runtime.",<br class="">
+ "cplusplus <subcommand> [<subcommand-options>]")<br class="">
+ {<br class="">
+ LoadSubCommand ("demangle", CommandObjectSP (new CommandObjectMultiwordItaniumABI_Demangle (interpreter)));<br class="">
+ }<br class="">
+<br class="">
+ ~CommandObjectMultiwordItaniumABI() override = default;<br class="">
+};<br class="">
+<br class="">
void<br class="">
ItaniumABILanguageRuntime::Initialize()<br class="">
{<br class="">
PluginManager::RegisterPlugin (GetPluginNameStatic(),<br class="">
"Itanium ABI for the C++ language",<br class="">
- CreateInstance);<br class="">
+ CreateInstance,<br class="">
+ [] (CommandInterpreter& interpreter) -> lldb::CommandObjectSP {<br class="">
+ return CommandObjectSP(new CommandObjectMultiwordItaniumABI(interpreter));<br class="">
+ });<br class="">
}<br class="">
<br class="">
void<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
lldb-commits mailing list<br class="">
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank" class="">lldb-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""><div class="">
<div class="" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline">Thanks,</div><div class="" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><i class="">- Enrico</i><br class="">📩 egranata@<font color="#ff2600" class=""></font>.com ☎️ 27683</div>
</div>
<br class=""></body></html>