aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-06 20:14:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-06 20:14:12 +0000
commita4092fcbfb39b4d32a8e152a110d20132779d538 (patch)
tree37c84fe56b8ec43e3b08de27d76f53e259ddb0c7
parentcce7c2b0d24e364b1907670cf6f843531e5fe052 (diff)
downloadsrc-vendor/lldb/lldb-trunk-r291274.tar.gz
src-vendor/lldb/lldb-trunk-r291274.zip
Vendor import of lldb trunk r291274:vendor/lldb/lldb-trunk-r291274
-rw-r--r--include/lldb/Core/MappedHash.h3
-rw-r--r--include/lldb/Host/Editline.h2
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/TestMiEnvironmentCd.py37
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py41
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py9
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/main.cpp16
-rw-r--r--packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py1
-rw-r--r--source/Core/DataEncoder.cpp3
-rw-r--r--source/Core/ValueObjectMemory.cpp3
-rw-r--r--source/Expression/IRInterpreter.cpp36
-rw-r--r--source/Expression/IRMemoryMap.cpp2
-rw-r--r--source/Host/common/Editline.cpp47
-rw-r--r--source/Host/windows/EditLineWin.cpp15
-rw-r--r--source/Interpreter/OptionValueProperties.cpp3
-rw-r--r--source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp35
-rw-r--r--source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp4
-rw-r--r--source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp3
-rw-r--r--source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp3
-rw-r--r--source/Plugins/Process/POSIX/CrashReason.cpp2
-rw-r--r--source/Plugins/Process/Utility/DynamicRegisterInfo.cpp2
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLLDB.cpp12
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp7
-rw-r--r--source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp7
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp3
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp7
-rw-r--r--source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp3
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp3
-rw-r--r--source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp17
-rw-r--r--source/Symbol/ClangASTContext.cpp7
-rw-r--r--source/Symbol/Type.cpp6
-rw-r--r--source/Target/ABI.cpp3
-rw-r--r--source/Target/Platform.cpp5
-rw-r--r--source/Target/StackFrameList.cpp3
-rw-r--r--tools/driver/Platform.cpp10
-rw-r--r--tools/lldb-mi/MICmdCmdEnviro.cpp7
-rw-r--r--tools/lldb-mi/MICmdCmdGdbSet.cpp34
-rw-r--r--tools/lldb-mi/MICmdCmdGdbSet.h1
-rw-r--r--tools/lldb-mi/MICmdCmdGdbShow.cpp22
-rw-r--r--tools/lldb-mi/MICmdCmdGdbShow.h1
-rw-r--r--tools/lldb-mi/MICmdCmdMiscellanous.cpp20
-rw-r--r--tools/lldb-mi/MICmdCmdTarget.cpp1
-rw-r--r--tools/lldb-mi/MICmnMIOutOfBandRecord.cpp8
-rw-r--r--tools/lldb-mi/MICmnMIOutOfBandRecord.h4
-rw-r--r--tools/lldb-perf/lib/Results.cpp6
-rw-r--r--unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp12
45 files changed, 329 insertions, 147 deletions
diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h
index 44fe63216165..842a116d07a8 100644
--- a/include/lldb/Core/MappedHash.h
+++ b/include/lldb/Core/MappedHash.h
@@ -52,8 +52,7 @@ public:
default:
break;
}
- assert(!"Invalid hash function index");
- return 0;
+ llvm_unreachable("Invalid hash function index");
}
static const uint32_t HASH_MAGIC = 0x48415348u;
diff --git a/include/lldb/Host/Editline.h b/include/lldb/Host/Editline.h
index f92cbba7f2a0..faed373bc218 100644
--- a/include/lldb/Host/Editline.h
+++ b/include/lldb/Host/Editline.h
@@ -322,6 +322,8 @@ private:
/// single or multi-line editing.
void ConfigureEditor(bool multiline);
+ bool CompleteCharacter(char ch, EditLineCharType &out);
+
private:
#if LLDB_EDITLINE_USE_WCHAR
std::wstring_convert<std::codecvt_utf8<wchar_t>> m_utf8conv;
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiEnvironmentCd.py b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiEnvironmentCd.py
new file mode 100644
index 000000000000..786c842bb514
--- /dev/null
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiEnvironmentCd.py
@@ -0,0 +1,37 @@
+"""
+Test lldb-mi -environment-cd command.
+"""
+
+from __future__ import print_function
+
+
+import lldbmi_testcase
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MiEnvironmentCdTestCase(lldbmi_testcase.MiTestCaseBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfDarwin # Disabled while I investigate the failure on buildbot.
+ def test_lldbmi_environment_cd(self):
+ """Test that 'lldb-mi --interpreter' changes working directory for inferior."""
+
+ self.spawnLldbMi(args=None)
+
+ # Load executable
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ # cd to a different directory
+ self.runCmd("-environment-cd /tmp")
+ self.expect("\^done")
+
+ # Run to the end
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("@\"cwd: /tmp\\r\\n\"", exactly=True)
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py
index 5daf3fe0939c..9b575c49bcb0 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py
@@ -208,3 +208,44 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^done")
self.runCmd("-var-evaluate-expression var_a")
self.expect("\^done,value=\"10\"")
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr31485: data-disassemble doesn't follow flavor settings")
+ def test_lldbmi_gdb_set_disassembly_flavor(self):
+ """Test that 'lldb-mi --interpreter' works for -gdb-set disassembly-flavor."""
+
+ self.spawnLldbMi(args=None)
+
+ # Load executable
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ # Run to BP_printf
+ line = line_number('main.cpp', '// BP_printf')
+ self.runCmd("-break-insert main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"1\"")
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\".+addr=\"(0x[0-9a-f]+)\"")
+
+ # Get starting and ending address from $pc
+ pc = int(self.child.match.group(1), base=16)
+ s_addr, e_addr = pc, pc + 1
+
+ # Test default output (att)
+ self.runCmd("-data-disassemble -s %d -e %d -- 0" % (s_addr, e_addr))
+ self.expect("movl ")
+
+ # Test intel style
+ self.runCmd("-gdb-set disassembly-flavor intel")
+ self.expect("\^done")
+ self.runCmd("-data-disassemble -s %d -e %d -- 0" % (s_addr, e_addr))
+ self.expect("mov ")
+
+ # Test AT&T style
+ self.runCmd("-gdb-set disassembly-flavor intel")
+ self.expect("\^done")
+ self.runCmd("-data-disassemble -s %d -e %d -- 0" % (s_addr, e_addr))
+ self.expect("movl ")
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py b/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
index 354f955b7478..2c0de4238c38 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
@@ -111,24 +111,25 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Check argc and argv to see if arg passed
+ # Note that exactly=True is needed to avoid extra escaping for re
self.runCmd("-data-evaluate-expression argc")
self.expect("\^done,value=\"5\"")
#self.runCmd("-data-evaluate-expression argv[1]")
# self.expect("\^done,value=\"--arg1\"")
self.runCmd("-interpreter-exec command \"print argv[1]\"")
- self.expect("\"--arg1\"")
+ self.expect("\\\"--arg1\\\"", exactly=True)
#self.runCmd("-data-evaluate-expression argv[2]")
#self.expect("\^done,value=\"2nd arg\"")
self.runCmd("-interpreter-exec command \"print argv[2]\"")
- self.expect("\"2nd arg\"")
+ self.expect("\\\"2nd arg\\\"", exactly=True)
#self.runCmd("-data-evaluate-expression argv[3]")
# self.expect("\^done,value=\"third_arg\"")
self.runCmd("-interpreter-exec command \"print argv[3]\"")
- self.expect("\"third_arg\"")
+ self.expect("\\\"third_arg\\\"", exactly=True)
#self.runCmd("-data-evaluate-expression argv[4]")
#self.expect("\^done,value=\"fourth=\\\\\\\"4th arg\\\\\\\"\"")
self.runCmd("-interpreter-exec command \"print argv[4]\"")
- self.expect("\"fourth=\\\\\\\"4th arg\\\\\\\"\"")
+ self.expect("\\\"fourth=\\\\\\\"4th arg\\\\\\\"\\\"", exactly=True)
@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/main.cpp b/packages/Python/lldbsuite/test/tools/lldb-mi/main.cpp
index 6a2079f2ce74..0215b428925b 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/main.cpp
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/main.cpp
@@ -9,11 +9,25 @@
#include <cstdio>
+#ifdef _WIN32
+ #include <direct.h>
+ #define getcwd _getcwd // suppress "deprecation" warning
+#else
+ #include <unistd.h>
+#endif
+
int
main(int argc, char const *argv[])
{
- int a = 10;
+ int a = 10;
+
+ char buf[512];
+ char *ans = getcwd(buf, sizeof(buf));
+ if (ans) {
+ printf("cwd: %s\n", ans);
+ }
printf("argc=%d\n", argc); // BP_printf
+
return 0;
}
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
index 02059080f305..8e45c95927ba 100644
--- a/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
+++ b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
@@ -97,6 +97,7 @@ class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
# Run all commands simultaneously
self.runCmd("-unknown-command")
+ self.runCmd("-interpreter-exec command help")
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.runCmd("-break-insert -f main")
self.runCmd("-gdb-set target-async off")
diff --git a/source/Core/DataEncoder.cpp b/source/Core/DataEncoder.cpp
index dd6adc0a8688..334043651576 100644
--- a/source/Core/DataEncoder.cpp
+++ b/source/Core/DataEncoder.cpp
@@ -258,8 +258,7 @@ uint32_t DataEncoder::PutMaxU64(uint32_t offset, uint32_t byte_size,
case 8:
return PutU64(offset, value);
default:
- assert(!"GetMax64 unhandled case!");
- break;
+ llvm_unreachable("GetMax64 unhandled case!");
}
return UINT32_MAX;
}
diff --git a/source/Core/ValueObjectMemory.cpp b/source/Core/ValueObjectMemory.cpp
index 86747b84522b..18f3c94c522b 100644
--- a/source/Core/ValueObjectMemory.cpp
+++ b/source/Core/ValueObjectMemory.cpp
@@ -165,8 +165,7 @@ bool ValueObjectMemory::UpdateValue() {
switch (value_type) {
default:
- assert(!"Unhandled expression result value kind...");
- break;
+ llvm_unreachable("Unhandled expression result value kind...");
case Value::eValueTypeScalar:
// The variable value is in the Scalar value inside the m_value.
diff --git a/source/Expression/IRInterpreter.cpp b/source/Expression/IRInterpreter.cpp
index ef96b85971be..e5705984eb87 100644
--- a/source/Expression/IRInterpreter.cpp
+++ b/source/Expression/IRInterpreter.cpp
@@ -1602,25 +1602,23 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
lldb::addr_t addr = tmp_op.ULongLong();
size_t dataSize = 0;
- if (execution_unit.GetAllocSize(addr, dataSize)) {
- // Create the required buffer
- rawArgs[i].size = dataSize;
- rawArgs[i].data_ap.reset(new uint8_t[dataSize + 1]);
-
- // Read string from host memory
- execution_unit.ReadMemory(rawArgs[i].data_ap.get(), addr, dataSize,
- error);
- if (error.Fail()) {
- assert(!"we have failed to read the string from memory");
- return false;
- }
- // Add null terminator
- rawArgs[i].data_ap[dataSize] = '\0';
- rawArgs[i].type = lldb_private::ABI::CallArgument::HostPointer;
- } else {
- assert(!"unable to locate host data for transfer to device");
- return false;
- }
+ bool Success = execution_unit.GetAllocSize(addr, dataSize);
+ (void)Success;
+ assert(Success &&
+ "unable to locate host data for transfer to device");
+ // Create the required buffer
+ rawArgs[i].size = dataSize;
+ rawArgs[i].data_ap.reset(new uint8_t[dataSize + 1]);
+
+ // Read string from host memory
+ execution_unit.ReadMemory(rawArgs[i].data_ap.get(), addr, dataSize,
+ error);
+ assert(!error.Fail() &&
+ "we have failed to read the string from memory");
+
+ // Add null terminator
+ rawArgs[i].data_ap[dataSize] = '\0';
+ rawArgs[i].type = lldb_private::ABI::CallArgument::HostPointer;
} else /* if ( arg_ty->isPointerTy() ) */
{
rawArgs[i].type = lldb_private::ABI::CallArgument::TargetValue;
diff --git a/source/Expression/IRMemoryMap.cpp b/source/Expression/IRMemoryMap.cpp
index 008838d5aab3..7b9d26667389 100644
--- a/source/Expression/IRMemoryMap.cpp
+++ b/source/Expression/IRMemoryMap.cpp
@@ -126,7 +126,7 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
err = process_sp->GetMemoryRegionInfo(
region_info.GetRange().GetRangeEnd(), region_info);
if (err.Fail()) {
- lldbassert(!"GetMemoryRegionInfo() succeeded, then failed");
+ lldbassert(0 && "GetMemoryRegionInfo() succeeded, then failed");
ret = LLDB_INVALID_ADDRESS;
break;
}
diff --git a/source/Host/common/Editline.cpp b/source/Host/common/Editline.cpp
index a600c61c8e6b..1c5c0ffe902b 100644
--- a/source/Host/common/Editline.cpp
+++ b/source/Host/common/Editline.cpp
@@ -526,17 +526,8 @@ int Editline::GetCharacter(EditLineCharType *c) {
}
if (read_count) {
-#if LLDB_EDITLINE_USE_WCHAR
- // After the initial interruptible read, this is guaranteed not to block
- ungetc(ch, m_input_file);
- *c = fgetwc(m_input_file);
- if (*c != WEOF)
- return 1;
-#else
- *c = ch;
- if (ch != (char)EOF)
+ if (CompleteCharacter(ch, *c))
return 1;
-#endif
} else {
switch (status) {
case lldb::eConnectionStatusSuccess: // Success
@@ -1367,3 +1358,39 @@ void Editline::PrintAsync(Stream *stream, const char *s, size_t len) {
MoveCursor(CursorLocation::BlockEnd, CursorLocation::EditingCursor);
}
}
+
+bool Editline::CompleteCharacter(char ch, EditLineCharType &out) {
+#if !LLDB_EDITLINE_USE_WCHAR
+ if (ch == (char)EOF)
+ return false;
+
+ out = ch;
+ return true;
+#else
+ std::codecvt_utf8<wchar_t> cvt;
+ llvm::SmallString<4> input;
+ for (;;) {
+ const char *from_next;
+ wchar_t *to_next;
+ std::mbstate_t state = std::mbstate_t();
+ input.push_back(ch);
+ switch (cvt.in(state, input.begin(), input.end(), from_next, &out, &out + 1,
+ to_next)) {
+ case std::codecvt_base::ok:
+ return out != WEOF;
+
+ case std::codecvt_base::error:
+ case std::codecvt_base::noconv:
+ return false;
+
+ case std::codecvt_base::partial:
+ lldb::ConnectionStatus status;
+ size_t read_count = m_input_connection.Read(
+ &ch, 1, std::chrono::seconds(0), status, nullptr);
+ if (read_count == 0)
+ return false;
+ break;
+ }
+ }
+#endif
+}
diff --git a/source/Host/windows/EditLineWin.cpp b/source/Host/windows/EditLineWin.cpp
index 124104b00067..133cd6225467 100644
--- a/source/Host/windows/EditLineWin.cpp
+++ b/source/Host/windows/EditLineWin.cpp
@@ -13,6 +13,7 @@
#include "lldb/Host/windows/windows.h"
#include "lldb/Host/windows/editlinewin.h"
+#include "llvm/Support/ErrorHandling.h"
#include <assert.h>
#include <vector>
@@ -285,11 +286,10 @@ void el_end(EditLine *el) {
// assert( !"Not implemented!" );
}
-void el_reset(EditLine *) { assert(!"Not implemented!"); }
+void el_reset(EditLine *) { llvm_unreachable("Not implemented!"); }
int el_getc(EditLine *, char *) {
- assert(!"Not implemented!");
- return 0;
+ llvm_unreachable("Not implemented!");
}
void el_push(EditLine *, const char *) {}
@@ -297,8 +297,7 @@ void el_push(EditLine *, const char *) {}
void el_beep(EditLine *) { Beep(1000, 500); }
int el_parse(EditLine *, int, const char **) {
- assert(!"Not implemented!");
- return 0;
+ llvm_unreachable("Not implemented!");
}
int el_get(EditLine *el, int code, ...) {
@@ -311,7 +310,7 @@ int el_get(EditLine *el, int code, ...) {
*dout = clientData;
} break;
default:
- assert(!"Not implemented!");
+ llvm_unreachable("Not implemented!");
}
return 0;
}
@@ -322,7 +321,7 @@ int el_source(EditLine *el, const char *file) {
return 0;
}
-void el_resize(EditLine *) { assert(!"Not implemented!"); }
+void el_resize(EditLine *) { llvm_unreachable("Not implemented!"); }
const LineInfo *el_line(EditLine *el) { return 0; }
@@ -331,7 +330,7 @@ int el_insertstr(EditLine *, const char *) {
return 0;
}
-void el_deletestr(EditLine *, int) { assert(!"Not implemented!"); }
+void el_deletestr(EditLine *, int) { llvm_unreachable("Not implemented!"); }
History *history_init(void) {
// return dummy handle
diff --git a/source/Interpreter/OptionValueProperties.cpp b/source/Interpreter/OptionValueProperties.cpp
index 9a621bea8355..7e4df3a3e1d2 100644
--- a/source/Interpreter/OptionValueProperties.cpp
+++ b/source/Interpreter/OptionValueProperties.cpp
@@ -584,8 +584,7 @@ Error OptionValueProperties::DumpPropertyValue(const ExecutionContext *exe_ctx,
}
lldb::OptionValueSP OptionValueProperties::DeepCopy() const {
- assert(!"this shouldn't happen");
- return lldb::OptionValueSP();
+ llvm_unreachable("this shouldn't happen");
}
const Property *OptionValueProperties::GetPropertyAtPath(
diff --git a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index c542b36b674f..64b303c4f735 100644
--- a/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -64,10 +64,10 @@ private:
class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor {
public:
ClangModulesDeclVendorImpl(
- llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine,
- llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation,
- std::unique_ptr<clang::CompilerInstance> &&compiler_instance,
- std::unique_ptr<clang::Parser> &&parser);
+ llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine,
+ std::shared_ptr<clang::CompilerInvocation> compiler_invocation,
+ std::unique_ptr<clang::CompilerInstance> compiler_instance,
+ std::unique_ptr<clang::Parser> parser);
~ClangModulesDeclVendorImpl() override = default;
@@ -96,7 +96,7 @@ private:
bool m_enabled = false;
llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> m_diagnostics_engine;
- llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> m_compiler_invocation;
+ std::shared_ptr<clang::CompilerInvocation> m_compiler_invocation;
std::unique_ptr<clang::CompilerInstance> m_compiler_instance;
std::unique_ptr<clang::Parser> m_parser;
size_t m_source_location_index =
@@ -157,14 +157,14 @@ ClangModulesDeclVendor::ClangModulesDeclVendor() {}
ClangModulesDeclVendor::~ClangModulesDeclVendor() {}
ClangModulesDeclVendorImpl::ClangModulesDeclVendorImpl(
- llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> &diagnostics_engine,
- llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation,
- std::unique_ptr<clang::CompilerInstance> &&compiler_instance,
- std::unique_ptr<clang::Parser> &&parser)
- : ClangModulesDeclVendor(), m_diagnostics_engine(diagnostics_engine),
- m_compiler_invocation(compiler_invocation),
+ llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diagnostics_engine,
+ std::shared_ptr<clang::CompilerInvocation> compiler_invocation,
+ std::unique_ptr<clang::CompilerInstance> compiler_instance,
+ std::unique_ptr<clang::Parser> parser)
+ : m_diagnostics_engine(std::move(diagnostics_engine)),
+ m_compiler_invocation(std::move(compiler_invocation)),
m_compiler_instance(std::move(compiler_instance)),
- m_parser(std::move(parser)), m_imported_modules() {}
+ m_parser(std::move(parser)) {}
void ClangModulesDeclVendorImpl::ReportModuleExportsHelper(
std::set<ClangModulesDeclVendor::ModuleID> &exports,
@@ -498,7 +498,7 @@ void ClangModulesDeclVendorImpl::ForEachMacro(
ti->getLocation(), &invalid);
if (invalid) {
- lldbassert(!"Unhandled token kind");
+ lldbassert(0 && "Unhandled token kind");
macro_expansion.append("<unknown literal value>");
} else {
macro_expansion.append(
@@ -621,9 +621,9 @@ ClangModulesDeclVendor::Create(Target &target) {
compiler_invocation_argument_cstrs.push_back(arg.c_str());
}
- llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> invocation(
+ std::shared_ptr<clang::CompilerInvocation> invocation =
clang::createInvocationFromCommandLine(compiler_invocation_argument_cstrs,
- diagnostics_engine));
+ diagnostics_engine);
if (!invocation)
return nullptr;
@@ -640,7 +640,7 @@ ClangModulesDeclVendor::Create(Target &target) {
new clang::CompilerInstance);
instance->setDiagnostics(diagnostics_engine.get());
- instance->setInvocation(invocation.get());
+ instance->setInvocation(invocation);
std::unique_ptr<clang::FrontendAction> action(new clang::SyntaxOnlyAction);
@@ -674,6 +674,7 @@ ClangModulesDeclVendor::Create(Target &target) {
while (!parser->ParseTopLevelDecl(parsed))
;
- return new ClangModulesDeclVendorImpl(diagnostics_engine, invocation,
+ return new ClangModulesDeclVendorImpl(std::move(diagnostics_engine),
+ std::move(invocation),
std::move(instance), std::move(parser));
}
diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
index ba531b2e3f2d..aaca04582676 100644
--- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
+++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
@@ -196,8 +196,8 @@ bool fixupX86StructRetCalls(llvm::Module &module) {
llvm::AllocaInst *new_func_ptr =
new llvm::AllocaInst(new_func_ptr_type, "new_func_ptr", call_inst);
// store the new_func_cast to the newly allocated space
- (void)new llvm::StoreInst(new_func_cast, new_func_ptr,
- "new_func_ptr_load_cast", call_inst);
+ (new llvm::StoreInst(new_func_cast, new_func_ptr, call_inst))
+ ->setName("new_func_ptr_load_cast");
// load the new function address ready for a jump
llvm::LoadInst *new_func_addr_load =
new llvm::LoadInst(new_func_ptr, "load_func_pointer", call_inst);
diff --git a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index dae33f6257d1..a757bba70d16 100644
--- a/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -480,8 +480,7 @@ Error ProcessKDP::DoResume() {
default:
// The only valid thread resume states are listed above
- assert(!"invalid thread resume state");
- break;
+ llvm_unreachable("invalid thread resume state");
}
}
diff --git a/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp b/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
index 273e1966f3fc..9f594f35d70d 100644
--- a/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
+++ b/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
@@ -116,8 +116,7 @@ ThreadKDP::CreateRegisterContextForFrame(StackFrame *frame) {
new RegisterContextKDP_x86_64(*this, concrete_frame_idx));
break;
default:
- assert(!"Add CPU type support in KDP");
- break;
+ llvm_unreachable("Add CPU type support in KDP");
}
}
} else {
diff --git a/source/Plugins/Process/POSIX/CrashReason.cpp b/source/Plugins/Process/POSIX/CrashReason.cpp
index debdd7808e63..77d6e287486c 100644
--- a/source/Plugins/Process/POSIX/CrashReason.cpp
+++ b/source/Plugins/Process/POSIX/CrashReason.cpp
@@ -21,6 +21,7 @@ void AppendFaultAddr(std::string &str, lldb::addr_t addr) {
str += ss.str();
}
+#if defined(si_lower) && defined(si_upper)
void AppendBounds(std::string &str, lldb::addr_t lower_bound,
lldb::addr_t upper_bound, lldb::addr_t addr) {
llvm::raw_string_ostream stream(str);
@@ -37,6 +38,7 @@ void AppendBounds(std::string &str, lldb::addr_t lower_bound,
stream << ")";
stream.flush();
}
+#endif
CrashReason GetCrashReasonForSIGSEGV(const siginfo_t &info) {
assert(info.si_signo == SIGSEGV);
diff --git a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
index 7c8c26047f85..75f7251fb108 100644
--- a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -167,7 +167,7 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
reg_info.byte_offset =
containing_reg_info->byte_offset + msbyte;
} else {
- assert(!"Invalid byte order");
+ llvm_unreachable("Invalid byte order");
}
} else {
if (msbit > max_bit)
diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 3c33ddb335d6..ba84c40e9767 100644
--- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -1053,8 +1053,7 @@ bool RegisterContextLLDB::ReadRegisterValueFromRegisterLocation(
case UnwindLLDB::RegisterLocation::eRegisterNotSaved:
break;
case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation:
- assert("FIXME debugger inferior function call unwind");
- break;
+ llvm_unreachable("FIXME debugger inferior function call unwind");
case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: {
Error error(ReadRegisterValueFromMemory(
reg_info, regloc.location.target_memory_location, reg_info->byte_size,
@@ -1062,8 +1061,7 @@ bool RegisterContextLLDB::ReadRegisterValueFromRegisterLocation(
success = error.Success();
} break;
default:
- assert("Unknown RegisterLocation type.");
- break;
+ llvm_unreachable("Unknown RegisterLocation type.");
}
return success;
}
@@ -1097,8 +1095,7 @@ bool RegisterContextLLDB::WriteRegisterValueToRegisterLocation(
case UnwindLLDB::RegisterLocation::eRegisterNotSaved:
break;
case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation:
- assert("FIXME debugger inferior function call unwind");
- break;
+ llvm_unreachable("FIXME debugger inferior function call unwind");
case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: {
Error error(WriteRegisterValueToMemory(
reg_info, regloc.location.target_memory_location, reg_info->byte_size,
@@ -1106,8 +1103,7 @@ bool RegisterContextLLDB::WriteRegisterValueToRegisterLocation(
success = error.Success();
} break;
default:
- assert("Unknown RegisterLocation type.");
- break;
+ llvm_unreachable("Unknown RegisterLocation type.");
}
return success;
}
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index f9bbaef60215..b70f0903dbd5 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2599,10 +2599,7 @@ size_t GDBRemoteCommunicationClient::GetCurrentThreadIDs(
thread_ids.push_back(1);
}
} else {
-#if defined(LLDB_CONFIGURATION_DEBUG)
-// assert(!"ProcessGDBRemote::UpdateThreadList() failed due to not getting the
-// sequence mutex");
-#else
+#if !defined(LLDB_CONFIGURATION_DEBUG)
Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS |
GDBR_LOG_PACKETS));
if (log)
@@ -3246,7 +3243,7 @@ GDBRemoteCommunicationClient::GetModulesInfo(
JSONObject::SP module_sp = std::make_shared<JSONObject>();
module_array_sp->AppendObject(module_sp);
module_sp->SetObject(
- "file", std::make_shared<JSONString>(module_file_spec.GetPath()));
+ "file", std::make_shared<JSONString>(module_file_spec.GetPath(false)));
module_sp->SetObject("triple",
std::make_shared<JSONString>(triple.getTriple()));
}
diff --git a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 3747b2b86d52..357b48e53c48 100644
--- a/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1599,12 +1599,7 @@ StructuredData::ArraySP ScriptInterpreterPython::OSPlugin_ThreadsInfo(
// as the underlying typedef for uint* types, size_t, off_t and other values
// change.
-template <typename T> const char *GetPythonValueFormatString(T t) {
- assert(!"Unhandled type passed to GetPythonValueFormatString(T), make a "
- "specialization of GetPythonValueFormatString() to support this "
- "type.");
- return nullptr;
-}
+template <typename T> const char *GetPythonValueFormatString(T t);
template <> const char *GetPythonValueFormatString(char *) { return "s"; }
template <> const char *GetPythonValueFormatString(char) { return "b"; }
template <> const char *GetPythonValueFormatString(unsigned char) {
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
index 78fe571c50cf..ef3566855298 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
@@ -65,8 +65,7 @@ bool DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data,
break;
default:
- assert(!"DWARFRangeList::Extract() unsupported address size.");
- break;
+ llvm_unreachable("DWARFRangeList::Extract() unsupported address size.");
}
// Filter out empty ranges
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index ad18c56b3300..39c52a8a5e57 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -734,12 +734,11 @@ int DWARFFormValue::Compare(const DWARFFormValue &a_value,
}
case DW_FORM_indirect:
- assert(!"This shouldn't happen after the form has been extracted...");
- break;
+ llvm_unreachable(
+ "This shouldn't happen after the form has been extracted...");
default:
- assert(!"Unhandled DW_FORM");
- break;
+ llvm_unreachable("Unhandled DW_FORM");
}
return -1;
}
diff --git a/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
index afdb1d6afed3..cb1e5c185613 100644
--- a/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
+++ b/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
@@ -167,8 +167,7 @@ void DWARFMappedHash::Prologue::AppendAtom(AtomType type, dw_form_t form) {
case DW_FORM_exprloc:
case DW_FORM_flag_present:
case DW_FORM_ref_sig8:
- assert(!"Unhandled atom form");
- break;
+ llvm_unreachable("Unhandled atom form");
case DW_FORM_string:
case DW_FORM_block:
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 567ac88fdf07..16bb578e99c2 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1253,8 +1253,7 @@ SymbolFileDWARFDebugMap::GetCompileUnit(SymbolFileDWARF *oso_dwarf) {
}
}
}
- assert(!"this shouldn't happen");
- return lldb::CompUnitSP();
+ llvm_unreachable("this shouldn't happen");
}
SymbolFileDWARFDebugMap::CompileUnitInfo *
diff --git a/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
index 0852f1922034..be770a38fba7 100644
--- a/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ b/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -442,15 +442,14 @@ size_t UnwindAssemblyInstEmulation::WriteMemory(
case EmulateInstruction::eContextPushRegisterOnStack: {
uint32_t reg_num = LLDB_INVALID_REGNUM;
uint32_t generic_regnum = LLDB_INVALID_REGNUM;
- if (context.info_type ==
- EmulateInstruction::eInfoTypeRegisterToRegisterPlusOffset) {
- const uint32_t unwind_reg_kind = m_unwind_plan_ptr->GetRegisterKind();
- reg_num = context.info.RegisterToRegisterPlusOffset.data_reg
- .kinds[unwind_reg_kind];
- generic_regnum = context.info.RegisterToRegisterPlusOffset.data_reg
- .kinds[eRegisterKindGeneric];
- } else
- assert(!"unhandled case, add code to handle this!");
+ assert(context.info_type ==
+ EmulateInstruction::eInfoTypeRegisterToRegisterPlusOffset &&
+ "unhandled case, add code to handle this!");
+ const uint32_t unwind_reg_kind = m_unwind_plan_ptr->GetRegisterKind();
+ reg_num = context.info.RegisterToRegisterPlusOffset.data_reg
+ .kinds[unwind_reg_kind];
+ generic_regnum = context.info.RegisterToRegisterPlusOffset.data_reg
+ .kinds[eRegisterKindGeneric];
if (reg_num != LLDB_INVALID_REGNUM &&
generic_regnum != LLDB_REGNUM_GENERIC_SP) {
diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp
index caebd0ce8c6b..3c817a409b03 100644
--- a/source/Symbol/ClangASTContext.cpp
+++ b/source/Symbol/ClangASTContext.cpp
@@ -390,7 +390,7 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
case IK_AST:
case IK_LLVM_IR:
case IK_RenderScript:
- assert(!"Invalid input kind!");
+ llvm_unreachable("Invalid input kind!");
case IK_OpenCL:
LangStd = LangStandard::lang_opencl;
break;
@@ -2119,7 +2119,7 @@ CompilerType ClangASTContext::CreateStructForIdentifier(
if (!type_name.IsEmpty() &&
(type = GetTypeForIdentifier<clang::CXXRecordDecl>(type_name))
.IsValid()) {
- lldbassert("Trying to create a type for an existing name");
+ lldbassert(0 && "Trying to create a type for an existing name");
return type;
}
@@ -7568,8 +7568,7 @@ ClangASTContext::GetTemplateArgument(lldb::opaque_compiler_type_t type,
return CompilerType();
default:
- assert(!"Unhandled clang::TemplateArgument::ArgKind");
- break;
+ llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind");
}
}
}
diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp
index 2374a6d2b202..2df193fa45e5 100644
--- a/source/Symbol/Type.cpp
+++ b/source/Symbol/Type.cpp
@@ -484,8 +484,7 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) {
break;
default:
- assert(!"Unhandled encoding_data_type.");
- break;
+ llvm_unreachable("Unhandled encoding_data_type.");
}
} else {
// We have no encoding type, return void?
@@ -529,8 +528,7 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) {
break;
default:
- assert(!"Unhandled encoding_data_type.");
- break;
+ llvm_unreachable("Unhandled encoding_data_type.");
}
}
diff --git a/source/Target/ABI.cpp b/source/Target/ABI.cpp
index de4f685eb1c7..87363a3b8aeb 100644
--- a/source/Target/ABI.cpp
+++ b/source/Target/ABI.cpp
@@ -189,8 +189,7 @@ bool ABI::PrepareTrivialCall(Thread &thread, lldb::addr_t sp,
lldb::addr_t returnAddress, llvm::Type &returntype,
llvm::ArrayRef<ABI::CallArgument> args) const {
// dummy prepare trivial call
- assert(!"Should never get here!");
- return false;
+ llvm_unreachable("Should never get here!");
}
bool ABI::GetFallbackRegisterLocation(
diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp
index 43371ec23614..d8db53663f14 100644
--- a/source/Target/Platform.cpp
+++ b/source/Target/Platform.cpp
@@ -1876,9 +1876,8 @@ size_t Platform::GetSoftwareBreakpointTrapOpcode(Target &target,
} break;
default:
- assert(
- !"Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode");
- break;
+ llvm_unreachable(
+ "Unhandled architecture in Platform::GetSoftwareBreakpointTrapOpcode");
}
assert(bp_site);
diff --git a/source/Target/StackFrameList.cpp b/source/Target/StackFrameList.cpp
index 872e153ddb06..146b2b05dbd7 100644
--- a/source/Target/StackFrameList.cpp
+++ b/source/Target/StackFrameList.cpp
@@ -541,8 +541,7 @@ StackFrameSP StackFrameList::GetFrameAtIndex(uint32_t idx) {
if (m_frames.empty()) {
// Why do we have a thread with zero frames, that should not ever
// happen...
- if (m_thread.IsValid())
- assert("A valid thread has no frames.");
+ assert(!m_thread.IsValid() && "A valid thread has no frames.");
} else {
ResetCurrentInlinedDepth();
frame_sp = m_frames[original_idx];
diff --git a/tools/driver/Platform.cpp b/tools/driver/Platform.cpp
index 1a58d4de03e4..b1b7de8e8a22 100644
--- a/tools/driver/Platform.cpp
+++ b/tools/driver/Platform.cpp
@@ -15,6 +15,7 @@
#include <stdlib.h>
#include "Platform.h"
+#include "llvm/Support/ErrorHandling.h"
int ioctl(int d, int request, ...) {
switch (request) {
@@ -34,9 +35,8 @@ int ioctl(int d, int request, ...) {
return 0;
} break;
default:
- assert(!"Not implemented!");
+ llvm_unreachable("Not implemented!");
}
- return -1;
}
int kill(pid_t pid, int sig) {
@@ -44,13 +44,11 @@ int kill(pid_t pid, int sig) {
if (pid == getpid())
exit(sig);
//
- assert(!"Not implemented!");
- return -1;
+ llvm_unreachable("Not implemented!");
}
int tcsetattr(int fd, int optional_actions, const struct termios *termios_p) {
- assert(!"Not implemented!");
- return -1;
+ llvm_unreachable("Not implemented!");
}
int tcgetattr(int fildes, struct termios *termios_p) {
diff --git a/tools/lldb-mi/MICmdCmdEnviro.cpp b/tools/lldb-mi/MICmdCmdEnviro.cpp
index 808e8f6c49c5..298fe0d57bec 100644
--- a/tools/lldb-mi/MICmdCmdEnviro.cpp
+++ b/tools/lldb-mi/MICmdCmdEnviro.cpp
@@ -94,6 +94,13 @@ bool CMICmdCmdEnvironmentCd::Execute() {
m_cmdData.strMiCmd.c_str(),
"SetCurrentPlatformSDKRoot()"));
+ lldb::SBTarget sbTarget = m_rLLDBDebugSessionInfo.GetTarget();
+ if (sbTarget.IsValid()) {
+ lldb::SBLaunchInfo sbLaunchInfo = sbTarget.GetLaunchInfo();
+ sbLaunchInfo.SetWorkingDirectory(strWkDir.c_str());
+ sbTarget.SetLaunchInfo(sbLaunchInfo);
+ }
+
return bOk;
}
diff --git a/tools/lldb-mi/MICmdCmdGdbSet.cpp b/tools/lldb-mi/MICmdCmdGdbSet.cpp
index 38b81facc432..9f7325c931fc 100644
--- a/tools/lldb-mi/MICmdCmdGdbSet.cpp
+++ b/tools/lldb-mi/MICmdCmdGdbSet.cpp
@@ -27,6 +27,7 @@ const CMICmdCmdGdbSet::MapGdbOptionNameToFnGdbOptionPtr_t
// Example code if need to implement GDB set other options
{"output-radix", &CMICmdCmdGdbSet::OptionFnOutputRadix},
{"solib-search-path", &CMICmdCmdGdbSet::OptionFnSolibSearchPath},
+ {"disassembly-flavor", &CMICmdCmdGdbSet::OptionFnDisassemblyFlavor},
{"fallback", &CMICmdCmdGdbSet::OptionFnFallback}};
//++
@@ -399,6 +400,39 @@ bool CMICmdCmdGdbSet::OptionFnOutputRadix(
//++
//------------------------------------------------------------------------------------
+// Details: Carry out work to complete the GDB set option 'disassembly-flavor'
+// to prepare
+// and send back information asked for.
+// Type: Method.
+// Args: vrWords - (R) List of additional parameters used by this option.
+// Return: MIstatus::success - Functional succeeded.
+// MIstatus::failure - Functional failed.
+// Throws: None.
+//--
+bool CMICmdCmdGdbSet::OptionFnDisassemblyFlavor(
+ const CMIUtilString::VecString_t &vrWords) {
+ // Check we have at least one argument
+ if (vrWords.size() < 1) {
+ m_bGbbOptionFnHasError = true;
+ // m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH);
+ return MIstatus::failure;
+ }
+ const CMIUtilString &rStrValDisasmFlavor(vrWords[0]);
+
+ lldb::SBDebugger &rDbgr = m_rLLDBDebugSessionInfo.GetDebugger();
+ lldb::SBError error = lldb::SBDebugger::SetInternalVariable(
+ "target.x86-disassembly-flavor", rStrValDisasmFlavor.c_str(),
+ rDbgr.GetInstanceName());
+ if (error.Fail()) {
+ m_strGdbOptionFnError = error.GetCString();
+ return MIstatus::failure;
+ }
+
+ return MIstatus::success;
+}
+
+//++
+//------------------------------------------------------------------------------------
// Details: Carry out work to complete the GDB set option to prepare and send
// back the
// requested information.
diff --git a/tools/lldb-mi/MICmdCmdGdbSet.h b/tools/lldb-mi/MICmdCmdGdbSet.h
index 98017baf2b90..730754f7f82a 100644
--- a/tools/lldb-mi/MICmdCmdGdbSet.h
+++ b/tools/lldb-mi/MICmdCmdGdbSet.h
@@ -79,6 +79,7 @@ private:
bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
bool OptionFnSolibSearchPath(const CMIUtilString::VecString_t &vrWords);
bool OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords);
+ bool OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords);
bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
// Attributes:
diff --git a/tools/lldb-mi/MICmdCmdGdbShow.cpp b/tools/lldb-mi/MICmdCmdGdbShow.cpp
index 591d80bb9d0a..4ae45f8579e2 100644
--- a/tools/lldb-mi/MICmdCmdGdbShow.cpp
+++ b/tools/lldb-mi/MICmdCmdGdbShow.cpp
@@ -13,6 +13,7 @@
#include "lldb/API/SBCompileUnit.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBStringList.h"
#include "lldb/API/SBThread.h"
// In-house headers:
@@ -30,6 +31,7 @@ const CMICmdCmdGdbShow::MapGdbOptionNameToFnGdbOptionPtr_t
{"target-async", &CMICmdCmdGdbShow::OptionFnTargetAsync},
{"print", &CMICmdCmdGdbShow::OptionFnPrint},
{"language", &CMICmdCmdGdbShow::OptionFnLanguage},
+ {"disassembly-flavor", &CMICmdCmdGdbShow::OptionFnDisassemblyFlavor},
{"fallback", &CMICmdCmdGdbShow::OptionFnFallback}};
//++
@@ -327,6 +329,26 @@ bool CMICmdCmdGdbShow::OptionFnLanguage(
//++
//------------------------------------------------------------------------------------
+// Details: Carry out work to complete the GDB show option 'disassembly-flavor' to prepare
+// and send back the requested information.
+// Type: Method.
+// Args: vrWords - (R) List of additional parameters used by this option.
+// Return: MIstatus::success - Function succeeded.
+// MIstatus::failure - Function failed.
+// Throws: None.
+//--
+bool CMICmdCmdGdbShow::OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords) {
+ MIunused(vrWords);
+
+ // Get current disassembly flavor
+ lldb::SBDebugger &rDbgr = m_rLLDBDebugSessionInfo.GetDebugger();
+ m_strValue = lldb::SBDebugger::GetInternalVariableValue("target.x86-disassembly-flavor",
+ rDbgr.GetInstanceName()).GetStringAtIndex(0);
+ return MIstatus::success;
+}
+
+//++
+//------------------------------------------------------------------------------------
// Details: Carry out work to complete the GDB show option to prepare and send
// back the
// requested information.
diff --git a/tools/lldb-mi/MICmdCmdGdbShow.h b/tools/lldb-mi/MICmdCmdGdbShow.h
index 9873e87c8120..452db827032c 100644
--- a/tools/lldb-mi/MICmdCmdGdbShow.h
+++ b/tools/lldb-mi/MICmdCmdGdbShow.h
@@ -78,6 +78,7 @@ private:
bool OptionFnTargetAsync(const CMIUtilString::VecString_t &vrWords);
bool OptionFnPrint(const CMIUtilString::VecString_t &vrWords);
bool OptionFnLanguage(const CMIUtilString::VecString_t &vrWords);
+ bool OptionFnDisassemblyFlavor(const CMIUtilString::VecString_t &vrWords);
bool OptionFnFallback(const CMIUtilString::VecString_t &vrWords);
// Attributes:
diff --git a/tools/lldb-mi/MICmdCmdMiscellanous.cpp b/tools/lldb-mi/MICmdCmdMiscellanous.cpp
index f2aecbc32ed3..87c0ee62f658 100644
--- a/tools/lldb-mi/MICmdCmdMiscellanous.cpp
+++ b/tools/lldb-mi/MICmdCmdMiscellanous.cpp
@@ -496,14 +496,22 @@ bool CMICmdCmdInterpreterExec::Execute() {
//--
bool CMICmdCmdInterpreterExec::Acknowledge() {
if (m_lldbResult.GetOutputSize() > 0) {
- CMIUtilString strMsg(m_lldbResult.GetOutput());
- strMsg = strMsg.StripCREndOfLine();
- CMICmnStreamStdout::TextToStdout(strMsg);
+ const CMIUtilString line(m_lldbResult.GetOutput());
+ const bool bEscapeQuotes(true);
+ CMICmnMIValueConst miValueConst(line.Escape(bEscapeQuotes));
+ CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_ConsoleStreamOutput, miValueConst);
+ const bool bOk = CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
+ if (!bOk)
+ return MIstatus::failure;
}
if (m_lldbResult.GetErrorSize() > 0) {
- CMIUtilString strMsg(m_lldbResult.GetError());
- strMsg = strMsg.StripCREndOfLine();
- CMICmnStreamStderr::LLDBMsgToConsole(strMsg);
+ const CMIUtilString line(m_lldbResult.GetError());
+ const bool bEscapeQuotes(true);
+ CMICmnMIValueConst miValueConst(line.Escape(bEscapeQuotes));
+ CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_LogStreamOutput, miValueConst);
+ const bool bOk = CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
+ if (!bOk)
+ return MIstatus::failure;
}
const CMICmnMIResultRecord miRecordResult(
diff --git a/tools/lldb-mi/MICmdCmdTarget.cpp b/tools/lldb-mi/MICmdCmdTarget.cpp
index 15650163450b..e5bd4c4d2bc7 100644
--- a/tools/lldb-mi/MICmdCmdTarget.cpp
+++ b/tools/lldb-mi/MICmdCmdTarget.cpp
@@ -123,6 +123,7 @@ bool CMICmdCmdTargetSelect::Execute() {
// Verify that we have managed to connect successfully
lldb::SBStream errMsg;
+ error.GetDescription(errMsg);
if (!process.IsValid()) {
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_TARGET_PLUGIN),
m_cmdData.strMiCmd.c_str(),
diff --git a/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp b/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
index 66a44e6084b1..029f76e65a85 100644
--- a/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
+++ b/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
@@ -48,6 +48,10 @@ MapOutOfBandToText(CMICmnMIOutOfBandRecord::OutOfBand_e veType) {
return "library-unloaded";
case CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput:
return "";
+ case CMICmnMIOutOfBandRecord::eOutOfBand_ConsoleStreamOutput:
+ return "";
+ case CMICmnMIOutOfBandRecord::eOutOfBand_LogStreamOutput:
+ return "";
}
assert(false && "unknown CMICmnMIOutofBandRecord::OutOfBand_e");
return NULL;
@@ -86,6 +90,10 @@ MapOutOfBandToToken(CMICmnMIOutOfBandRecord::OutOfBand_e veType) {
return "=";
case CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput:
return "@";
+ case CMICmnMIOutOfBandRecord::eOutOfBand_ConsoleStreamOutput:
+ return "~";
+ case CMICmnMIOutOfBandRecord::eOutOfBand_LogStreamOutput:
+ return "&";
}
assert(false && "unknown CMICmnMIOutofBandRecord::OutOfBand_e");
return NULL;
diff --git a/tools/lldb-mi/MICmnMIOutOfBandRecord.h b/tools/lldb-mi/MICmnMIOutOfBandRecord.h
index f81c114e6681..1bba38cf0cca 100644
--- a/tools/lldb-mi/MICmnMIOutOfBandRecord.h
+++ b/tools/lldb-mi/MICmnMIOutOfBandRecord.h
@@ -65,7 +65,9 @@ public:
eOutOfBand_ThreadSelected,
eOutOfBand_TargetModuleLoaded,
eOutOfBand_TargetModuleUnloaded,
- eOutOfBand_TargetStreamOutput
+ eOutOfBand_TargetStreamOutput,
+ eOutOfBand_ConsoleStreamOutput,
+ eOutOfBand_LogStreamOutput
};
// Methods:
diff --git a/tools/lldb-perf/lib/Results.cpp b/tools/lldb-perf/lib/Results.cpp
index 17a022f2ea1c..a4cdce525e2c 100644
--- a/tools/lldb-perf/lib/Results.cpp
+++ b/tools/lldb-perf/lib/Results.cpp
@@ -76,8 +76,7 @@ static void AddResultToArray(CFCMutableArray &parent_array,
} break;
default:
- assert(!"unhandled result");
- break;
+ llvm_unreachable("unhandled result");
}
}
@@ -125,8 +124,7 @@ static void AddResultToDictionary(CFCMutableDictionary &parent_dict,
result->GetAsUnsigned()->GetValue(), true);
} break;
default:
- assert(!"unhandled result");
- break;
+ llvm_unreachable("unhandled result");
}
}
void Results::Write(const char *out_path) {
diff --git a/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index 84b354d75170..4bac9ebd404f 100644
--- a/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -199,14 +199,22 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo) {
FileSpec file_specs[] = {
FileSpec("/foo/bar.so", false, FileSpec::ePathSyntaxPosix),
- FileSpec("/foo/baz.so", false, FileSpec::ePathSyntaxPosix)};
+ FileSpec("/foo/baz.so", false, FileSpec::ePathSyntaxPosix),
+
+ // This is a bit dodgy but we currently depend on GetModulesInfo not
+ // performing denormalization. It can go away once the users
+ // (DynamicLoaderPOSIXDYLD, at least) correctly set the path syntax for
+ // the FileSpecs they create.
+ FileSpec("/foo/baw.so", false, FileSpec::ePathSyntaxWindows),
+ };
std::future<llvm::Optional<std::vector<ModuleSpec>>> async_result =
std::async(std::launch::async,
[&] { return client.GetModulesInfo(file_specs, triple); });
HandlePacket(
server, "jModulesInfo:["
R"({"file":"/foo/bar.so","triple":"i386-pc-linux"},)"
- R"({"file":"/foo/baz.so","triple":"i386-pc-linux"}])",
+ R"({"file":"/foo/baz.so","triple":"i386-pc-linux"},)"
+ R"({"file":"/foo/baw.so","triple":"i386-pc-linux"}])",
R"([{"uuid":"404142434445464748494a4b4c4d4e4f","triple":"i386-pc-linux",)"
R"("file_path":"/foo/bar.so","file_offset":0,"file_size":1234}]])");