[Lldb-commits] [PATCH] D52651: Add functionality to export settings
JDevlieghere updated this revision to Diff 167889. JDevlieghere added a comment. Thanks a lot for the feedback! I clearly overlooked some stuff when inspiring myself on the other CommandObject code. I've updated the diff: - Rename functionality to read and write for consistency with breakpoints. - Add `settings read` instead of having to source the exported file. - Deal with zero or multiple arguments. (This is now valid input) - Fix completion for file path. - Go through FileSpec to ensure `~` is expanded. - Add more tests. https://reviews.llvm.org/D52651 Files: include/lldb/Interpreter/OptionValue.h lit/Settings/TestExport.test source/Commands/CommandObjectSettings.cpp source/Interpreter/OptionValueArray.cpp source/Interpreter/OptionValueDictionary.cpp source/Interpreter/OptionValueFileSpecLIst.cpp source/Interpreter/OptionValueFormatEntity.cpp source/Interpreter/OptionValueLanguage.cpp source/Interpreter/Property.cpp Index: source/Interpreter/Property.cpp === --- source/Interpreter/Property.cpp +++ source/Interpreter/Property.cpp @@ -233,7 +233,10 @@ uint32_t dump_mask) const { if (m_value_sp) { const bool dump_desc = dump_mask & OptionValue::eDumpOptionDescription; +const bool dump_cmd = dump_mask & OptionValue::eDumpOptionCommand; const bool transparent = m_value_sp->ValueIsTransparent(); +if (dump_cmd && !transparent) + strm << "settings set "; if (dump_desc || !transparent) { if ((dump_mask & OptionValue::eDumpOptionName) && m_name) { DumpQualifiedName(strm); Index: source/Interpreter/OptionValueLanguage.cpp === --- source/Interpreter/OptionValueLanguage.cpp +++ source/Interpreter/OptionValueLanguage.cpp @@ -28,7 +28,8 @@ if (dump_mask & eDumpOptionValue) { if (dump_mask & eDumpOptionType) strm.PutCString(" = "); -strm.PutCString(Language::GetNameForLanguageType(m_current_value)); +if (m_current_value != eLanguageTypeUnknown) + strm.PutCString(Language::GetNameForLanguageType(m_current_value)); } } Index: source/Interpreter/OptionValueFormatEntity.cpp === --- source/Interpreter/OptionValueFormatEntity.cpp +++ source/Interpreter/OptionValueFormatEntity.cpp @@ -61,10 +61,10 @@ strm.Printf("(%s)", GetTypeAsCString()); if (dump_mask & eDumpOptionValue) { if (dump_mask & eDumpOptionType) - strm.PutCString(" = \""); + strm.PutCString(" = "); std::string escaped; EscapeBackticks(m_current_format, escaped); -strm << escaped << '"'; +strm << '"' << escaped << '"'; } } Index: source/Interpreter/OptionValueFileSpecLIst.cpp === --- source/Interpreter/OptionValueFileSpecLIst.cpp +++ source/Interpreter/OptionValueFileSpecLIst.cpp @@ -25,16 +25,24 @@ if (dump_mask & eDumpOptionType) strm.Printf("(%s)", GetTypeAsCString()); if (dump_mask & eDumpOptionValue) { -if (dump_mask & eDumpOptionType) - strm.Printf(" =%s", m_current_value.GetSize() > 0 ? "\n" : ""); -strm.IndentMore(); +const bool one_line = dump_mask & eDumpOptionCommand; const uint32_t size = m_current_value.GetSize(); +if (dump_mask & eDumpOptionType) + strm.Printf(" =%s", + (m_current_value.GetSize() > 0 && !one_line) ? "\n" : ""); +if (!one_line) + strm.IndentMore(); for (uint32_t i = 0; i < size; ++i) { - strm.Indent(); - strm.Printf("[%u]: ", i); + if (!one_line) { +strm.Indent(); +strm.Printf("[%u]: ", i); + } m_current_value.GetFileSpecAtIndex(i).Dump(&strm); + if (one_line) +strm << ' '; } -strm.IndentLess(); +if (!one_line) + strm.IndentLess(); } } Index: source/Interpreter/OptionValueDictionary.cpp === --- source/Interpreter/OptionValueDictionary.cpp +++ source/Interpreter/OptionValueDictionary.cpp @@ -33,16 +33,23 @@ strm.Printf("(%s)", GetTypeAsCString()); } if (dump_mask & eDumpOptionValue) { +const bool one_line = dump_mask & eDumpOptionCommand; if (dump_mask & eDumpOptionType) strm.PutCString(" ="); collection::iterator pos, end = m_values.end(); -strm.IndentMore(); +if (!one_line) + strm.IndentMore(); for (pos = m_values.begin(); pos != end; ++pos) { OptionValue *option_value = pos->second.get(); - strm.EOL(); + + if (one_line) +strm << ' '; + else +strm.EOL(); + strm.Indent(pos->first.GetCString()); const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0; @@ -74,7 +81,8 @@ break; } } -strm.IndentLess(); +if (!one_line) + strm.IndentLess();
[Lldb-commits] [PATCH] D52772: [Settings] Make "settings set" without a value equivalent to "settings clear"
JDevlieghere created this revision. JDevlieghere added a reviewer: LLDB. I want to make providing no value to `setting set ` equivalent to clearing that setting: `settings clear `. The motivation is https://reviews.llvm.org/D52651 that allows settings to be written to and read from a file. Not all settings have a default or empty value that can be read again, for example enums where the default is not valid value (unknown for target.language) or strings where the empty string is not equal to an empty option. - One possible alternative is giving every option an explicit and valid default. From a user perspective I don't think this is a good idea. For `target.language` it doesn't make sense to have `unknown` in the list of options. - The alternative is changing all the dump methods to print `settings clear ` for the `eDumpOptionCommand`. Personally I don't like adding too much logic to the dump methods. I definitely share the feeling that it's unfortunate to have two methods of doing the same thing. However, I don't think this behavior is counter intuitive and a reasonable trade-off given the current situation. Repository: rLLDB LLDB https://reviews.llvm.org/D52772 Files: source/Commands/CommandObjectSettings.cpp Index: source/Commands/CommandObjectSettings.cpp === --- source/Commands/CommandObjectSettings.cpp +++ source/Commands/CommandObjectSettings.cpp @@ -38,7 +38,9 @@ public: CommandObjectSettingsSet(CommandInterpreter &interpreter) : CommandObjectRaw(interpreter, "settings set", - "Set the value of the specified debugger setting."), + "Set the value of the specified debugger setting. " + "Providing no value is equivalent to \"settings " + "clear\"."), m_options() { CommandArgumentEntry arg1; CommandArgumentEntry arg2; @@ -185,7 +187,7 @@ return false; const size_t argc = cmd_args.GetArgumentCount(); -if ((argc < 2) && (!m_options.m_global)) { +if ((argc < 1) && (!m_options.m_global)) { result.AppendError("'settings set' takes more arguments"); result.SetStatus(eReturnStatusFailed); return false; @@ -199,6 +201,18 @@ return false; } +// A missing value corresponds to clearing the setting. +if (argc == 1) { + Status error(m_interpreter.GetDebugger().SetPropertyValue( + &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef())); + if (error.Fail()) { +result.AppendError(error.AsCString()); +result.SetStatus(eReturnStatusFailed); +return false; + } + return result.Succeeded(); +} + // Split the raw command into var_name and value pair. llvm::StringRef raw_str(command); std::string var_value_string = raw_str.split(var_name).second.str(); Index: source/Commands/CommandObjectSettings.cpp === --- source/Commands/CommandObjectSettings.cpp +++ source/Commands/CommandObjectSettings.cpp @@ -38,7 +38,9 @@ public: CommandObjectSettingsSet(CommandInterpreter &interpreter) : CommandObjectRaw(interpreter, "settings set", - "Set the value of the specified debugger setting."), + "Set the value of the specified debugger setting. " + "Providing no value is equivalent to \"settings " + "clear\"."), m_options() { CommandArgumentEntry arg1; CommandArgumentEntry arg2; @@ -185,7 +187,7 @@ return false; const size_t argc = cmd_args.GetArgumentCount(); -if ((argc < 2) && (!m_options.m_global)) { +if ((argc < 1) && (!m_options.m_global)) { result.AppendError("'settings set' takes more arguments"); result.SetStatus(eReturnStatusFailed); return false; @@ -199,6 +201,18 @@ return false; } +// A missing value corresponds to clearing the setting. +if (argc == 1) { + Status error(m_interpreter.GetDebugger().SetPropertyValue( + &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef())); + if (error.Fail()) { +result.AppendError(error.AsCString()); +result.SetStatus(eReturnStatusFailed); +return false; + } + return result.Succeeded(); +} + // Split the raw command into var_name and value pair. llvm::StringRef raw_str(command); std::string var_value_string = raw_str.split(var_name).second.str(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52651: Add functionality to export settings
JDevlieghere updated this revision to Diff 167892. JDevlieghere marked 2 inline comments as done. JDevlieghere added a comment. Split off `settings set` change into separate review: https://reviews.llvm.org/D52772 https://reviews.llvm.org/D52651 Files: include/lldb/Interpreter/OptionValue.h lit/Settings/TestExport.test source/Commands/CommandObjectSettings.cpp source/Interpreter/OptionValueArray.cpp source/Interpreter/OptionValueDictionary.cpp source/Interpreter/OptionValueFileSpecLIst.cpp source/Interpreter/OptionValueFormatEntity.cpp source/Interpreter/OptionValueLanguage.cpp source/Interpreter/Property.cpp Index: source/Interpreter/Property.cpp === --- source/Interpreter/Property.cpp +++ source/Interpreter/Property.cpp @@ -233,7 +233,10 @@ uint32_t dump_mask) const { if (m_value_sp) { const bool dump_desc = dump_mask & OptionValue::eDumpOptionDescription; +const bool dump_cmd = dump_mask & OptionValue::eDumpOptionCommand; const bool transparent = m_value_sp->ValueIsTransparent(); +if (dump_cmd && !transparent) + strm << "settings set "; if (dump_desc || !transparent) { if ((dump_mask & OptionValue::eDumpOptionName) && m_name) { DumpQualifiedName(strm); Index: source/Interpreter/OptionValueLanguage.cpp === --- source/Interpreter/OptionValueLanguage.cpp +++ source/Interpreter/OptionValueLanguage.cpp @@ -28,7 +28,8 @@ if (dump_mask & eDumpOptionValue) { if (dump_mask & eDumpOptionType) strm.PutCString(" = "); -strm.PutCString(Language::GetNameForLanguageType(m_current_value)); +if (m_current_value != eLanguageTypeUnknown) + strm.PutCString(Language::GetNameForLanguageType(m_current_value)); } } Index: source/Interpreter/OptionValueFormatEntity.cpp === --- source/Interpreter/OptionValueFormatEntity.cpp +++ source/Interpreter/OptionValueFormatEntity.cpp @@ -61,10 +61,10 @@ strm.Printf("(%s)", GetTypeAsCString()); if (dump_mask & eDumpOptionValue) { if (dump_mask & eDumpOptionType) - strm.PutCString(" = \""); + strm.PutCString(" = "); std::string escaped; EscapeBackticks(m_current_format, escaped); -strm << escaped << '"'; +strm << '"' << escaped << '"'; } } Index: source/Interpreter/OptionValueFileSpecLIst.cpp === --- source/Interpreter/OptionValueFileSpecLIst.cpp +++ source/Interpreter/OptionValueFileSpecLIst.cpp @@ -25,16 +25,24 @@ if (dump_mask & eDumpOptionType) strm.Printf("(%s)", GetTypeAsCString()); if (dump_mask & eDumpOptionValue) { -if (dump_mask & eDumpOptionType) - strm.Printf(" =%s", m_current_value.GetSize() > 0 ? "\n" : ""); -strm.IndentMore(); +const bool one_line = dump_mask & eDumpOptionCommand; const uint32_t size = m_current_value.GetSize(); +if (dump_mask & eDumpOptionType) + strm.Printf(" =%s", + (m_current_value.GetSize() > 0 && !one_line) ? "\n" : ""); +if (!one_line) + strm.IndentMore(); for (uint32_t i = 0; i < size; ++i) { - strm.Indent(); - strm.Printf("[%u]: ", i); + if (!one_line) { +strm.Indent(); +strm.Printf("[%u]: ", i); + } m_current_value.GetFileSpecAtIndex(i).Dump(&strm); + if (one_line) +strm << ' '; } -strm.IndentLess(); +if (!one_line) + strm.IndentLess(); } } Index: source/Interpreter/OptionValueDictionary.cpp === --- source/Interpreter/OptionValueDictionary.cpp +++ source/Interpreter/OptionValueDictionary.cpp @@ -33,16 +33,23 @@ strm.Printf("(%s)", GetTypeAsCString()); } if (dump_mask & eDumpOptionValue) { +const bool one_line = dump_mask & eDumpOptionCommand; if (dump_mask & eDumpOptionType) strm.PutCString(" ="); collection::iterator pos, end = m_values.end(); -strm.IndentMore(); +if (!one_line) + strm.IndentMore(); for (pos = m_values.begin(); pos != end; ++pos) { OptionValue *option_value = pos->second.get(); - strm.EOL(); + + if (one_line) +strm << ' '; + else +strm.EOL(); + strm.Indent(pos->first.GetCString()); const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0; @@ -74,7 +81,8 @@ break; } } -strm.IndentLess(); +if (!one_line) + strm.IndentLess(); } } Index: source/Interpreter/OptionValueArray.cpp === --- source/Interpreter/OptionValueArray.cpp +++ source/Interpreter/OptionValueArray.cpp @@ -31,13 +31,17 @@ strm.Printf("(%s)", GetTypeAsCString()); } if (dump_mask & eDumpOptionValue
[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process
labath added a comment. In https://reviews.llvm.org/D52618#1250909, @zturner wrote: > One idea would be to define some lit substitutions like %debuginfo. It’s > true you can produce a gcc style command line that will be equivalent to a > clang-cl invocation but it won’t be easy. eg you’ll needing to pass > -fms-compatibility as well as various -I for includes. > > It may be easier to have substitutions instead Using substitutions SGTM. I am not sure if this is a good idea, but it had occured to me that we could put `-fms-compatibility` and friends into a substitution of it's own, which would be computed by lit (through some equivalent of `clang++ -###` ?). That way, the tests could still use g++ syntax, only the command lines would contain an extra `%cflags` argument. This has the advantage of extra flexibility over a predefined set of compile commands (%compile_with_debug, %compile_without_debug, ...), and it might be sufficient to make cross-compiling work, if we ever need it. https://reviews.llvm.org/D52618 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52678: DWARFExpression: Resolve file addresses in the linked module
aprantl added a comment. I could move it further up in the same function if that is what you mean? Then it would also apply to (hypothetical local variables that refer to a DW_OP_addr). I could imagine that this might be useful in some languages that want to refer to some static type metadata. https://reviews.llvm.org/D52678 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343598 - Delete /lldb/tmp directory created in r324484.
Author: jyknight Date: Tue Oct 2 08:41:00 2018 New Revision: 343598 URL: http://llvm.org/viewvc/llvm-project?rev=343598&view=rev Log: Delete /lldb/tmp directory created in r324484. Was checked into a wrong place in the depot, and untouched since. Likely created by accident. Removed: lldb/tmp/ ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52678: DWARFExpression: Resolve file addresses in the linked module
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Jim: we are already linking the address for the DW_OP_addr using the debug map and no .o files are currently expected to be able to link an unlinked address into a file address as nothing in the .o file knows about the existence of the debug map object file, so this is the right fix. https://reviews.llvm.org/D52678 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52772: [Settings] Make "settings set" without a value equivalent to "settings clear"
jingham added a comment. Would it be possible for the exporter to notice empty settings and write "settings clear" instead? I'm worried that if you have a complicated setting, and the you do: (lldb) settings set target.some-complex-setting and decide you are wrong, you don't want to change the complex setting, then you have to know to delete the text - hitting a return is actually destructive. Repository: rLLDB LLDB https://reviews.llvm.org/D52772 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52678: DWARFExpression: Resolve file addresses in the linked module
jingham added a comment. I was thinking more like if it's possible to figure out that a given module has a debug_map parent, "SetModule" could automatically redirect to the that module. Then all clients have to do is SetModule with the module they have to hand and it would get the right thing. That's why I asked if there was ever a case where we'd want to run a DWARF expression using the .o file module when there's a parent debug_map. But maybe that's overthinking it. https://reviews.llvm.org/D52678 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
sgraenitz created this revision. sgraenitz added reviewers: aprantl, jasonmolenda, JDevlieghere. sgraenitz added a subscriber: LLDB. Add settings to control command echoing: (lldb) settings set interpreter.echo-commands true (lldb) settings set interpreter.echo-comment-commands true Both settings default to true, which keeps LLDB's existing behavior in non-interactive mode (echo all command inputs to the output). So far the only way to change this behavior was the `--source-quietly` flag, which disables all output including evaluation results. Now `echo-commands` allows to turn off echoing for commands, while evaluation results are still printed. No effect if `--source-quietly` was present. `echo-comment-commands` allows to turn off echoing for commands in case they are pure comment lines. No effect if `echo-commands` is false. Note that the behavior does not change immediately! The new settings take effect only with the next command source. LLDB lit test are the main motivation for this feature. So far incoming `#CHECK` line have always been echoed to the output and so they could never fail. Now we can disable it in lit-lldb-init. Todos: Finish test for this feature. Add to lit-lldb-init. Check for failing lit tests. https://reviews.llvm.org/D52788 Files: include/lldb/API/SBCommandInterpreter.h include/lldb/Interpreter/CommandInterpreter.h source/API/SBCommandInterpreter.cpp source/Commands/CommandObjectCommands.cpp source/Interpreter/CommandInterpreter.cpp Index: source/Interpreter/CommandInterpreter.cpp === --- source/Interpreter/CommandInterpreter.cpp +++ source/Interpreter/CommandInterpreter.cpp @@ -89,13 +89,20 @@ nullptr, {}, "If true, LLDB will stop running a 'command source' " "script upon encountering an error."}, {"space-repl-prompts", OptionValue::eTypeBoolean, true, false, nullptr, {}, - "If true, blank lines will be printed between between REPL submissions."}}; + "If true, blank lines will be printed between between REPL submissions."}, +{"echo-commands", OptionValue::eTypeBoolean, true, true, nullptr, {}, + "If true, LLDB will print a command before it is evaluated."}, +{"echo-comment-commands", OptionValue::eTypeBoolean, true, true, nullptr, + {}, "If true, LLDB will print a command even if it is a pure comment " + "line."}}; enum { ePropertyExpandRegexAliases = 0, ePropertyPromptOnQuit = 1, ePropertyStopCmdSourceOnError = 2, - eSpaceReplPrompts = 3 + eSpaceReplPrompts = 3, + eEchoCommands = 4, + eEchoCommentCommands = 5 }; ConstString &CommandInterpreter::GetStaticBroadcasterClass() { @@ -142,6 +149,28 @@ m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); } +bool CommandInterpreter::GetEchoCommands() const { + const uint32_t idx = eEchoCommands; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_properties[idx].default_uint_value != 0); +} + +void CommandInterpreter::SetEchoCommands(bool b) { + const uint32_t idx = eEchoCommands; + m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); +} + +bool CommandInterpreter::GetEchoCommentCommands() const { + const uint32_t idx = eEchoCommentCommands; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_properties[idx].default_uint_value != 0); +} + +void CommandInterpreter::SetEchoCommentCommands(bool b) { + const uint32_t idx = eEchoCommentCommands; + m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); +} + void CommandInterpreter::AllowExitCodeOnQuit(bool allow) { m_allow_exit_code = allow; if (!allow) @@ -2296,8 +2325,9 @@ eHandleCommandFlagStopOnContinue = (1u << 0), eHandleCommandFlagStopOnError = (1u << 1), eHandleCommandFlagEchoCommand = (1u << 2), - eHandleCommandFlagPrintResult = (1u << 3), - eHandleCommandFlagStopOnCrash = (1u << 4) + eHandleCommandFlagEchoCommentCommand = (1u << 3), + eHandleCommandFlagPrintResult = (1u << 4), + eHandleCommandFlagStopOnCrash = (1u << 5) }; void CommandInterpreter::HandleCommandsFromFile( @@ -2361,6 +2391,19 @@ flags |= eHandleCommandFlagEchoCommand; } + // We will only ever ask for this flag, if we echo commands in general. + if (options.m_echo_comment_commands == eLazyBoolCalculate) { +if (m_command_source_flags.empty()) { + // Echo command by default + flags |= eHandleCommandFlagEchoCommentCommand; +} else if (m_command_source_flags.back() & + eHandleCommandFlagEchoCommentCommand) { + flags |= eHandleCommandFlagEchoCommentCommand; +} + } else if (options.m_echo_comment_commands == eLazyBoolYes) { +flags |= eHandleCommandFlagEchoCommentCommand; + } + if (options.m_print_results == eLazyBoolCalculate) { if (m_command_source_flags.empty()) { // Print output by default
[Lldb-commits] [lldb] r343609 - Remove GetPythonDir declaration from HostInfoBase class
Author: tkrasnukha Date: Tue Oct 2 10:24:58 2018 New Revision: 343609 URL: http://llvm.org/viewvc/llvm-project?rev=343609&view=rev Log: Remove GetPythonDir declaration from HostInfoBase class Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfoBase.h?rev=343609&r1=343608&r2=343609&view=diff == --- lldb/trunk/include/lldb/Host/HostInfoBase.h (original) +++ lldb/trunk/include/lldb/Host/HostInfoBase.h Tue Oct 2 10:24:58 2018 @@ -75,10 +75,6 @@ public: /// member of the FileSpec is filled in. static FileSpec GetHeaderDir(); - /// Returns the directory containing the python modules. Only the directory - /// member of the FileSpec is filled in. - static FileSpec GetPythonDir(); - /// Returns the directory containing the system plugins. Only the directory /// member of the FileSpec is filled in. static FileSpec GetSystemPluginDir(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
sgraenitz updated this revision to Diff 167976. sgraenitz added a comment. Fix CommandInterpreterRunOptions::GetStopOnError() https://reviews.llvm.org/D52788 Files: include/lldb/API/SBCommandInterpreter.h include/lldb/Interpreter/CommandInterpreter.h source/API/SBCommandInterpreter.cpp source/Commands/CommandObjectCommands.cpp source/Interpreter/CommandInterpreter.cpp Index: source/Interpreter/CommandInterpreter.cpp === --- source/Interpreter/CommandInterpreter.cpp +++ source/Interpreter/CommandInterpreter.cpp @@ -89,13 +89,20 @@ nullptr, {}, "If true, LLDB will stop running a 'command source' " "script upon encountering an error."}, {"space-repl-prompts", OptionValue::eTypeBoolean, true, false, nullptr, {}, - "If true, blank lines will be printed between between REPL submissions."}}; + "If true, blank lines will be printed between between REPL submissions."}, +{"echo-commands", OptionValue::eTypeBoolean, true, true, nullptr, {}, + "If true, LLDB will print a command before it is evaluated."}, +{"echo-comment-commands", OptionValue::eTypeBoolean, true, true, nullptr, + {}, "If true, LLDB will print a command even if it is a pure comment " + "line."}}; enum { ePropertyExpandRegexAliases = 0, ePropertyPromptOnQuit = 1, ePropertyStopCmdSourceOnError = 2, - eSpaceReplPrompts = 3 + eSpaceReplPrompts = 3, + eEchoCommands = 4, + eEchoCommentCommands = 5 }; ConstString &CommandInterpreter::GetStaticBroadcasterClass() { @@ -142,6 +149,28 @@ m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); } +bool CommandInterpreter::GetEchoCommands() const { + const uint32_t idx = eEchoCommands; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_properties[idx].default_uint_value != 0); +} + +void CommandInterpreter::SetEchoCommands(bool b) { + const uint32_t idx = eEchoCommands; + m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); +} + +bool CommandInterpreter::GetEchoCommentCommands() const { + const uint32_t idx = eEchoCommentCommands; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_properties[idx].default_uint_value != 0); +} + +void CommandInterpreter::SetEchoCommentCommands(bool b) { + const uint32_t idx = eEchoCommentCommands; + m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); +} + void CommandInterpreter::AllowExitCodeOnQuit(bool allow) { m_allow_exit_code = allow; if (!allow) @@ -2296,8 +2325,9 @@ eHandleCommandFlagStopOnContinue = (1u << 0), eHandleCommandFlagStopOnError = (1u << 1), eHandleCommandFlagEchoCommand = (1u << 2), - eHandleCommandFlagPrintResult = (1u << 3), - eHandleCommandFlagStopOnCrash = (1u << 4) + eHandleCommandFlagEchoCommentCommand = (1u << 3), + eHandleCommandFlagPrintResult = (1u << 4), + eHandleCommandFlagStopOnCrash = (1u << 5) }; void CommandInterpreter::HandleCommandsFromFile( @@ -2361,6 +2391,19 @@ flags |= eHandleCommandFlagEchoCommand; } + // We will only ever ask for this flag, if we echo commands in general. + if (options.m_echo_comment_commands == eLazyBoolCalculate) { +if (m_command_source_flags.empty()) { + // Echo command by default + flags |= eHandleCommandFlagEchoCommentCommand; +} else if (m_command_source_flags.back() & + eHandleCommandFlagEchoCommentCommand) { + flags |= eHandleCommandFlagEchoCommentCommand; +} + } else if (options.m_echo_comment_commands == eLazyBoolYes) { +flags |= eHandleCommandFlagEchoCommentCommand; + } + if (options.m_print_results == eLazyBoolCalculate) { if (m_command_source_flags.empty()) { // Print output by default @@ -2682,6 +2725,25 @@ } } +bool CommandInterpreter::EchoCommandNonInteractive( +const std::string &line, const Flags &io_handler_flags) const { + if (!io_handler_flags.Test(eHandleCommandFlagEchoCommand)) +return false; + + const char *k_space_characters = "\t\n\v\f\r "; + size_t first_non_space = line.find_first_not_of(k_space_characters); + + // Empty line? + if (first_non_space == std::string::npos) +return true; + + // Comment line? + if (line[first_non_space] == m_comment_char) +return io_handler_flags.Test(eHandleCommandFlagEchoCommentCommand); + + return true; // Everything else +} + void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler, std::string &line) { // If we were interrupted, bail out... @@ -2700,7 +2762,7 @@ // When using a non-interactive file handle (like when sourcing commands // from a file) we need to echo the command out so we don't just see the // command output and no command... -if (io_handler.GetFlags().Test(eHandleCommandFlagEchoCommand)) +if (EchoCommandNonInter
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
sgraenitz added inline comments. Comment at: include/lldb/Interpreter/CommandInterpreter.h:105 - bool GetStopOnError() const { return DefaultToNo(m_stop_on_continue); } + bool GetStopOnError() const { return DefaultToNo(m_stop_on_error); } Unrelated fix Comment at: source/API/SBCommandInterpreter.cpp:81 +} + bool SBCommandInterpreterRunOptions::GetPrintResults() const { Added this for symmetry with EchoCommands. Do we actually need it? Comment at: source/Interpreter/CommandInterpreter.cpp:2330 + eHandleCommandFlagPrintResult = (1u << 4), + eHandleCommandFlagStopOnCrash = (1u << 5) }; These values are never stored/serialized right? Comment at: source/Interpreter/CommandInterpreter.cpp:2417 flags |= eHandleCommandFlagPrintResult; } Could reduce boilerplate in the code above. Just wonder whether there is anything special about `GetStopOnCrash()` or if I could handle it like all the others? Looks no different to `GetStopOnError()`. https://reviews.llvm.org/D52788 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343612 - DWARFExpression: Resolve file addresses in the linked module
Author: adrian Date: Tue Oct 2 10:50:42 2018 New Revision: 343612 URL: http://llvm.org/viewvc/llvm-project?rev=343612&view=rev Log: DWARFExpression: Resolve file addresses in the linked module This is a follow-up to https://reviews.llvm.org/D46362. When evaluating a complex expression in DWARFExpression::Evaluate, file addresses must be resolved to load addresses before we can perform operations such as DW_OP_deref on them. For this the address goes through three steps 1. Read the file address as stored in the DWARF 2. Link/relocate the file address (when reading from a .dSYM, this is a no-op) 3. Convert the file address to a load address. D46362 implemented step (3) by resolving the file address using the Module that the original DWARF came from. In the case of a dSYM that is correct, but when reading from .o files, we need to look up relocated/linked addresses, so the right place to look them up is the current frame's module. This patch fixes that by setting the expression's Module to point to the linked debugmap object. A word a bout the unorthodox testcase: The motivating testcase for this fix is in Swift, but I managed to hand-modify LLVM-IR for a trivial C program to exhibit the same problem, so we can fix this in llvm.org. rdar://problem/44689915 Differential Revision: https://reviews.llvm.org/D52678 Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.c lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll Modified: lldb/trunk/include/lldb/Expression/DWARFExpression.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/include/lldb/Expression/DWARFExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/DWARFExpression.h?rev=343612&r1=343611&r2=343612&view=diff == --- lldb/trunk/include/lldb/Expression/DWARFExpression.h (original) +++ lldb/trunk/include/lldb/Expression/DWARFExpression.h Tue Oct 2 10:50:42 2018 @@ -152,6 +152,8 @@ public: lldb::addr_t GetLocation_DW_OP_addr(uint32_t op_addr_idx, bool &error) const; bool Update_DW_OP_addr(lldb::addr_t file_addr); + + void SetModule(const lldb::ModuleSP &module) { m_module_wp = module; } bool ContainsThreadLocalStorage() const; Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/Makefile?rev=343612&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/Makefile Tue Oct 2 10:50:42 2018 @@ -0,0 +1,10 @@ +LEVEL = ../../make + +include $(LEVEL)/Makefile.rules + +a.out: globals.ll + $(CC) $(CFLAGS) -g -c $^ -o globals.o + $(LD) $(LDFLAGS) -g globals.o -o $@ + +clean:: + rm -rf globals.o a.out *.dSYM Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py?rev=343612&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py Tue Oct 2 10:50:42 2018 @@ -0,0 +1,22 @@ +""" +Test that target var can resolve complex DWARF expressions. +""" + +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class targetCommandTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessDarwin +@skipIfDarwinEmbedded # needs x86_64 +@skipIf(debug_info="gmodules") # not relevant +def testTargetVarExpr(self): +self.build() +lldbutil.run_to_name_breakpoint(self, 'main') +self.expect("target variable i", substrs=['i', '42']) Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.c?rev=343612&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.c (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/
[Lldb-commits] [PATCH] D52678: DWARFExpression: Resolve file addresses in the linked module
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB343612: DWARFExpression: Resolve file addresses in the linked module (authored by adrian, committed by ). Herald added a subscriber: teemperor. Changed prior to commit: https://reviews.llvm.org/D52678?vs=167827&id=167981#toc Repository: rLLDB LLDB https://reviews.llvm.org/D52678 Files: include/lldb/Expression/DWARFExpression.h packages/Python/lldbsuite/test/functionalities/target_var/Makefile packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py packages/Python/lldbsuite/test/functionalities/target_var/globals.c packages/Python/lldbsuite/test/functionalities/target_var/globals.ll source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: packages/Python/lldbsuite/test/functionalities/target_var/Makefile === --- packages/Python/lldbsuite/test/functionalities/target_var/Makefile +++ packages/Python/lldbsuite/test/functionalities/target_var/Makefile @@ -0,0 +1,10 @@ +LEVEL = ../../make + +include $(LEVEL)/Makefile.rules + +a.out: globals.ll + $(CC) $(CFLAGS) -g -c $^ -o globals.o + $(LD) $(LDFLAGS) -g globals.o -o $@ + +clean:: + rm -rf globals.o a.out *.dSYM Index: packages/Python/lldbsuite/test/functionalities/target_var/globals.ll === --- packages/Python/lldbsuite/test/functionalities/target_var/globals.ll +++ packages/Python/lldbsuite/test/functionalities/target_var/globals.ll @@ -0,0 +1,42 @@ +source_filename = "globals.c" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.14.0" + +@i = global i32 42, align 4 +@p = global i32* @i, align 8, !dbg !0, !dbg !6 + +; Function Attrs: noinline nounwind optnone ssp uwtable +define i32 @main() #0 !dbg !15 { +entry: + %retval = alloca i32, align 4 + store i32 0, i32* %retval, align 4 + %0 = load i32*, i32** @p, align 8, !dbg !18 + %1 = load i32, i32* %0, align 4, !dbg !18 + ret i32 %1, !dbg !18 +} + +attributes #0 = { noinline nounwind optnone ssp uwtable } + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!10, !11, !12, !13} +!llvm.ident = !{!14} + +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression(DW_OP_deref)) +!1 = distinct !DIGlobalVariable(name: "i", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, emissionKind: FullDebug, globals: !5, nameTableKind: None) +!3 = !DIFile(filename: "globals.c", directory: "/") +!4 = !{} +!5 = !{!0, !6} +!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) +!7 = distinct !DIGlobalVariable(name: "p", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: true) +!8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64) +!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!10 = !{i32 2, !"Dwarf Version", i32 4} +!11 = !{i32 2, !"Debug Info Version", i32 3} +!12 = !{i32 1, !"wchar_size", i32 4} +!13 = !{i32 7, !"PIC Level", i32 2} +!14 = !{!"clang version 8.0.0 (trunk 340838) (llvm/trunk 340843)"} +!15 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 4, type: !16, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: false, unit: !2, retainedNodes: !4) +!16 = !DISubroutineType(types: !17) +!17 = !{!9} +!18 = !DILocation(line: 5, scope: !15) Index: packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py === --- packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py +++ packages/Python/lldbsuite/test/functionalities/target_var/TestTargetVar.py @@ -0,0 +1,22 @@ +""" +Test that target var can resolve complex DWARF expressions. +""" + +import lldb +import sys +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class targetCommandTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessDarwin +@skipIfDarwinEmbedded # needs x86_64 +@skipIf(debug_info="gmodules") # not relevant +def testTargetVarExpr(self): +self.build() +lldbutil.run_to_name_breakpoint(self, 'main') +self.expect("target variable i", substrs=['i', '42']) Index: packages/Python/lldbsuite/test/functionalities/target_var/globals.c === --- packages/Python/lldbsuite/test/functionalities/target_var/globals.c +++ packages/Python/lldbsuite/test/functionalities/target_var/globals.c @@ -0,0 +1,6 @@ +int i = 42; +int *p = &i; + +int main() { + return *p; +} Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDW
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
jingham added a comment. The StopOnCrash logic is slightly different. Because the outer if is "GetStopOnCrash()" you will only set stop on crash if it is set at this level and was set in the previously pushed flag set. That forces StopOnCrash to be set from the top all the way down. For StopOnError, the outermost if checks if the option is set, so you will inherit the previous flag set's behavior if the option is unset at this level. StopOnCrash is used for the --batch mode of the lldb driver, so it has to propagate to any newly sourced sets of commands for it to be useful. It does need this different kind of setting. https://reviews.llvm.org/D52788 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
shafik added inline comments. Comment at: source/Interpreter/CommandInterpreter.cpp:2733 + + const char *k_space_characters = "\t\n\v\f\r "; + size_t first_non_space = line.find_first_not_of(k_space_characters); This looks like duplicate code from from `HandleCommand` I also see that at the the top of the file there is `k_white_space` although I am not sure why it is not in a anonymous namespace and why perhaps it is not a `ConstString` Comment at: source/Interpreter/CommandInterpreter.cpp:2939 flags |= eHandleCommandFlagEchoCommand; + if (options->m_echo_commands != eLazyBoolNo) +flags |= eHandleCommandFlagEchoCommentCommand; Should this be `m_echo_comment_commands`? https://reviews.llvm.org/D52788 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
shafik added inline comments. Comment at: source/Interpreter/CommandInterpreter.cpp:96 +{"echo-comment-commands", OptionValue::eTypeBoolean, true, true, nullptr, + {}, "If true, LLDB will print a command even if it is a pure comment " + "line."}}; extra space between pure and comment https://reviews.llvm.org/D52788 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
sgraenitz updated this revision to Diff 167995. sgraenitz added a comment. Add tests, address some of the feedback from Jim and Shafik https://reviews.llvm.org/D52788 Files: include/lldb/API/SBCommandInterpreter.h include/lldb/Interpreter/CommandInterpreter.h lit/Settings/Inputs/EchoCommandsTest.script lit/Settings/Inputs/EchoCommandsTest.script.txt lit/Settings/TestEchoAllCommands.test lit/Settings/TestEchoNoCommands.test lit/Settings/TestEchoNoComments.test lit/Settings/TestEchoNothing.test source/API/SBCommandInterpreter.cpp source/Commands/CommandObjectCommands.cpp source/Interpreter/CommandInterpreter.cpp Index: source/Interpreter/CommandInterpreter.cpp === --- source/Interpreter/CommandInterpreter.cpp +++ source/Interpreter/CommandInterpreter.cpp @@ -89,13 +89,20 @@ nullptr, {}, "If true, LLDB will stop running a 'command source' " "script upon encountering an error."}, {"space-repl-prompts", OptionValue::eTypeBoolean, true, false, nullptr, {}, - "If true, blank lines will be printed between between REPL submissions."}}; + "If true, blank lines will be printed between between REPL submissions."}, +{"echo-commands", OptionValue::eTypeBoolean, true, true, nullptr, {}, + "If true, LLDB will print a command before it is evaluated."}, +{"echo-comment-commands", OptionValue::eTypeBoolean, true, true, nullptr, + {}, "If true, LLDB will print a command even if it is a pure comment " + "line."}}; enum { ePropertyExpandRegexAliases = 0, ePropertyPromptOnQuit = 1, ePropertyStopCmdSourceOnError = 2, - eSpaceReplPrompts = 3 + eSpaceReplPrompts = 3, + eEchoCommands = 4, + eEchoCommentCommands = 5 }; ConstString &CommandInterpreter::GetStaticBroadcasterClass() { @@ -142,6 +149,28 @@ m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); } +bool CommandInterpreter::GetEchoCommands() const { + const uint32_t idx = eEchoCommands; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_properties[idx].default_uint_value != 0); +} + +void CommandInterpreter::SetEchoCommands(bool b) { + const uint32_t idx = eEchoCommands; + m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); +} + +bool CommandInterpreter::GetEchoCommentCommands() const { + const uint32_t idx = eEchoCommentCommands; + return m_collection_sp->GetPropertyAtIndexAsBoolean( + nullptr, idx, g_properties[idx].default_uint_value != 0); +} + +void CommandInterpreter::SetEchoCommentCommands(bool b) { + const uint32_t idx = eEchoCommentCommands; + m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b); +} + void CommandInterpreter::AllowExitCodeOnQuit(bool allow) { m_allow_exit_code = allow; if (!allow) @@ -2296,8 +2325,9 @@ eHandleCommandFlagStopOnContinue = (1u << 0), eHandleCommandFlagStopOnError = (1u << 1), eHandleCommandFlagEchoCommand = (1u << 2), - eHandleCommandFlagPrintResult = (1u << 3), - eHandleCommandFlagStopOnCrash = (1u << 4) + eHandleCommandFlagEchoCommentCommand = (1u << 3), + eHandleCommandFlagPrintResult = (1u << 4), + eHandleCommandFlagStopOnCrash = (1u << 5) }; void CommandInterpreter::HandleCommandsFromFile( @@ -2339,9 +2369,10 @@ flags |= eHandleCommandFlagStopOnError; } + // stop-on-crash can only be set, if it is present in all levels of + // pushed flag sets. if (options.GetStopOnCrash()) { if (m_command_source_flags.empty()) { - // Echo command by default flags |= eHandleCommandFlagStopOnCrash; } else if (m_command_source_flags.back() & eHandleCommandFlagStopOnCrash) { @@ -2361,6 +2392,19 @@ flags |= eHandleCommandFlagEchoCommand; } + // We will only ever ask for this flag, if we echo commands in general. + if (options.m_echo_comment_commands == eLazyBoolCalculate) { +if (m_command_source_flags.empty()) { + // Echo comments by default + flags |= eHandleCommandFlagEchoCommentCommand; +} else if (m_command_source_flags.back() & + eHandleCommandFlagEchoCommentCommand) { + flags |= eHandleCommandFlagEchoCommentCommand; +} + } else if (options.m_echo_comment_commands == eLazyBoolYes) { +flags |= eHandleCommandFlagEchoCommentCommand; + } + if (options.m_print_results == eLazyBoolCalculate) { if (m_command_source_flags.empty()) { // Print output by default @@ -2682,6 +2726,25 @@ } } +bool CommandInterpreter::EchoCommandNonInteractive( +const std::string &line, const Flags &io_handler_flags) const { + if (!io_handler_flags.Test(eHandleCommandFlagEchoCommand)) +return false; + + const char *k_space_characters = "\t\n\v\f\r "; + size_t first_non_space = line.find_first_not_of(k_space_characters); + + // Empty line? + if (first_non_space
[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process
zturner added a comment. In https://reviews.llvm.org/D52618#1252372, @labath wrote: > In https://reviews.llvm.org/D52618#1250909, @zturner wrote: > > > One idea would be to define some lit substitutions like %debuginfo. It’s > > true you can produce a gcc style command line that will be equivalent to a > > clang-cl invocation but it won’t be easy. eg you’ll needing to pass > > -fms-compatibility as well as various -I for includes. > > > > It may be easier to have substitutions instead > > > Using substitutions SGTM. > > I am not sure if this is a good idea, but it had occured to me that we could > put `-fms-compatibility` and friends into a substitution of it's own, which > would be computed by lit (through some equivalent of `clang++ -###` ?). That > way, the tests could still use g++ syntax, only the command lines would > contain an extra `%cflags` argument. This has the advantage of extra > flexibility over a predefined set of compile commands (%compile_with_debug, > %compile_without_debug, ...), and it might be sufficient to make > cross-compiling work, if we ever need it. Another idea I just thought of, which would basically be the heaviest hammer possible and give the most flexibility is to modify the lit infrastructure (just for lldb, not all of llvm) to look for a `compiler_config.py` file. If it finds it, it can run the file. This file could define whatever substitutions it wanted. In the top-level LLDB lit configuration, we could provide some basic common infrastructure to easily support common use cases. I don't have specifics in mind for how the implementation would look like, but from a user point of view (i.e. what the `compiler_config.py` would look like), I'm imagining you could write something like this: # compiler_config.py global compiler_config compiler_config.create_configuration( "fooconfig", # user can reference this config as 'fooconfig' from a test file. driver=best,# use clang-cl on Windows, clang++ otherwise debug=True, # pass /Z7 on Windows, -g otherwise optlevel=1, # pass /O2 on Windows, -O2 otherwise output_type=sharedlib, # pass -fPIC on Linux and /D_DLL on Windows exceptions=False, # pass -fno-exceptions on Linux, /EHs-c- on Windows rtti=False, # pass -fno-rtti on Linux, /GR- on Windows mode=compile-only) # Don't run the linker compiler_config.create_configuration( "barconfig", # user can reference this config as 'barconfig' from a test file. driver=g++, # this config always invokes clang++, never anything else. debug=False, optlevel=3, output_type=exe) # etc Then, in your test file, you could have: ; RUN: %fooconfig %p/foo.cpp ; RUN: %barconfig %p/bar.cpp This is a very rough outline of the idea, but I think this could actually be really cool if done properly. https://reviews.llvm.org/D52618 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D50478: Add support for artificial tail call frames
vsk added a comment. Friendly ping. https://reviews.llvm.org/D50478 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
sgraenitz marked an inline comment as done. sgraenitz added inline comments. Comment at: source/Interpreter/CommandInterpreter.cpp:2733 + + const char *k_space_characters = "\t\n\v\f\r "; + size_t first_non_space = line.find_first_not_of(k_space_characters); shafik wrote: > This looks like duplicate code from from `HandleCommand` I also see that at > the the top of the file there is `k_white_space` although I am not sure why > it is not in a anonymous namespace and why perhaps it is not a `ConstString` Right, this is confusing. Any chance the extra escape sequences could make a difference in the context of line-wise command strings? Anyway, yes I would feel better with one set of white space characters. Will check the details. ``` \fForm Feed \rCarriage Return \vVertical Tab ``` https://reviews.llvm.org/D52788 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52788: Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings.
sgraenitz added a comment. Is it ok to have so many TestEchoXY.test files? I tried to get them all in one, but so far it didn't work out. Comment at: source/Interpreter/CommandInterpreter.cpp:2733 + + const char *k_space_characters = "\t\n\v\f\r "; + size_t first_non_space = line.find_first_not_of(k_space_characters); sgraenitz wrote: > shafik wrote: > > This looks like duplicate code from from `HandleCommand` I also see that at > > the the top of the file there is `k_white_space` although I am not sure why > > it is not in a anonymous namespace and why perhaps it is not a `ConstString` > Right, this is confusing. Any chance the extra escape sequences could make a > difference in the context of line-wise command strings? > Anyway, yes I would feel better with one set of white space characters. Will > check the details. > ``` > \fForm Feed > \rCarriage Return > \vVertical Tab > ``` We have more of them in CommandObjectCommands.cpp:1131, FormattersContainer.h:62, Args.cpp:397 and MIUtilString.cpp:511. LLVM has no named definition we could use. https://reviews.llvm.org/D52788 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343624 - Remove unnecessary field
Author: adrian Date: Tue Oct 2 13:14:12 2018 New Revision: 343624 URL: http://llvm.org/viewvc/llvm-project?rev=343624&view=rev Log: Remove unnecessary field Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll?rev=343624&r1=343623&r2=343624&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_var/globals.ll Tue Oct 2 13:14:12 2018 @@ -23,7 +23,7 @@ attributes #0 = { noinline nounwind optn !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression(DW_OP_deref)) !1 = distinct !DIGlobalVariable(name: "i", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, emissionKind: FullDebug, globals: !5, nameTableKind: None) +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, emissionKind: FullDebug, globals: !5) !3 = !DIFile(filename: "globals.c", directory: "/") !4 = !{} !5 = !{!0, !6} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52689: [LLDB] - Add support for DW_FORM_implicit_const.
vsk added a comment. Could you describe how the test exercises DW_FORM_implicit_const support? It's not immediately clear to me. https://reviews.llvm.org/D52689 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits