[Lldb-commits] [lldb] r371132 - Remove `bugreport` command
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 5 14:43:32 PDT 2019
Author: jdevlieghere
Date: Thu Sep 5 14:43:32 2019
New Revision: 371132
URL: http://llvm.org/viewvc/llvm-project?rev=371132&view=rev
Log:
Remove `bugreport` command
The bugreport command exists to create domain-specific bug reports.
Currently it has one implementation for filing bugs on the unwinder. As
far as we can tell, it has never been of use. Although not exactly the
same as the reproducers, it's a bit confusing to have two parallel
command trees for (kind of) the same thing.
Differential revision: https://reviews.llvm.org/D65469
Removed:
lldb/trunk/source/Commands/CommandObjectBugreport.cpp
lldb/trunk/source/Commands/CommandObjectBugreport.h
Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
lldb/trunk/source/Commands/CMakeLists.txt
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=371132&r1=371131&r2=371132&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py Thu Sep 5 14:43:32 2019
@@ -363,7 +363,7 @@ class CommandLineCompletionTestCase(Test
"""Test descriptions of top-level command completions"""
self.check_completion_with_desc("", [
["command", "Commands for managing custom LLDB commands."],
- ["bugreport", "Commands for creating domain-specific bug reports."]
+ ["breakpoint", "Commands for operating on breakpoints (see 'help b' for shorthand.)"]
])
self.check_completion_with_desc("pl", [
Modified: lldb/trunk/source/Commands/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CMakeLists.txt?rev=371132&r1=371131&r2=371132&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CMakeLists.txt (original)
+++ lldb/trunk/source/Commands/CMakeLists.txt Thu Sep 5 14:43:32 2019
@@ -7,7 +7,6 @@ add_lldb_library(lldbCommands
CommandObjectApropos.cpp
CommandObjectBreakpoint.cpp
CommandObjectBreakpointCommand.cpp
- CommandObjectBugreport.cpp
CommandObjectCommands.cpp
CommandObjectDisassemble.cpp
CommandObjectExpression.cpp
Removed: lldb/trunk/source/Commands/CommandObjectBugreport.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBugreport.cpp?rev=371131&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBugreport.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBugreport.cpp (removed)
@@ -1,124 +0,0 @@
-//===-- CommandObjectBugreport.cpp ------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "CommandObjectBugreport.h"
-
-#include <cstdio>
-
-
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/OptionGroupOutputFile.h"
-#include "lldb/Target/Thread.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-// "bugreport unwind"
-
-class CommandObjectBugreportUnwind : public CommandObjectParsed {
-public:
- CommandObjectBugreportUnwind(CommandInterpreter &interpreter)
- : CommandObjectParsed(
- interpreter, "bugreport unwind",
- "Create a bugreport for a bug in the stack unwinding code.",
- nullptr),
- m_option_group(), m_outfile_options() {
- m_option_group.Append(&m_outfile_options, LLDB_OPT_SET_ALL,
- LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);
- m_option_group.Finalize();
- }
-
- ~CommandObjectBugreportUnwind() override {}
-
- Options *GetOptions() override { return &m_option_group; }
-
-protected:
- bool DoExecute(Args &command, CommandReturnObject &result) override {
- StringList commands;
- commands.AppendString("thread backtrace");
-
- Thread *thread = m_exe_ctx.GetThreadPtr();
- if (thread) {
- char command_buffer[256];
-
- uint32_t frame_count = thread->GetStackFrameCount();
- for (uint32_t i = 0; i < frame_count; ++i) {
- StackFrameSP frame = thread->GetStackFrameAtIndex(i);
- lldb::addr_t pc = frame->GetStackID().GetPC();
-
- snprintf(command_buffer, sizeof(command_buffer),
- "disassemble --bytes --address 0x%" PRIx64, pc);
- commands.AppendString(command_buffer);
-
- snprintf(command_buffer, sizeof(command_buffer),
- "image show-unwind --address 0x%" PRIx64, pc);
- commands.AppendString(command_buffer);
- }
- }
-
- const FileSpec &outfile_spec =
- m_outfile_options.GetFile().GetCurrentValue();
- if (outfile_spec) {
-
- uint32_t open_options =
- File::eOpenOptionWrite | File::eOpenOptionCanCreate |
- File::eOpenOptionAppend | File::eOpenOptionCloseOnExec;
-
- const bool append = m_outfile_options.GetAppend().GetCurrentValue();
- if (!append)
- open_options |= File::eOpenOptionTruncate;
-
- StreamFileSP outfile_stream = std::make_shared<StreamFile>();
- File &file = outfile_stream->GetFile();
- Status error =
- FileSystem::Instance().Open(file, outfile_spec, open_options);
- if (error.Fail()) {
- auto path = outfile_spec.GetPath();
- result.AppendErrorWithFormat("Failed to open file '%s' for %s: %s\n",
- path.c_str(), append ? "append" : "write",
- error.AsCString());
- result.SetStatus(eReturnStatusFailed);
- return false;
- }
-
- result.SetImmediateOutputStream(outfile_stream);
- }
-
- CommandInterpreterRunOptions options;
- options.SetStopOnError(false);
- options.SetEchoCommands(true);
- options.SetPrintResults(true);
- options.SetPrintErrors(true);
- options.SetAddToHistory(false);
- m_interpreter.HandleCommands(commands, &m_exe_ctx, options, result);
-
- return result.Succeeded();
- }
-
-private:
- OptionGroupOptions m_option_group;
- OptionGroupOutputFile m_outfile_options;
-};
-
-#pragma mark CommandObjectMultiwordBugreport
-
-// CommandObjectMultiwordBugreport
-
-CommandObjectMultiwordBugreport::CommandObjectMultiwordBugreport(
- CommandInterpreter &interpreter)
- : CommandObjectMultiword(
- interpreter, "bugreport",
- "Commands for creating domain-specific bug reports.",
- "bugreport <subcommand> [<subcommand-options>]") {
-
- LoadSubCommand(
- "unwind", CommandObjectSP(new CommandObjectBugreportUnwind(interpreter)));
-}
-
-CommandObjectMultiwordBugreport::~CommandObjectMultiwordBugreport() {}
Removed: lldb/trunk/source/Commands/CommandObjectBugreport.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBugreport.h?rev=371131&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBugreport.h (original)
+++ lldb/trunk/source/Commands/CommandObjectBugreport.h (removed)
@@ -1,27 +0,0 @@
-//===-- CommandObjectBugreport.h --------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CommandObjectBugreport_h_
-#define liblldb_CommandObjectBugreport_h_
-
-#include "lldb/Interpreter/CommandObjectMultiword.h"
-
-namespace lldb_private {
-
-// CommandObjectMultiwordBugreport
-
-class CommandObjectMultiwordBugreport : public CommandObjectMultiword {
-public:
- CommandObjectMultiwordBugreport(CommandInterpreter &interpreter);
-
- ~CommandObjectMultiwordBugreport() override;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectBugreport_h_
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=371132&r1=371131&r2=371132&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Sep 5 14:43:32 2019
@@ -16,7 +16,6 @@
#include "Commands/CommandObjectApropos.h"
#include "Commands/CommandObjectBreakpoint.h"
-#include "Commands/CommandObjectBugreport.h"
#include "Commands/CommandObjectCommands.h"
#include "Commands/CommandObjectDisassemble.h"
#include "Commands/CommandObjectExpression.h"
@@ -444,8 +443,6 @@ void CommandInterpreter::LoadCommandDict
m_command_dict["apropos"] = CommandObjectSP(new CommandObjectApropos(*this));
m_command_dict["breakpoint"] =
CommandObjectSP(new CommandObjectMultiwordBreakpoint(*this));
- m_command_dict["bugreport"] =
- CommandObjectSP(new CommandObjectMultiwordBugreport(*this));
m_command_dict["command"] =
CommandObjectSP(new CommandObjectMultiwordCommands(*this));
m_command_dict["disassemble"] =
More information about the lldb-commits
mailing list