[Lldb-commits] [lldb] b141534 - Remove unused #include

2023-09-29 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2023-09-29T11:07:38-05:00
New Revision: b14153490134e210c05bafae330a270cf60c0e2a

URL: 
https://github.com/llvm/llvm-project/commit/b14153490134e210c05bafae330a270cf60c0e2a
DIFF: 
https://github.com/llvm/llvm-project/commit/b14153490134e210c05bafae330a270cf60c0e2a.diff

LOG: Remove unused #include

Differential Revision: https://reviews.llvm.org/D159550

Added: 


Modified: 
lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h

Removed: 




diff  --git a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h 
b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
index 3ae663f42446afb..d8cf008dbb0bf8b 100644
--- a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
+++ b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
@@ -10,8 +10,6 @@
 #define liblldb_ABISysV_riscv_h_
 
 // Other libraries and framework includes
-#include 
-
 #include "llvm/TargetParser/Triple.h"
 
 // Project includes



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 847de9c - [RISC-V] Add RISC-V ABI plugin

2023-09-29 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2023-09-29T10:31:01-05:00
New Revision: 847de9c332775d1841fec9fea5cb5c41592a4c8f

URL: 
https://github.com/llvm/llvm-project/commit/847de9c332775d1841fec9fea5cb5c41592a4c8f
DIFF: 
https://github.com/llvm/llvm-project/commit/847de9c332775d1841fec9fea5cb5c41592a4c8f.diff

LOG: [RISC-V] Add RISC-V ABI plugin

Also default to disassembling a and m features
Some code taken from https://reviews.llvm.org/D62732 , which hasn't been
updated in a year.

Tested with 32 and 64 bit Linux user space QEMU

Reviewed By: jasonmolenda

Differential Revision: https://reviews.llvm.org/D159101

Added: 
lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h
lldb/source/Plugins/ABI/RISCV/CMakeLists.txt

Modified: 
lldb/source/Plugins/ABI/CMakeLists.txt
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ABI/CMakeLists.txt 
b/lldb/source/Plugins/ABI/CMakeLists.txt
index 828aea674ea68c2..9241a2487d522fe 100644
--- a/lldb/source/Plugins/ABI/CMakeLists.txt
+++ b/lldb/source/Plugins/ABI/CMakeLists.txt
@@ -1,4 +1,4 @@
-foreach(target AArch64 ARM ARC Hexagon Mips MSP430 PowerPC SystemZ X86)
+foreach(target AArch64 ARM ARC Hexagon Mips MSP430 PowerPC RISCV SystemZ X86)
   if (${target} IN_LIST LLVM_TARGETS_TO_BUILD)
 add_subdirectory(${target})
   endif()

diff  --git a/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp 
b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
new file mode 100644
index 000..bdcbeaca68fa33d
--- /dev/null
+++ b/lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp
@@ -0,0 +1,780 @@
+//===-- ABISysV_riscv.cpp ===//
+//
+// 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 "ABISysV_riscv.h"
+
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/RegisterValue.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, generic_num) 
\
+  {
\
+DEFINE_REG_NAME(dwarf_num), DEFINE_REG_NAME_STR(str_name), 0, 0,   
\
+eEncodingInvalid, eFormatDefault,  
\
+{dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num},   
\
+nullptr, nullptr, nullptr, 
\
+  }
+
+#define DEFINE_REGISTER_STUB(dwarf_num, str_name)  
\
+  DEFINE_GENERIC_REGISTER_STUB(dwarf_num, str_name, LLDB_INVALID_REGNUM)
+
+using namespace lldb;
+using namespace lldb_private;
+
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_riscv, ABIRISCV)
+
+namespace {
+namespace dwarf {
+enum regnums {
+  zero,
+  ra,
+  sp,
+  gp,
+  tp,
+  t0,
+  t1,
+  t2,
+  fp,
+  s0 = fp,
+  s1,
+  a0,
+  a1,
+  a2,
+  a3,
+  a4,
+  a5,
+  a6,
+  a7,
+  s2,
+  s3,
+  s4,
+  s5,
+  s6,
+  s7,
+  s8,
+  s9,
+  s10,
+  s11,
+  t3,
+  t4,
+  t5,
+  t6,
+  pc
+};
+
+static const std::array g_register_infos = {
+{DEFINE_REGISTER_STUB(zero, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(ra, nullptr, LLDB_REGNUM_GENERIC_RA),
+ DEFINE_GENERIC_REGISTER_STUB(sp, nullptr, LLDB_REGNUM_GENERIC_SP),
+ DEFINE_REGISTER_STUB(gp, nullptr),
+ DEFINE_REGISTER_STUB(tp, nullptr),
+ DEFINE_REGISTER_STUB(t0, nullptr),
+ DEFINE_REGISTER_STUB(t1, nullptr),
+ DEFINE_REGISTER_STUB(t2, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(fp, nullptr, LLDB_REGNUM_GENERIC_FP),
+ DEFINE_REGISTER_STUB(s1, nullptr),
+ DEFINE_GENERIC_REGISTER_STUB(a0, nullptr, LLDB_REGNUM_GENERIC_ARG1),
+ DEFINE_GENERIC_REGISTER_STUB(a1, nullptr, LLDB_REGNUM_GENERIC_ARG2),
+ DEFINE_GENERIC_REGISTER_STUB(a2, nullptr, LLDB_REGNUM_GENERIC_ARG3),
+ DEFINE_GENERIC_REGISTER_STUB(a3, nullptr, LLDB_REGNUM_GENERIC_ARG4),
+ DEFINE_GENERIC_REGISTER_STUB(a4, nullptr, LLDB_REGNUM_GENERIC_ARG5),
+ DEFINE_GENERIC_REGISTER_STUB(a5, nullptr, LLDB_REGNUM_GENERIC_ARG6),
+ DEFINE_GENERIC_REGISTER_STUB(a6, nullptr, LLDB_REGNUM_GENERIC_ARG7),
+ DEFINE_GENERIC_REGISTER_STUB(a7, nullptr, LLDB_REGNUM_GENERIC_ARG8),
+ 

[Lldb-commits] [lldb] be88462 - Platform qemu-user: Build path to qemu automatically if not specified

2023-08-22 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2023-08-22T14:20:18-05:00
New Revision: be88462cd6aa819c22185ff0916988d4f03b6ab0

URL: 
https://github.com/llvm/llvm-project/commit/be88462cd6aa819c22185ff0916988d4f03b6ab0
DIFF: 
https://github.com/llvm/llvm-project/commit/be88462cd6aa819c22185ff0916988d4f03b6ab0.diff

LOG: Platform qemu-user: Build path to qemu automatically if not specified

Get the path to qemu in the following order:
1) From the property platform.plugin.qemu-user.emulator-path
2) If that property is not set, from PATH, building the name of the qemu
   binary from the triple in  property platform.plugin.qemu-user.architecture
3) If that property is not set, from PATH, building the name of the qemu
   binary from the triple in the target

This will allow a user to load a target and run without setting properties,
if qemu is on the PATH and named qemu-

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D155117

Added: 


Modified: 
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp 
b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 72a039d18872758..b233b1ba9b5899c 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -162,9 +162,18 @@ lldb::ProcessSP 
PlatformQemuUser::DebugProcess(ProcessLaunchInfo _info,
Target , Status ) {
   Log *log = GetLog(LLDBLog::Platform);
 
+  // If platform.plugin.qemu-user.emulator-path is set, use it.
   FileSpec qemu = GetGlobalProperties().GetEmulatorPath();
-  if (!qemu)
-qemu.SetPath(("qemu-" + GetGlobalProperties().GetArchitecture()).str());
+  // If platform.plugin.qemu-user.emulator-path is not set, build the
+  // executable name from platform.plugin.qemu-user.architecture.
+  if (!qemu) {
+llvm::StringRef arch = GetGlobalProperties().GetArchitecture();
+// If platform.plugin.qemu-user.architecture is not set, build the
+// executable name from the target Triple's ArchName
+if (arch.empty())
+  arch = target.GetArchitecture().GetTriple().getArchName();
+qemu.SetPath(("qemu-" + arch).str());
+  }
   FileSystem::Instance().ResolveExecutableLocation(qemu);
 
   llvm::SmallString<0> socket_model, socket_path;



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 523110d - Add support for llvm::MCInstPrinter::setPrintBranchImmAsAddress

2023-08-22 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2023-08-22T14:16:14-05:00
New Revision: 523110d654a286607790e7637da6be312de3a7c7

URL: 
https://github.com/llvm/llvm-project/commit/523110d654a286607790e7637da6be312de3a7c7
DIFF: 
https://github.com/llvm/llvm-project/commit/523110d654a286607790e7637da6be312de3a7c7.diff

LOG: Add support for llvm::MCInstPrinter::setPrintBranchImmAsAddress

llvm::MCInstPrinter has an option, controlled by setPrintBranchImmAsAddress,
to print branch targets as immediate addresses instead of offsets.
Turn this on in lldb, so targets that support this flag will print addresses
instead of offsets.

This requires the address of the instruction be provided, but fortunately
it's calculated right before the call to PrintMCInst.

Reviewed By: jasonmolenda, DavidSpickett

Differential Revision: https://reviews.llvm.org/D155107

Added: 


Modified: 
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index b4fdcbd783570a..2e0e8e8cf7d36c 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -60,8 +60,8 @@ class DisassemblerLLVMC::MCDisasmInstance {
 
   uint64_t GetMCInst(const uint8_t *opcode_data, size_t opcode_data_len,
  lldb::addr_t pc, llvm::MCInst _inst) const;
-  void PrintMCInst(llvm::MCInst _inst, std::string _string,
-   std::string _string);
+  void PrintMCInst(llvm::MCInst _inst, lldb::addr_t pc,
+   std::string _string, std::string _string);
   void SetStyle(bool use_hex_immed, HexImmediateStyle hex_style);
   bool CanBranch(llvm::MCInst _inst) const;
   bool HasDelaySlot(llvm::MCInst _inst) const;
@@ -607,7 +607,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
 
 if (inst_size > 0) {
   mc_disasm_ptr->SetStyle(use_hex_immediates, hex_style);
-  mc_disasm_ptr->PrintMCInst(inst, out_string, comment_string);
+  mc_disasm_ptr->PrintMCInst(inst, pc, out_string, comment_string);
 
   if (!comment_string.empty()) {
 AppendComment(comment_string);
@@ -1290,6 +1290,8 @@ DisassemblerLLVMC::MCDisasmInstance::Create(const char 
*triple, const char *cpu,
   if (!instr_printer_up)
 return Instance();
 
+  instr_printer_up->setPrintBranchImmAsAddress(true);
+
   // Not all targets may have registered createMCInstrAnalysis().
   std::unique_ptr instr_analysis_up(
   curr_target->createMCInstrAnalysis(instr_info_up.get()));
@@ -1337,13 +1339,13 @@ uint64_t DisassemblerLLVMC::MCDisasmInstance::GetMCInst(
 }
 
 void DisassemblerLLVMC::MCDisasmInstance::PrintMCInst(
-llvm::MCInst _inst, std::string _string,
+llvm::MCInst _inst, lldb::addr_t pc, std::string _string,
 std::string _string) {
   llvm::raw_string_ostream inst_stream(inst_string);
   llvm::raw_string_ostream comments_stream(comments_string);
 
   m_instr_printer_up->setCommentStream(comments_stream);
-  m_instr_printer_up->printInst(_inst, 0, llvm::StringRef(),
+  m_instr_printer_up->printInst(_inst, pc, llvm::StringRef(),
 *m_subtarget_info_up, inst_stream);
   m_instr_printer_up->setCommentStream(llvm::nulls());
   comments_stream.flush();



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ded1bad - Fix mixed disassembly showing source lines for "line 0"

2023-07-12 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2023-07-12T11:39:11-05:00
New Revision: ded1bad64af0acf312d2464fcc4e826f89a720d0

URL: 
https://github.com/llvm/llvm-project/commit/ded1bad64af0acf312d2464fcc4e826f89a720d0
DIFF: 
https://github.com/llvm/llvm-project/commit/ded1bad64af0acf312d2464fcc4e826f89a720d0.diff

LOG: Fix mixed disassembly showing source lines for "line 0"

"line 0" in a DWARF linetable means something that doesn't have associated
source. The code for mixed disassembly has a comment indicating that
"line 0" should be skipped, but the wrong value was returned. Fix the return
value and add a test to check that we don't incorrectly show source lines
from the beginning of the file.

Reviewed By: jasonmolenda

Differential Revision: https://reviews.llvm.org/D112931

Added: 
lldb/test/Shell/Commands/command-disassemble-mixed.c

Modified: 


Removed: 




diff  --git a/lldb/test/Shell/Commands/command-disassemble-mixed.c 
b/lldb/test/Shell/Commands/command-disassemble-mixed.c
new file mode 100644
index 00..d15832cabd8402
--- /dev/null
+++ b/lldb/test/Shell/Commands/command-disassemble-mixed.c
@@ -0,0 +1,18 @@
+// invalid mixed disassembly line
+
+// RUN: %clang -g %s -o %t
+// RUN: %lldb %t -o "dis -m -n main" -o "exit" | FileCheck %s
+
+// CHECK: int main
+// CHECK: int i
+// CHECK-NOT: invalid mixed disassembly line
+// CHECK: return 0;
+
+int main(int argc, char **argv)
+{
+  int i;
+
+  for (i=0; i < 10; ++i) ;
+
+  return 0;
+}



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1c05c52 - [lldb-vscode] Fix coredump load source mapping for first file

2021-11-01 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2021-11-01T10:47:42-05:00
New Revision: 1c05c52de2177a328b7d2d07b697af67eb9f8122

URL: 
https://github.com/llvm/llvm-project/commit/1c05c52de2177a328b7d2d07b697af67eb9f8122
DIFF: 
https://github.com/llvm/llvm-project/commit/1c05c52de2177a328b7d2d07b697af67eb9f8122.diff

LOG: [lldb-vscode] Fix coredump load source mapping for first file

SetSourceMapFromArguments is called after the core is loaded. This means
that the source file for the crashing code won't have the source map applied.
Move the call to SetSourceMapFromArguments in request_attach to just after
the call to RunInitCommands, matching request_launch behavior.

Reviewed By: clayborg, wallace

Differential Revision: https://reviews.llvm.org/D112834

Added: 
lldb/test/API/tools/lldb-vscode/coreFile/main.c

Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
index 0a55fc0ead1e4..255a4805a9737 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -251,7 +251,7 @@ def attach(self, program=None, pid=None, waitFor=None, 
trace=None,
initCommands=None, preRunCommands=None, stopCommands=None,
exitCommands=None, attachCommands=None, coreFile=None,
disconnectAutomatically=True, terminateCommands=None,
-   postRunCommands=None):
+   postRunCommands=None, sourceMap=None):
 '''Build the default Makefile target, create the VSCode debug adaptor,
and attach to the process.
 '''
@@ -271,7 +271,8 @@ def cleanup():
 initCommands=initCommands, preRunCommands=preRunCommands,
 stopCommands=stopCommands, exitCommands=exitCommands,
 attachCommands=attachCommands, terminateCommands=terminateCommands,
-coreFile=coreFile, postRunCommands=postRunCommands)
+coreFile=coreFile, postRunCommands=postRunCommands,
+sourceMap=sourceMap)
 if not (response and response['success']):
 self.assertTrue(response['success'],
 'attach failed (%s)' % (response['message']))

diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
index df057d5e63aa6..603b1545cd714 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -506,7 +506,8 @@ def request_attach(self, program=None, pid=None, 
waitFor=None, trace=None,
initCommands=None, preRunCommands=None,
stopCommands=None, exitCommands=None,
attachCommands=None, terminateCommands=None,
-   coreFile=None, postRunCommands=None):
+   coreFile=None, postRunCommands=None,
+   sourceMap=None):
 args_dict = {}
 if pid is not None:
 args_dict['pid'] = pid
@@ -533,6 +534,8 @@ def request_attach(self, program=None, pid=None, 
waitFor=None, trace=None,
 args_dict['coreFile'] = coreFile
 if postRunCommands:
 args_dict['postRunCommands'] = postRunCommands
+if sourceMap:
+args_dict['sourceMap'] = sourceMap
 command_dict = {
 'command': 'attach',
 'type': 'request',

diff  --git a/lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py 
b/lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
index 55efd91d827a6..56a93ccd6c8ab 100644
--- a/lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
+++ b/lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
@@ -41,3 +41,18 @@ def test_core_file(self):
 
 self.vscode.request_next(threadId=32259)
 self.assertEquals(self.get_stackFrames(), expected_frames)
+
+@skipIfWindows
+@skipIfRemote
+def test_core_file_source_mapping(self):
+''' Test that sourceMap property is correctly applied when loading a 
core '''
+current_dir = os.path.dirname(os.path.realpath(__file__))
+exe_file = os.path.join(current_dir, "linux-x86_64.out")
+core_file = os.path.join(current_dir, "linux-x86_64.core")
+
+self.create_debug_adaptor()
+
+source_map = [["/home/labath/test", current_dir]]
+self.attach(exe_file, coreFile=core_file, sourceMap=source_map)
+
+

[Lldb-commits] [lldb] 953ddde - [lldb] Handle malformed qfThreadInfo reply

2021-09-23 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2021-09-23T17:03:47-05:00
New Revision: 953ddded1aa2b459a939e0f1649691c9086ba416

URL: 
https://github.com/llvm/llvm-project/commit/953ddded1aa2b459a939e0f1649691c9086ba416
DIFF: 
https://github.com/llvm/llvm-project/commit/953ddded1aa2b459a939e0f1649691c9086ba416.diff

LOG: [lldb] Handle malformed qfThreadInfo reply

If the remote gdbserver's qfThreadInfo reply has a trailing comma,
GDBRemoteCommunicationClient::GetCurrentProcessAndThreadIDs will return
an empty vector of thread ids. This will cause lldb to recurse through
three functions trying to get the list of threads, until it blows its
stack and crashes.

A trailing comma is a malformed response, but it shouldn't cause lldb to
crash. This patch will return the tids received before the malformed
response.

Reviewed By: clayborg, labath

Differential Revision: https://reviews.llvm.org/D109937

Added: 

lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py

Modified: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index d949cfe7a64e8..bf4baf7b7a266 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2908,8 +2908,12 @@ 
GDBRemoteCommunicationClient::GetCurrentProcessAndThreadIDs(
   if (ch == 'm') {
 do {
   auto pid_tid = response.GetPidTid(LLDB_INVALID_PROCESS_ID);
+  // If we get an invalid response, break out of the loop.
+  // If there are valid tids, they have been added to ids.
+  // If there are no valid tids, we'll fall through to the
+  // bare-iron target handling below.
   if (!pid_tid)
-return {};
+break;
 
   ids.push_back(pid_tid.getValue());
   ch = response.GetChar(); // Skip the command separator

diff  --git 
a/lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py
 
b/lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py
new file mode 100644
index 0..0035e1c06297f
--- /dev/null
+++ 
b/lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py
@@ -0,0 +1,27 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+
+class TestThreadInfoTrailingComma(GDBRemoteTestBase):
+
+def test(self):
+class MyResponder(MockGDBServerResponder):
+def haltReason(self):
+return "T02thread:1"
+
+def qfThreadInfo(self):
+return "m1,2,3,4,"
+
+self.server.responder = MyResponder()
+target = self.dbg.CreateTarget('')
+if self.TraceOn():
+  self.runCmd("log enable gdb-remote packets")
+  self.addTearDownHook(
+lambda: self.runCmd("log disable gdb-remote packets"))
+process = self.connect(target)
+self.assertEqual(process.GetThreadAtIndex(0).GetThreadID(), 1)
+self.assertEqual(process.GetThreadAtIndex(1).GetThreadID(), 2)
+self.assertEqual(process.GetThreadAtIndex(2).GetThreadID(), 3)
+self.assertEqual(process.GetThreadAtIndex(3).GetThreadID(), 4)



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1758953 - [lldb-vscode] Fix focus thread when previous thread exits

2021-09-15 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2021-09-15T18:09:32-05:00
New Revision: 17589538aaef2b5ae27a0bfeb4346aff433aa59d

URL: 
https://github.com/llvm/llvm-project/commit/17589538aaef2b5ae27a0bfeb4346aff433aa59d
DIFF: 
https://github.com/llvm/llvm-project/commit/17589538aaef2b5ae27a0bfeb4346aff433aa59d.diff

LOG: [lldb-vscode] Fix focus thread when previous thread exits

The thread that Visual Studio Code displays on a stop is called the focus 
thread. When the previous focus thread exits and we stop in a new thread, 
lldb-vscode does not tell vscode to set the new thread as the focus thread, so 
it selects the first thread in the thread list.

This patch changes lldb-vscode to tell vscode that the new thread is the focus 
thread. It also includes a test that verifies the DAP stop message for this 
case contains the correct values.

Reviewed By: clayborg, wallace

Differential Revision: https://reviews.llvm.org/D109633

Added: 
lldb/test/API/tools/lldb-vscode/correct-thread/Makefile
lldb/test/API/tools/lldb-vscode/correct-thread/TestVSCode_correct_thread.py
lldb/test/API/tools/lldb-vscode/correct-thread/main.c

Modified: 
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 




diff  --git a/lldb/test/API/tools/lldb-vscode/correct-thread/Makefile 
b/lldb/test/API/tools/lldb-vscode/correct-thread/Makefile
new file mode 100644
index 0..121868fa8ec33
--- /dev/null
+++ b/lldb/test/API/tools/lldb-vscode/correct-thread/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+CFLAGS_EXTRAS := -lpthread
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/tools/lldb-vscode/correct-thread/TestVSCode_correct_thread.py 
b/lldb/test/API/tools/lldb-vscode/correct-thread/TestVSCode_correct_thread.py
new file mode 100644
index 0..4b7b03745692e
--- /dev/null
+++ 
b/lldb/test/API/tools/lldb-vscode/correct-thread/TestVSCode_correct_thread.py
@@ -0,0 +1,47 @@
+"""
+Test lldb-vscode setBreakpoints request
+"""
+
+from __future__ import print_function
+
+import unittest2
+import vscode
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+import lldbvscode_testcase
+
+
+class TestVSCode_correct_thread(lldbvscode_testcase.VSCodeTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfWindows
+@skipIfRemote
+def test_correct_thread(self):
+'''
+Tests that the correct thread is selected if we continue from
+a thread that goes away and hit a breakpoint in another thread.
+In this case, the selected thread should be the thread that
+just hit the breakpoint, and not the first thread in the list.
+'''
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program)
+source = 'main.c'
+breakpoint_line = line_number(source, '// break here')
+lines = [breakpoint_line]
+# Set breakpoint in the thread function
+breakpoint_ids = self.set_source_breakpoints(source, lines)
+self.assertEqual(len(breakpoint_ids), len(lines),
+"expect correct number of breakpoints")
+self.continue_to_breakpoints(breakpoint_ids)
+# We're now stopped at the breakpoint in the first thread, thread #2.
+# Continue to join the first thread and hit the breakpoint in the
+# second thread, thread #3.
+self.vscode.request_continue()
+stopped_event = self.vscode.wait_for_stopped()
+# Verify that the description is the relevant breakpoint,
+# preserveFocusHint is False and threadCausedFocus is True
+
self.assertTrue(stopped_event[0]['body']['description'].startswith('breakpoint 
%s.' % breakpoint_ids[0]))
+self.assertFalse(stopped_event[0]['body']['preserveFocusHint'])
+self.assertTrue(stopped_event[0]['body']['threadCausedFocus'])

diff  --git a/lldb/test/API/tools/lldb-vscode/correct-thread/main.c 
b/lldb/test/API/tools/lldb-vscode/correct-thread/main.c
new file mode 100644
index 0..157c3f994db1e
--- /dev/null
+++ b/lldb/test/API/tools/lldb-vscode/correct-thread/main.c
@@ -0,0 +1,23 @@
+#include 
+#include 
+
+int state_var;
+
+void *thread (void *in)
+{
+  state_var++; // break here
+  return NULL;
+}
+
+int main(int argc, char **argv)
+{
+  pthread_t t1, t2;
+
+  pthread_create(, NULL, *thread, NULL);
+  pthread_join(t1, NULL);
+  pthread_create(, NULL, *thread, NULL);
+  pthread_join(t2, NULL);
+
+  printf("state_var is %d\n", state_var);
+  return 0;
+}

diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp 
b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 59d8debe6378c..5c237c00deabe 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -232,13 +232,17 @@ void SendThreadStoppedEvent() {
   // set it as the focus thread if below if needed.
   lldb::tid_t 

[Lldb-commits] [lldb] 3169d92 - Remove special Hexagon packet traversal code

2020-08-05 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2020-08-05T12:05:42-05:00
New Revision: 3169d920ccd16ec3c3e1bf5d91595b70a5278045

URL: 
https://github.com/llvm/llvm-project/commit/3169d920ccd16ec3c3e1bf5d91595b70a5278045
DIFF: 
https://github.com/llvm/llvm-project/commit/3169d920ccd16ec3c3e1bf5d91595b70a5278045.diff

LOG: Remove special Hexagon packet traversal code

On Hexagon, breakpoints need to be on the first instruction of a packet.
When the LLVM disassembler for Hexagon returned 32 bit instructions, we
needed code to find the start of the current packet. Now that the LLVM
disassembler for Hexagon returns packets instead of instructions, we always
have the first instruction of the packet. Remove the packet traversal code
because it can cause problems when the next packet has more than one
instruction.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D84966

Added: 


Modified: 
lldb/include/lldb/Core/Disassembler.h
lldb/source/Core/Disassembler.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/ThreadPlanStepRange.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Disassembler.h 
b/lldb/include/lldb/Core/Disassembler.h
index 926a74b933ef..d3b903b83c19 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -279,9 +279,6 @@ class InstructionList {
   /// @param[in] start
   /// The instruction index of the first instruction to check.
   ///
-  /// @param[in] target
-  /// A LLDB target object that is used to resolve addresses.
-  ///
   /// @param[in] ignore_calls
   /// It true, then fine the first branch instruction that isn't
   /// a function call (a branch that calls and returns to the next
@@ -298,7 +295,6 @@ class InstructionList {
   /// found.
   //--
   uint32_t GetIndexOfNextBranchInstruction(uint32_t start,
-   Target ,
bool ignore_calls,
bool *found_calls) const;
 

diff  --git a/lldb/source/Core/Disassembler.cpp 
b/lldb/source/Core/Disassembler.cpp
index 4da823c7a243..cc98b7309d6d 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -990,17 +990,15 @@ void InstructionList::Append(lldb::InstructionSP 
_sp) {
 
 uint32_t
 InstructionList::GetIndexOfNextBranchInstruction(uint32_t start,
- Target ,
  bool ignore_calls,
  bool *found_calls) const {
   size_t num_instructions = m_instructions.size();
 
   uint32_t next_branch = UINT32_MAX;
-  size_t i;
   
   if (found_calls)
 *found_calls = false;
-  for (i = start; i < num_instructions; i++) {
+  for (size_t i = start; i < num_instructions; i++) {
 if (m_instructions[i]->DoesBranch()) {
   if (ignore_calls && m_instructions[i]->IsCall()) {
 if (found_calls)
@@ -1012,42 +1010,6 @@ 
InstructionList::GetIndexOfNextBranchInstruction(uint32_t start,
 }
   }
 
-  // Hexagon needs the first instruction of the packet with the branch. Go
-  // backwards until we find an instruction marked end-of-packet, or until we
-  // hit start.
-  if (target.GetArchitecture().GetTriple().getArch() == llvm::Triple::hexagon) 
{
-// If we didn't find a branch, find the last packet start.
-if (next_branch == UINT32_MAX) {
-  i = num_instructions - 1;
-}
-
-while (i > start) {
-  --i;
-
-  Status error;
-  uint32_t inst_bytes;
-  bool prefer_file_cache = false; // Read from process if process is 
running
-  lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
-  target.ReadMemory(m_instructions[i]->GetAddress(), prefer_file_cache,
-_bytes, sizeof(inst_bytes), error, _addr);
-  // If we have an error reading memory, return start
-  if (!error.Success())
-return start;
-  // check if this is the last instruction in a packet bits 15:14 will be
-  // 11b or 00b for a duplex
-  if (((inst_bytes & 0xC000) == 0xC000) ||
-  ((inst_bytes & 0xC000) == 0x)) {
-// instruction after this should be the start of next packet
-next_branch = i + 1;
-break;
-  }
-}
-
-if (next_branch == UINT32_MAX) {
-  // We couldn't find the previous packet, so return start
-  next_branch = start;
-}
-  }
   return next_branch;
 }
 

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 36a2930f7915..e88911ad7210 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -5947,10 +5947,8 @@ Process::AdvanceAddressToNextBranchInstruction(Address 
default_stop_addr,
 return retval;
   }
 
-  uint32_t branch_index =
-  

[Lldb-commits] [lldb] cecc185 - Add REQUIRES: x86 so this won't be run if x86 is not available.

2020-02-13 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2020-02-13T11:17:27-06:00
New Revision: cecc185166c03945f1c06f8d3e1993720f3d3c1a

URL: 
https://github.com/llvm/llvm-project/commit/cecc185166c03945f1c06f8d3e1993720f3d3c1a
DIFF: 
https://github.com/llvm/llvm-project/commit/cecc185166c03945f1c06f8d3e1993720f3d3c1a.diff

LOG: Add REQUIRES: x86 so this won't be run if x86 is not available.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s

Removed: 




diff  --git 
a/lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s 
b/lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s
index 96e4abe110e6..1448993672a1 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s
@@ -1,3 +1,5 @@
+# REQUIRES: x86
+
 # RUN: llvm-mc -filetype=obj -o %t -triple x86_64-pc-linux %s
 # RUN: %lldb %t -o "target variable reset" -b | FileCheck %s
 



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 6fd818c - Don't fail step out if remote server doesn't implement qMemoryRegionInfo

2020-02-10 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2020-02-10T13:40:44-06:00
New Revision: 6fd818c5a9c565b8aaeaf1ca85ad14735ee0eb0c

URL: 
https://github.com/llvm/llvm-project/commit/6fd818c5a9c565b8aaeaf1ca85ad14735ee0eb0c
DIFF: 
https://github.com/llvm/llvm-project/commit/6fd818c5a9c565b8aaeaf1ca85ad14735ee0eb0c.diff

LOG: Don't fail step out if remote server doesn't implement qMemoryRegionInfo

Summary:
The return address validation in D71372 will fail if the memory permissions 
can't be determined. Many embedded stubs either don't implement the 
qMemoryRegionInfo packet, or don't have memory permissions at all.

Remove the return from the if clause that calls GetLoadAddressPermissions, so 
this call failing doesn't cause the step out to abort. Instead, assume that the 
memory permission check doesn't apply to this type of target.

Reviewers: labath, jingham, clayborg, mossberg

Reviewed By: labath, jingham

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D72513

Added: 


Modified: 
lldb/source/Target/ThreadPlanStepOut.cpp

Removed: 




diff  --git a/lldb/source/Target/ThreadPlanStepOut.cpp 
b/lldb/source/Target/ThreadPlanStepOut.cpp
index eead322f6b89..7581ccea625a 100644
--- a/lldb/source/Target/ThreadPlanStepOut.cpp
+++ b/lldb/source/Target/ThreadPlanStepOut.cpp
@@ -130,11 +130,9 @@ ThreadPlanStepOut::ThreadPlanStepOut(
 uint32_t permissions = 0;
 if (!m_thread.GetProcess()->GetLoadAddressPermissions(m_return_addr,
   permissions)) {
-  m_constructor_errors.Printf("Return address (0x%" PRIx64
-  ") permissions not found.",
-  m_return_addr);
-  LLDB_LOGF(log, "ThreadPlanStepOut(%p): %s", static_cast(this),
-m_constructor_errors.GetData());
+  LLDB_LOGF(log, "ThreadPlanStepOut(%p): Return address (0x%" PRIx64
+") permissions not found.", static_cast(this),
+m_return_addr);
 } else if (!(permissions & ePermissionsExecutable)) {
   m_constructor_errors.Printf("Return address (0x%" PRIx64
   ") did not point to executable memory.",



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 04488c4 - Don't fail step out if remote server doesn't implement qMemoryRegionInfo

2020-01-28 Thread Ted Woodward via lldb-commits

Author: Ted Woodward
Date: 2020-01-28T13:36:06-06:00
New Revision: 04488c485a8875ba4bd6d2d004ac778276ae37e0

URL: 
https://github.com/llvm/llvm-project/commit/04488c485a8875ba4bd6d2d004ac778276ae37e0
DIFF: 
https://github.com/llvm/llvm-project/commit/04488c485a8875ba4bd6d2d004ac778276ae37e0.diff

LOG: Don't fail step out if remote server doesn't implement qMemoryRegionInfo

Summary:
The return address validation in D71372 will fail if the memory permissions 
can't be determined. Many embedded stubs either don't implement the 
qMemoryRegionInfo packet, or don't have memory permissions at all.

Remove the return from the if clause that calls GetLoadAddressPermissions, so 
this call failing doesn't cause the step out to abort. Instead, assume that the 
memory permission check doesn't apply to this type of target.

Reviewers: labath, jingham, clayborg, mossberg

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D72513

Added: 


Modified: 
lldb/source/Target/ThreadPlanStepOut.cpp

Removed: 




diff  --git a/lldb/source/Target/ThreadPlanStepOut.cpp 
b/lldb/source/Target/ThreadPlanStepOut.cpp
index 9ca1b3fc03ab..eead322f6b89 100644
--- a/lldb/source/Target/ThreadPlanStepOut.cpp
+++ b/lldb/source/Target/ThreadPlanStepOut.cpp
@@ -135,7 +135,6 @@ ThreadPlanStepOut::ThreadPlanStepOut(
   m_return_addr);
   LLDB_LOGF(log, "ThreadPlanStepOut(%p): %s", static_cast(this),
 m_constructor_errors.GetData());
-  return;
 } else if (!(permissions & ePermissionsExecutable)) {
   m_constructor_errors.Printf("Return address (0x%" PRIx64
   ") did not point to executable memory.",



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r341849 - Fix raw address breakpoints not resolving

2018-09-10 Thread Ted Woodward via lldb-commits
Author: ted
Date: Mon Sep 10 11:19:01 2018
New Revision: 341849

URL: http://llvm.org/viewvc/llvm-project?rev=341849=rev
Log:
Fix raw address breakpoints not resolving

Summary: An address breakpoint of the form "b 0x1000" won't resolve if it's 
created while the process isn't running. This patch deletes 
Address::SectionWasDeleted, renames Address::SectionWasDeletedPrivate to 
SectionWasDeleted (and makes it public), and changes the section check in 
Breakpoint::ModulesChanged back to its original form

Reviewers: jingham, #lldb

Reviewed By: jingham

Subscribers: davide, lldb-commits

Differential Revision: https://reviews.llvm.org/D51816

Modified:
lldb/trunk/include/lldb/Core/Address.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
lldb/trunk/source/Breakpoint/Breakpoint.cpp
lldb/trunk/source/Core/Address.cpp

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=341849=341848=341849=diff
==
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Mon Sep 10 11:19:01 2018
@@ -525,11 +525,11 @@ public:
   bool CalculateSymbolContextLineEntry(LineEntry _entry) const;
 
   //--
-  // Returns true if the section should be valid, but isn't because the shared
-  // pointer to the section can't be reconstructed from a weak pointer that
-  // contains a valid weak reference to a section. Returns false if the section
-  // weak pointer has no reference to a section, or if the section is still
-  // valid
+  // Returns true if the m_section_wp once had a reference to a valid section
+  // shared pointer, but no longer does. This can happen if we have an address
+  // from a module that gets unloaded and deleted. This function should only be
+  // called if GetSection() returns an empty shared pointer and you want to
+  // know if this address used to have a valid section.
   //--
   bool SectionWasDeleted() const;
 
@@ -539,15 +539,6 @@ protected:
   //--
   lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL.
   lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is 
valid...
-
-  //--
-  // Returns true if the m_section_wp once had a reference to a valid section
-  // shared pointer, but no longer does. This can happen if we have an address
-  // from a module that gets unloaded and deleted. This function should only be
-  // called if GetSection() returns an empty shared pointer and you want to
-  // know if this address used to have a valid section.
-  //--
-  bool SectionWasDeletedPrivate() const;
 };
 
 //--

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py?rev=341849=341848=341849=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
 Mon Sep 10 11:19:01 2018
@@ -97,3 +97,40 @@ class AddressBreakpointTestCase(TestBase
 
 # The hit count for the breakpoint should now be 2.
 self.assertTrue(breakpoint.GetHitCount() == 2)
+
+
+
+def test_address_breakpoint_set_before_launch(self):
+"""Test that an address bp set before the process is launched works 
correctly."""
+self.build()
+
+exe = self.getBuildArtifact("a.out")
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+# get the address of the symbol "main"
+sc_list = target.FindSymbols("main", lldb.eSymbolTypeCode)
+symbol = sc_list.GetContextAtIndex(0).GetSymbol()
+address = symbol.GetStartAddress().GetFileAddress()
+
+# BreakpointCreateBySBAddress will resolve the address, causing this
+# test to always pass, so use runCmd
+self.runCmd("break set -a " + str(address))
+
+# Disable ASLR.  This will allow us to actually test (on platforms 
that support this flag)
+# that the breakpoint was able to track the module.
+
+launch_info = 

[Lldb-commits] [lldb] r315524 - Add cases for new type DependentAddressSpace, added in r314649

2017-10-11 Thread Ted Woodward via lldb-commits
Author: ted
Date: Wed Oct 11 15:42:21 2017
New Revision: 315524

URL: http://llvm.org/viewvc/llvm-project?rev=315524=rev
Log:
Add cases for new type DependentAddressSpace, added in r314649


Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=315524=315523=315524=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Oct 11 15:42:21 2017
@@ -4351,6 +4351,9 @@ ClangASTContext::GetTypeClass(lldb::opaq
 break;
   case clang::Type::ObjCTypeParam:
 break;
+
+  case clang::Type::DependentAddressSpace:
+break;
   }
   // We don't know hot to display this type...
   return lldb::eTypeClassOther;
@@ -5161,6 +5164,9 @@ lldb::Encoding ClangASTContext::GetEncod
 break;
   case clang::Type::ObjCTypeParam:
 break;
+
+  case clang::Type::DependentAddressSpace:
+break;
   }
   count = 0;
   return lldb::eEncodingInvalid;
@@ -5311,6 +5317,9 @@ lldb::Format ClangASTContext::GetFormat(
 break;
   case clang::Type::ObjCTypeParam:
 break;
+
+  case clang::Type::DependentAddressSpace:
+break;
   }
   // We don't know hot to display this type...
   return lldb::eFormatBytes;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r313799 - Fix warning caused by new clang::BuiltinType::Float16 added in r312794

2017-09-20 Thread Ted Woodward via lldb-commits
Author: ted
Date: Wed Sep 20 12:16:53 2017
New Revision: 313799

URL: http://llvm.org/viewvc/llvm-project?rev=313799=rev
Log:
Fix warning caused by new clang::BuiltinType::Float16 added in r312794

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=313799=313798=313799=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Sep 20 12:16:53 2017
@@ -5009,6 +5009,7 @@ lldb::Encoding ClangASTContext::GetEncod
 
 case clang::BuiltinType::Half:
 case clang::BuiltinType::Float:
+case clang::BuiltinType::Float16:
 case clang::BuiltinType::Float128:
 case clang::BuiltinType::Double:
 case clang::BuiltinType::LongDouble:


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r312726 - Fix lldb-mi test data_read_memory_bytes_global

2017-09-07 Thread Ted Woodward via lldb-commits
Author: ted
Date: Thu Sep  7 09:24:39 2017
New Revision: 312726

URL: http://llvm.org/viewvc/llvm-project?rev=312726=rev
Log:
Fix lldb-mi test data_read_memory_bytes_global

Summary:
Test was skipped because -data-evaluate-expression was thought
to not work on globals. This is not the case - the issue was clang
removes debug info for globals in cpp files that are not used.

Add a reference to the globals in question, and fix memory patter in
test to match memory pattern in testcase.

Reviewers: ki.stfu, abidh

Reviewed By: ki.stfu

Subscribers: aprantl, lldb-commits

Differential Revision: https://reviews.llvm.org/D37533

Modified:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py?rev=312726=312725=312726=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py 
Thu Sep  7 09:24:39 2017
@@ -88,8 +88,6 @@ class MiDataTestCase(lldbmi_testcase.MiT
 
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-# FIXME: the global case worked before refactoring
-@unittest2.skip("-data-evaluate-expression doesn't work on globals")
 def test_lldbmi_data_read_memory_bytes_global(self):
 """Test that -data-read-memory-bytes can access global buffers."""
 
@@ -115,7 +113,7 @@ class MiDataTestCase(lldbmi_testcase.MiT
 # Test that -data-read-memory-bytes works for char[] type (global)
 self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
 self.expect(
-
"\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]"
 %
+
"\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1011121300\"}\]"
 %
 (addr, addr + size))
 
 # Get address of static char[]
@@ -127,7 +125,7 @@ class MiDataTestCase(lldbmi_testcase.MiT
 # Test that -data-read-memory-bytes works for static char[] type
 self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
 self.expect(
-
"\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]"
 %
+
"\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"2021222300\"}\]"
 %
 (addr, addr + size))
 
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp?rev=312726=312725=312726=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp Thu 
Sep  7 09:24:39 2017
@@ -17,6 +17,8 @@ local_array_test_inner()
 {
 char array[] = { 0x01, 0x02, 0x03, 0x04 };
 char *first_element_ptr = [0];
+char g = g_CharArray[0];
+char s = s_CharArray[0];
 // BP_local_array_test_inner
 return;
 }


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r312270 - lldb-mi: -var-update can hang when traversing complex types with pointers

2017-08-31 Thread Ted Woodward via lldb-commits
Author: ted
Date: Thu Aug 31 12:22:33 2017
New Revision: 312270

URL: http://llvm.org/viewvc/llvm-project?rev=312270=rev
Log:
lldb-mi: -var-update can hang when traversing complex types with pointers

Summary:
-var-update calls CMICmdCmdVarUpdate::ExamineSBValueForChange to check if a 
varObj has been updated. It checks that the varObj is updated, then recurses on 
all of its children. If a child is a pointer pointing back to a parent node, 
this will result in an infinite loop, and lldb-mi hanging.

The problem is exposed by 
packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py, but this 
test is skipped everywhere.

This patch changes ExamineSBValueForChange to not traverse children of varObjs 
that are pointers.

Reviewers: ki.stfu, zturner, clayborg, abidh

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D37154

Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp?rev=312270=312269=312270=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp Thu Aug 31 12:22:33 2017
@@ -509,19 +509,19 @@ bool CMICmdCmdVarUpdate::ExamineSBValueF
 return MIstatus::success;
   }
 
-  lldb::SBType valueType = vrwValue.GetType();
-
   const MIuint nChildren = vrwValue.GetNumChildren();
   for (MIuint i = 0; i < nChildren; ++i) {
 lldb::SBValue member = vrwValue.GetChildAtIndex(i);
 if (!member.IsValid())
   continue;
 
-if (member.GetValueDidChange()) {
-  vrwbChanged = true;
-  return MIstatus::success;
-} else if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
-  // Handle composite types (i.e. struct or arrays)
+// skip pointers and references to avoid infinite loop
+if (member.GetType().GetTypeFlags() &
+(lldb::eTypeIsPointer | lldb::eTypeIsReference))
+  continue;
+
+// Handle composite types (i.e. struct or arrays)
+if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged)
   return MIstatus::success;
   }
   vrwbChanged = false;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r303278 - Fix error string set in AddName to take a StringRef.

2017-05-17 Thread Ted Woodward via lldb-commits
Author: ted
Date: Wed May 17 12:48:55 2017
New Revision: 303278

URL: http://llvm.org/viewvc/llvm-project?rev=303278=rev
Log:
Fix error string set in AddName to take a StringRef.


Modified:
lldb/trunk/source/Breakpoint/Breakpoint.cpp

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=303278=303277=303278=diff
==
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Wed May 17 12:48:55 2017
@@ -837,8 +837,8 @@ bool Breakpoint::AddName(llvm::StringRef
   if (new_name.empty())
 return false;
   if (!BreakpointID::StringIsBreakpointName(new_name, error)) {
-error.SetErrorStringWithFormat("input name \"%s\" not a breakpoint name.",
-   new_name);
+error.SetErrorStringWithFormatv("input name \"{0}\" not a breakpoint 
name.",
+new_name);
 return false;
   }
   if (!error.Success())


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D23802: gdb-remote: Make the sequence mutex non-recursive

2016-10-12 Thread Ted Woodward via lldb-commits
ted added a comment.

I'm seeing the same issue as Nitesh, except in a different spot. The Hexagon 
Simulator doesn't support QSaveRegisterState, so lldb calls 
GDBRemoteRegisterContext::ReadAllRegisterValues.  It gets a lock on the 
communication client, then calls ReadAllRegisters, which tries to get a lock on 
the communication client, and fails (hangs on Linux, crashes on Windows).

The revert fixed the problem.


Repository:
  rL LLVM

https://reviews.llvm.org/D23802



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25137: [lldbmi] Fix prompt which can get inserted in the middle of lldb-mi output

2016-09-30 Thread Ted Woodward via lldb-commits
ted accepted this revision.
ted added a comment.
This revision is now accepted and ready to land.

The problem this scenario has is asynchronous output from 2 different sources. 
The original fix made Windows (or any lldb without libedit) much better, but I 
think most non-Windows builds will use libedit, because it's extremely useful. 
lldb-mi has a different set of constraints; the position of the prompt isn't as 
important, since users won't use it as a cue to tell when the debugger can 
accept more input.

Since this improves lldb-mi, and only hurts a use case I think is not very 
prevalent (LLDB_DISABLE_LIBEDIT on a non-Windows platform), I think it's OK. 
LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D25137



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D21649: Don't create unnecessary remote platforms

2016-06-23 Thread Ted Woodward via lldb-commits
ted added a subscriber: ted.
ted added a comment.

The Hexagon platform (currently in-house only) acts like the ios simulator 
platform, in that it doesn't connect - it fixes up the command line, then 
launches the Hexagon simulator (based on the debugserver launch code in the 
gdb-remote process plugin).


http://reviews.llvm.org/D21649



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D20135: Keep original source path and mapped path in LineEntry

2016-05-10 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added reviewers: jingham, clayborg.
ted added a subscriber: lldb-commits.

The "file" variable in a LineEntry was mapped using target.source-map, except 
when stepping through inlined code. This patch adds a new variable to 
LineEntry, "original_file", that contains the original file from the debug 
info. "file" will continue to (possibly) be mapped.

Some code has been changed to use "original_file". This is code dealing with 
symbols. Code dealing with source files will still use "file". Reviewers, 
please confirm that these particular changes are correct.

Tests run on Ubuntu 12.04 show no regression.

http://reviews.llvm.org/D20135

Files:
  include/lldb/Symbol/LineEntry.h
  source/Breakpoint/BreakpointResolver.cpp
  source/Symbol/LineEntry.cpp
  source/Symbol/LineTable.cpp
  source/Symbol/SymbolContext.cpp
  source/Target/StackFrame.cpp
  source/Target/StackFrameList.cpp
  source/Target/ThreadPlanStepOverRange.cpp
  source/Target/ThreadPlanStepRange.cpp

Index: source/Target/ThreadPlanStepRange.cpp
===
--- source/Target/ThreadPlanStepRange.cpp
+++ source/Target/ThreadPlanStepRange.cpp
@@ -155,7 +155,7 @@
 SymbolContext new_context(frame->GetSymbolContext(eSymbolContextEverything));
 if (m_addr_context.line_entry.IsValid() && new_context.line_entry.IsValid())
 {
-if (m_addr_context.line_entry.file == new_context.line_entry.file)
+if (m_addr_context.line_entry.original_file == new_context.line_entry.original_file)
 {
 if (m_addr_context.line_entry.line == new_context.line_entry.line)
 {
Index: source/Target/ThreadPlanStepOverRange.cpp
===
--- source/Target/ThreadPlanStepOverRange.cpp
+++ source/Target/ThreadPlanStepOverRange.cpp
@@ -256,7 +256,7 @@
 // some code fragment by using #include  directly.
 LineEntry prev_line_entry;
 if (line_table->GetLineEntryAtIndex(entry_idx - 1, prev_line_entry)
-&& prev_line_entry.file == line_entry.file)
+&& prev_line_entry.original_file == line_entry.original_file)
 {
 SymbolContext prev_sc;
 Address prev_address = prev_line_entry.range.GetBaseAddress();
@@ -289,7 +289,7 @@
 if (next_line_function != m_addr_context.function)
 break;
 
-if (next_line_entry.file == m_addr_context.line_entry.file)
+if (next_line_entry.original_file == m_addr_context.line_entry.original_file)
 {
 const bool abort_other_plans = false;
 const RunMode stop_other_threads = RunMode::eAllThreads;
Index: source/Target/StackFrameList.cpp
===
--- source/Target/StackFrameList.cpp
+++ source/Target/StackFrameList.cpp
@@ -350,6 +350,7 @@
 if (unwind_block)
 {
 Address curr_frame_address (unwind_frame_sp->GetFrameCodeAddress());
+TargetSP target_sp = m_thread.CalculateTarget();
 // Be sure to adjust the frame address to match the address
 // that was used to lookup the symbol context above. If we are
 // in the first concrete frame, then we lookup using the current
@@ -362,9 +363,8 @@
 // If curr_frame_address points to the first address in a section then after
 // adjustment it will point to an other section. In that case resolve the
 // address again to the correct section plus offset form.
-TargetSP target = m_thread.CalculateTarget();
-addr_t load_addr = curr_frame_address.GetOpcodeLoadAddress(target.get(), eAddressClassCode);
-curr_frame_address.SetOpcodeLoadAddress(load_addr - 1, target.get(), eAddressClassCode);
+addr_t load_addr = curr_frame_address.GetOpcodeLoadAddress(target_sp.get(), eAddressClassCode);
+curr_frame_address.SetOpcodeLoadAddress(load_addr - 1, target_sp.get(), eAddressClassCode);
 }
 else
 {
@@ -377,17 +377,18 @@
 
 while (unwind_sc.GetParentOfInlinedScope(curr_frame_address, next_frame_sc, next_frame_address))
 {
-

Re: [Lldb-commits] [PATCH] D20035: Add source file mapping to inline frames' SymbolContext line_entry.file

2016-05-10 Thread Ted Woodward via lldb-commits
ted abandoned this revision.
ted added a comment.

Problem will be fixed in another way.


http://reviews.llvm.org/D20035



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D20035: Add source file mapping to inline frames' SymbolContext line_entry.file

2016-05-06 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added a reviewer: jingham.
ted added a subscriber: lldb-commits.

new StackFrame objects created in StackFrameList::GetFramesUpTo are constructed 
with SymbolContext set to nullptr, except for inline frames. Calling the ctor 
with nullptr causes StackFrame::GetSymbolContext to apply the target.source-map 
to line_entry.file. Calling it with a valid SC will cause line_entry.file to 
have the original file from the DWARF info, so the file comparison in 
ThreadPlanStepRange::InRange will fail when it should succeed.

This patch adds the mapping from StackFrame::GetSymbolContext to the inline 
frame case in StackFrameList::GetFramesUpTo.

http://reviews.llvm.org/D20035

Files:
  source/Target/StackFrameList.cpp

Index: source/Target/StackFrameList.cpp
===
--- source/Target/StackFrameList.cpp
+++ source/Target/StackFrameList.cpp
@@ -350,6 +350,8 @@
 if (unwind_block)
 {
 Address curr_frame_address 
(unwind_frame_sp->GetFrameCodeAddress());
+TargetSP target_sp = m_thread.CalculateTarget();
+
 // Be sure to adjust the frame address to match the address
 // that was used to lookup the symbol context above. If we are
 // in the first concrete frame, then we lookup using the 
current
@@ -362,9 +364,8 @@
 // If curr_frame_address points to the first address 
in a section then after
 // adjustment it will point to an other section. In 
that case resolve the
 // address again to the correct section plus offset 
form.
-TargetSP target = m_thread.CalculateTarget();
-addr_t load_addr = 
curr_frame_address.GetOpcodeLoadAddress(target.get(), eAddressClassCode);
-curr_frame_address.SetOpcodeLoadAddress(load_addr - 1, 
target.get(), eAddressClassCode);
+addr_t load_addr = 
curr_frame_address.GetOpcodeLoadAddress(target_sp.get(), eAddressClassCode);
+curr_frame_address.SetOpcodeLoadAddress(load_addr - 1, 
target_sp.get(), eAddressClassCode);
 }
 else
 {
@@ -377,17 +378,25 @@
 
 while (unwind_sc.GetParentOfInlinedScope(curr_frame_address, 
next_frame_sc, next_frame_address))
 {
-StackFrameSP frame_sp(new StackFrame 
(m_thread.shared_from_this(),
-  m_frames.size(),
-  idx,
-  
unwind_frame_sp->GetRegisterContextSP (),
-  cfa,
-  
next_frame_address,
-  
_frame_sc));  
-
-m_frames.push_back (frame_sp);
-unwind_sc = next_frame_sc;
-curr_frame_address = next_frame_address;
+if (target_sp)
+{
+// Be sure to apply and file remappings to our file 
and line
+// entries when handing out a line entry
+FileSpec new_file_spec;
+if 
(target_sp->GetSourcePathMap().FindFile(next_frame_sc.line_entry.file, 
new_file_spec))
+next_frame_sc.line_entry.file = new_file_spec;
+}
+StackFrameSP frame_sp(new 
StackFrame(m_thread.shared_from_this(),
+ m_frames.size(),
+ idx,
+ 
unwind_frame_sp->GetRegisterContextSP (),
+ cfa,
+ next_frame_address,
+ _frame_sc));  
+
+m_frames.push_back (frame_sp);
+unwind_sc = next_frame_sc;
+curr_frame_address = next_frame_address;
 }
 }
 } while (m_frames.size() - 1 < end_idx);


Index: source/Target/StackFrameList.cpp
===
--- source/Target/StackFrameList.cpp
+++ source/Target/StackFrameList.cpp
@@ -350,6 +350,8 @@
 if (unwind_block)
 {
 Address curr_frame_address (unwind_frame_sp->GetFrameCodeAddress());
+TargetSP target_sp = m_thread.CalculateTarget();
+
 // Be sure to 

Re: [Lldb-commits] [PATCH] D18531: Allow gdbremote process to read modules from memory

2016-03-30 Thread Ted Woodward via lldb-commits
ted added a comment.

Thanks for adding me, Tamas.

It looks like removing the code in the Hexagon Dynamic Loader plugin will have 
lldb drill down into ObjectFileElf, and end up doing the same thing - set the 
load address of each section of the ELF file. So it should behave the same as 
before this patch. I don't think we'll ever need too load a module from memory, 
but if we do, we can now. LGTM.


http://reviews.llvm.org/D18531



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D18484: Change windows cmake to require debug libraries for a debug build, otherwise release libraries

2016-03-25 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added a reviewer: zturner.
ted added a subscriber: lldb-commits.

On Windows we require both debug and release python executable/libraries; this 
change requires debug for a debug build and release for other builds.

If CMAKE_BUILD_TYPE is not specified, the llvm CMakeLists.txt defaults to 
"Debug".

http://reviews.llvm.org/D18484

Files:
  cmake/modules/LLDBConfig.cmake

Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -122,10 +122,18 @@
 unset(PYTHON_RELEASE_DLL)
   endif()
 
-  if (NOT (PYTHON_DEBUG_EXE AND PYTHON_RELEASE_EXE AND PYTHON_DEBUG_LIB AND 
PYTHON_RELEASE_LIB AND PYTHON_DEBUG_DLL AND PYTHON_RELEASE_DLL))
-message("Python installation is corrupt. Python support will be disabled 
for this build.")
-set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
-return()
+  if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+if (NOT (PYTHON_DEBUG_EXE AND PYTHON_DEBUG_LIB AND PYTHON_DEBUG_DLL))
+  message("Python installation is corrupt. Python support will be disabled 
for this build.")
+  set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
+  return()
+endif()
+  else()
+if (NOT (PYTHON_RELEASE_EXE AND PYTHON_RELEASE_LIB AND PYTHON_RELEASE_DLL))
+  message("Python installation is corrupt. Python support will be disabled 
for this build.")
+  set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
+  return()
+endif()
   endif()
 
   # Generator expressions are evaluated in the context of each build 
configuration generated


Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -122,10 +122,18 @@
 unset(PYTHON_RELEASE_DLL)
   endif()
 
-  if (NOT (PYTHON_DEBUG_EXE AND PYTHON_RELEASE_EXE AND PYTHON_DEBUG_LIB AND PYTHON_RELEASE_LIB AND PYTHON_DEBUG_DLL AND PYTHON_RELEASE_DLL))
-message("Python installation is corrupt. Python support will be disabled for this build.")
-set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
-return()
+  if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+if (NOT (PYTHON_DEBUG_EXE AND PYTHON_DEBUG_LIB AND PYTHON_DEBUG_DLL))
+  message("Python installation is corrupt. Python support will be disabled for this build.")
+  set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
+  return()
+endif()
+  else()
+if (NOT (PYTHON_RELEASE_EXE AND PYTHON_RELEASE_LIB AND PYTHON_RELEASE_DLL))
+  message("Python installation is corrupt. Python support will be disabled for this build.")
+  set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
+  return()
+endif()
   endif()
 
   # Generator expressions are evaluated in the context of each build configuration generated
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r264332 - Fix for missing prompt on Windows

2016-03-24 Thread Ted Woodward via lldb-commits
Author: ted
Date: Thu Mar 24 15:35:03 2016
New Revision: 264332

URL: http://llvm.org/viewvc/llvm-project?rev=264332=rev
Log:
Fix for missing prompt on Windows

Summary: On Windows (and possibly other hosts with LLDB_DISABLE_LIBEDIT 
defined), the (lldb) prompt won't print after async output, like from a 
breakpoint hit or a step. This patch forces the prompt to be printed out after 
async output.

Reviewers: zturner, clayborg

Subscribers: amccarth, lldb-commits

Differential Revision: http://reviews.llvm.org/D18335

Modified:
lldb/trunk/source/Core/IOHandler.cpp

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=264332=264331=264332=diff
==
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Thu Mar 24 15:35:03 2016
@@ -47,6 +47,10 @@
 #include "lldb/Target/StackFrame.h"
 #endif
 
+#ifdef _MSC_VER
+#include 
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -773,7 +777,26 @@ IOHandlerEditline::PrintAsync (Stream *s
 m_editline_ap->PrintAsync(stream, s, len);
 else
 #endif
+{
+const char *prompt = GetPrompt();
+#ifdef _MSC_VER
+if (prompt)
+{
+// Back up over previous prompt using Windows API
+CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
+HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+GetConsoleScreenBufferInfo(console_handle, _buffer_info);
+COORD coord = screen_buffer_info.dwCursorPosition;
+coord.X -= strlen(prompt);
+if (coord.X < 0)
+coord.X = 0;
+SetConsoleCursorPosition(console_handle, coord);
+}
+#endif
 IOHandler::PrintAsync(stream, s, len);
+if (prompt)
+IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, 
strlen(prompt));
+}
 }
 
 // we may want curses to be disabled for some builds


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18335: Fix for missing prompt on Windows

2016-03-23 Thread Ted Woodward via lldb-commits
ted added a comment.

Adrian and I worked out what is going on:

1. Run starts the launch and writes a prompt
2. State change fires, prints out “launching” through async, overwriting the 
prompt from 1) and writing a new prompt
3. CommandObjectProcessLaunch::Execute appends “launch” to the result. The 
result gets printed, after the prompt from 2)
4. State change fires, prints out “stopped” through async, overwriting no 
prompt because we’re on a fresh line and writing a new prompt

I think the only way to fix this is to copy the Windows specific code from 
IOHandlerEditLine::PrintAsync to CommandObjectProcessLaunch::Execute. Adrian 
and I don't want to add platform specific code to CommandObjectProcessLaunch, 
and this fix is a major improvement, so we'll go with this version.


http://reviews.llvm.org/D18335



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18335: Fix for missing prompt on Windows

2016-03-23 Thread Ted Woodward via lldb-commits
ted updated this revision to Diff 51462.
ted added a comment.

Updated to change cursor position before async output so old prompt is 
overwritten.

Adrian, please test with your setup and let me know if it solves the issues you 
see.


http://reviews.llvm.org/D18335

Files:
  source/Core/IOHandler.cpp

Index: source/Core/IOHandler.cpp
===
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -52,6 +52,10 @@
 #include "lldb/Target/StackFrame.h"
 #endif
 
+#ifdef _MSC_VER
+#include 
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -794,7 +798,26 @@
 m_editline_ap->PrintAsync(stream, s, len);
 else
 #endif
+{
+const char *prompt = GetPrompt();
+#ifdef _MSC_VER
+if (prompt)
+{
+// Back up over previous prompt using Windows API
+CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
+HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+GetConsoleScreenBufferInfo(console_handle, _buffer_info);
+COORD coord = screen_buffer_info.dwCursorPosition;
+coord.X -= strlen(prompt);
+if (coord.X < 0)
+coord.X = 0;
+SetConsoleCursorPosition(console_handle, coord);
+}
+#endif
 IOHandler::PrintAsync(stream, s, len);
+if (prompt)
+IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, 
strlen(prompt));
+}
 }
 
 // we may want curses to be disabled for some builds


Index: source/Core/IOHandler.cpp
===
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -52,6 +52,10 @@
 #include "lldb/Target/StackFrame.h"
 #endif
 
+#ifdef _MSC_VER
+#include 
+#endif
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -794,7 +798,26 @@
 m_editline_ap->PrintAsync(stream, s, len);
 else
 #endif
+{
+const char *prompt = GetPrompt();
+#ifdef _MSC_VER
+if (prompt)
+{
+// Back up over previous prompt using Windows API
+CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
+HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+GetConsoleScreenBufferInfo(console_handle, _buffer_info);
+COORD coord = screen_buffer_info.dwCursorPosition;
+coord.X -= strlen(prompt);
+if (coord.X < 0)
+coord.X = 0;
+SetConsoleCursorPosition(console_handle, coord);
+}
+#endif
 IOHandler::PrintAsync(stream, s, len);
+if (prompt)
+IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, strlen(prompt));
+}
 }
 
 // we may want curses to be disabled for some builds
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D18335: Fix for missing prompt on Windows

2016-03-21 Thread Ted Woodward via lldb-commits
ted added a comment.

Without the patch I'm seeing the original prompt printed after the command, in 
a line like this:

(lldb) Process 1 stopped

and no prompt after the async output from the stop.

With the patch I see the above prompt, and a prompt after the async output. I 
think with the patch is better, but we do need to remove the original prompt.

There's a Windows EditLine implementation at 
http://mingweditline.sourceforge.net/ that builds with VS2010; it might work 
with 2013/2015.


http://reviews.llvm.org/D18335



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D18335: Fix for missing prompt on Windows

2016-03-21 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added reviewers: clayborg, zturner.
ted added a subscriber: lldb-commits.

On Windows (and possibly other hosts with LLDB_DISABLE_LIBEDIT defined), the 
(lldb) prompt won't print after async output, like from a breakpoint hit or a 
step. This patch forces the prompt to be printed out after async output.

http://reviews.llvm.org/D18335

Files:
  source/Core/IOHandler.cpp

Index: source/Core/IOHandler.cpp
===
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -773,7 +773,13 @@
 m_editline_ap->PrintAsync(stream, s, len);
 else
 #endif
+{
 IOHandler::PrintAsync(stream, s, len);
+const char *prompt = GetPrompt();
+if (prompt)
+IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, 
strlen(prompt));
+}
+
 }
 
 // we may want curses to be disabled for some builds


Index: source/Core/IOHandler.cpp
===
--- source/Core/IOHandler.cpp
+++ source/Core/IOHandler.cpp
@@ -773,7 +773,13 @@
 m_editline_ap->PrintAsync(stream, s, len);
 else
 #endif
+{
 IOHandler::PrintAsync(stream, s, len);
+const char *prompt = GetPrompt();
+if (prompt)
+IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, strlen(prompt));
+}
+
 }
 
 // we may want curses to be disabled for some builds
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r263066 - Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

2016-03-09 Thread Ted Woodward via lldb-commits
Author: ted
Date: Wed Mar  9 16:05:17 2016
New Revision: 263066

URL: http://llvm.org/viewvc/llvm-project?rev=263066=rev
Log:
Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

Summary:
From Adrian McCarthy:

"Running ninja check-lldb now has one crash in a Python process, due to 
deferencing a null pointer in IRExecutionUnit.cpp:  candidate_sc.symbol is 
null, which leads to a call with a null this pointer."

Reviewers: zturner, spyffe, amccarth

Subscribers: ted, jingham, lldb-commits

Differential Revision: http://reviews.llvm.org/D17860

Modified:
lldb/trunk/source/Expression/IRExecutionUnit.cpp

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=263066=263065=263066=diff
==
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Wed Mar  9 16:05:17 2016
@@ -798,15 +798,25 @@ IRExecutionUnit::FindInSymbols(const std
 
 const bool is_external = (candidate_sc.function) ||
  (candidate_sc.symbol && 
candidate_sc.symbol->IsExternal());
+if (candidate_sc.symbol)
+{
+load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
 
-load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
+if (load_address == LLDB_INVALID_ADDRESS)
+{
+if (target->GetProcessSP())
+load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+else
+load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
+}
+}
 
-if (load_address == LLDB_INVALID_ADDRESS)
+if (load_address == LLDB_INVALID_ADDRESS && 
candidate_sc.function)
 {
-if (target->GetProcessSP())
-load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
-else
-load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
+if (target->GetProcessSP())
+load_address = 
candidate_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(target);
+else
+load_address = 
candidate_sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
 }
 
 if (load_address != LLDB_INVALID_ADDRESS)


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17860: Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

2016-03-09 Thread Ted Woodward via lldb-commits
ted updated this revision to Diff 50189.
ted added a comment.

Updated to address Jim's comments.


http://reviews.llvm.org/D17860

Files:
  source/Expression/IRExecutionUnit.cpp

Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -798,15 +798,25 @@
 
 const bool is_external = (candidate_sc.function) ||
  (candidate_sc.symbol && 
candidate_sc.symbol->IsExternal());
+if (candidate_sc.symbol)
+{
+load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
 
-load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
+if (load_address == LLDB_INVALID_ADDRESS)
+{
+if (target->GetProcessSP())
+load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+else
+load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
+}
+}
 
-if (load_address == LLDB_INVALID_ADDRESS)
+if (load_address == LLDB_INVALID_ADDRESS && 
candidate_sc.function)
 {
-if (target->GetProcessSP())
-load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
-else
-load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
+if (target->GetProcessSP())
+load_address = 
candidate_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(target);
+else
+load_address = 
candidate_sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
 }
 
 if (load_address != LLDB_INVALID_ADDRESS)


Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -798,15 +798,25 @@
 
 const bool is_external = (candidate_sc.function) ||
  (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
+if (candidate_sc.symbol)
+{
+load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
 
-load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
+if (load_address == LLDB_INVALID_ADDRESS)
+{
+if (target->GetProcessSP())
+load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+else
+load_address = candidate_sc.symbol->GetAddress().GetFileAddress();
+}
+}
 
-if (load_address == LLDB_INVALID_ADDRESS)
+if (load_address == LLDB_INVALID_ADDRESS && candidate_sc.function)
 {
-if (target->GetProcessSP())
-load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target);
-else
-load_address = candidate_sc.symbol->GetAddress().GetFileAddress();
+if (target->GetProcessSP())
+load_address = candidate_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(target);
+else
+load_address = candidate_sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
 }
 
 if (load_address != LLDB_INVALID_ADDRESS)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17860: Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

2016-03-09 Thread Ted Woodward via lldb-commits
So you'd like to see this function get the address of a function that it
finds in either symbols or debug info?

Which should it prioritize when we have both?

Ted
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project


-Original Message-
From: jing...@apple.com [mailto:jing...@apple.com] 
Sent: Tuesday, March 08, 2016 5:35 PM
To: reviews+d17860+public+90c8568c5fdb4...@reviews.llvm.org
Cc: ted.woodw...@codeaurora.org; ztur...@google.com; scalla...@apple.com;
amcca...@google.com; lldb-commits@lists.llvm.org
Subject: Re: [PATCH] D17860: Fix "ninja check-lldb" crash in
IRExecutionUnit.cpp


> On Mar 8, 2016, at 2:46 PM, Ted Woodward 
wrote:
> 
> ted added a comment.
> 
> The change is to guard against the case where candidate_sc.symbol is
nullptr.
> 
> candidate_sc.function is only used when load_address !=
LLDB_INVALID_ADDRESS, but load_address is set on line 802:
> 
>  load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
> 
> so candidate_sc.symbol must be valid.
> 
> The purpose of the function is to get the address of a symbol, so I don't
think we care about candidate_sc.function when candidate_sc.symbol is
nullptr.

It's name is "FindInSymbols" but I am pretty sure that's in
contradistinction to "FindInRuntimes" not "FindInDebugInformation".  The
searches that feed this function search both Symbols and Debug Information.
I agree with you that the original code worked incorrectly in the case where
you had a function from debug information and not from symbols, but your
change would need to be reverted to make this work properly (and states an
intent that I don't think is correct.)

Jim


> 
> 
> http://reviews.llvm.org/D17860
> 
> 
> 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17860: Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

2016-03-08 Thread Ted Woodward via lldb-commits
ted added a comment.

The change is to guard against the case where candidate_sc.symbol is nullptr.

candidate_sc.function is only used when load_address != LLDB_INVALID_ADDRESS, 
but load_address is set on line 802:

  load_address = candidate_sc.symbol->ResolveCallableAddress(*target);

so candidate_sc.symbol must be valid.

The purpose of the function is to get the address of a symbol, so I don't think 
we care about candidate_sc.function when candidate_sc.symbol is nullptr.


http://reviews.llvm.org/D17860



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17860: Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

2016-03-08 Thread Ted Woodward via lldb-commits
ted updated this revision to Diff 50074.
ted added a comment.

Updated to use early-out as requested


http://reviews.llvm.org/D17860

Files:
  source/Expression/IRExecutionUnit.cpp

Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -796,8 +796,8 @@
 
 sc_list.GetContextAtIndex(si, candidate_sc);
 
-const bool is_external = (candidate_sc.function) ||
- (candidate_sc.symbol && 
candidate_sc.symbol->IsExternal());
+if (!candidate_sc.symbol)
+continue;
 
 load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
 
@@ -811,7 +811,7 @@
 
 if (load_address != LLDB_INVALID_ADDRESS)
 {
-if (is_external)
+if (candidate_sc.function || 
candidate_sc.symbol->IsExternal())
 {
 return true;
 }


Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -796,8 +796,8 @@
 
 sc_list.GetContextAtIndex(si, candidate_sc);
 
-const bool is_external = (candidate_sc.function) ||
- (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
+if (!candidate_sc.symbol)
+continue;
 
 load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
 
@@ -811,7 +811,7 @@
 
 if (load_address != LLDB_INVALID_ADDRESS)
 {
-if (is_external)
+if (candidate_sc.function || candidate_sc.symbol->IsExternal())
 {
 return true;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D17860: Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

2016-03-03 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added reviewers: spyffe, zturner, amccarth.
ted added a subscriber: lldb-commits.

From Adrian McCarthy:

"Running ninja check-lldb now has one crash in a Python process, due to 
deferencing a null pointer in IRExecutionUnit.cpp:  candidate_sc.symbol is 
null, which leads to a call with a null this pointer."

http://reviews.llvm.org/D17860

Files:
  source/Expression/IRExecutionUnit.cpp

Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -796,27 +796,28 @@
 
 sc_list.GetContextAtIndex(si, candidate_sc);
 
-const bool is_external = (candidate_sc.function) ||
- (candidate_sc.symbol && 
candidate_sc.symbol->IsExternal());
+if (candidate_sc.symbol)
+{
 
-load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
+load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
 
-if (load_address == LLDB_INVALID_ADDRESS)
-if (target->GetProcessSP())
-load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
-else
-load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
+if (load_address == LLDB_INVALID_ADDRESS)
+if (target->GetProcessSP())
+load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+else
+load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
 
-if (load_address != LLDB_INVALID_ADDRESS)
-{
-if (is_external)
-{
-return true;
-}
-else if (best_internal_load_address == 
LLDB_INVALID_ADDRESS)
+if (load_address != LLDB_INVALID_ADDRESS)
 {
-best_internal_load_address = load_address;
-load_address = LLDB_INVALID_ADDRESS;
+if (candidate_sc.function || 
candidate_sc.symbol->IsExternal())
+{
+return true;
+}
+else if (best_internal_load_address == 
LLDB_INVALID_ADDRESS)
+{
+best_internal_load_address = load_address;
+load_address = LLDB_INVALID_ADDRESS;
+}
 }
 }
 }


Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -796,27 +796,28 @@
 
 sc_list.GetContextAtIndex(si, candidate_sc);
 
-const bool is_external = (candidate_sc.function) ||
- (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
+if (candidate_sc.symbol)
+{
 
-load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
+load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
 
-if (load_address == LLDB_INVALID_ADDRESS)
-if (target->GetProcessSP())
-load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target);
-else
-load_address = candidate_sc.symbol->GetAddress().GetFileAddress();
+if (load_address == LLDB_INVALID_ADDRESS)
+if (target->GetProcessSP())
+load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+else
+load_address = candidate_sc.symbol->GetAddress().GetFileAddress();
 
-if (load_address != LLDB_INVALID_ADDRESS)
-{
-if (is_external)
-{
-return true;
-}
-else if (best_internal_load_address == LLDB_INVALID_ADDRESS)
+if (load_address != LLDB_INVALID_ADDRESS)
 {
-best_internal_load_address = load_address;
-load_address = LLDB_INVALID_ADDRESS;
+if (candidate_sc.function || candidate_sc.symbol->IsExternal())
+{
+return true;
+}
+else if (best_internal_load_address == LLDB_INVALID_ADDRESS)
+{
+

[Lldb-commits] [lldb] r262407 - Fix bug with function resolution when using IR Interpreter

2016-03-01 Thread Ted Woodward via lldb-commits
Author: ted
Date: Tue Mar  1 15:53:26 2016
New Revision: 262407

URL: http://llvm.org/viewvc/llvm-project?rev=262407=rev
Log:
Fix bug with function resolution when using IR Interpreter

Summary: Recent changes to the expression parser broke function name resolution 
when using the IR interpreter instead of JIT. This patch changes the 
IRMemoryMap ivar in InterpreterStackFrame to an IRExecutionUnitSP (which is a 
subclass), allowing InterpreterStackFrame::ResolveConstantValue() to call 
FindSymbol() on the name of the Value when it's a FunctionVal. It also changes 
IRExecutionUnit::FindInSymbols() to call GetFileAddress() on the symball if 
ResolveCallableAddress() fails and there is no valid Process.

Reviewers: spyffe

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D17745

Modified:
lldb/trunk/include/lldb/Expression/IRInterpreter.h
lldb/trunk/source/Expression/IRExecutionUnit.cpp
lldb/trunk/source/Expression/IRInterpreter.cpp
lldb/trunk/source/Expression/LLVMUserExpression.cpp

Modified: lldb/trunk/include/lldb/Expression/IRInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRInterpreter.h?rev=262407=262406=262407=diff
==
--- lldb/trunk/include/lldb/Expression/IRInterpreter.h (original)
+++ lldb/trunk/include/lldb/Expression/IRInterpreter.h Tue Mar  1 15:53:26 2016
@@ -50,7 +50,7 @@ public:
 Interpret (llvm::Module ,
llvm::Function ,
llvm::ArrayRef args,
-   lldb_private::IRMemoryMap _map,
+   lldb_private::IRExecutionUnit _unit,
lldb_private::Error ,
lldb::addr_t stack_frame_bottom,
lldb::addr_t stack_frame_top,

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=262407=262406=262407=diff
==
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Tue Mar  1 15:53:26 2016
@@ -802,7 +802,10 @@ IRExecutionUnit::FindInSymbols(const std
 load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
 
 if (load_address == LLDB_INVALID_ADDRESS)
-load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+if (target->GetProcessSP())
+load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+else
+load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
 
 if (load_address != LLDB_INVALID_ADDRESS)
 {

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=262407=262406=262407=diff
==
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Mar  1 15:53:26 2016
@@ -7,6 +7,7 @@
 //
 
//===--===//
 
+#include "lldb/Core/ConstString.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
@@ -15,6 +16,7 @@
 #include "lldb/Core/Scalar.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Expression/IRInterpreter.h"
 #include "lldb/Host/Endian.h"
@@ -101,7 +103,7 @@ public:
 
 ValueMapm_values;
 DataLayout _target_data;
-lldb_private::IRMemoryMap  _memory_map;
+lldb_private::IRExecutionUnit  _execution_unit;
 const BasicBlock   *m_bb;
 BasicBlock::const_iterator  m_ii;
 BasicBlock::const_iterator  m_ie;
@@ -114,11 +116,11 @@ public:
 size_t  m_addr_byte_size;
 
 InterpreterStackFrame (DataLayout _data,
-   lldb_private::IRMemoryMap _map,
+   lldb_private::IRExecutionUnit _unit,
lldb::addr_t stack_frame_bottom,
lldb::addr_t stack_frame_top) :
 m_target_data (target_data),
-m_memory_map (memory_map)
+m_execution_unit (execution_unit)
 {
 m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle 
: lldb::eByteOrderBig);
 m_addr_byte_size = (target_data.getPointerSize(0));
@@ -203,7 +205,7 @@ public:
 lldb_private::DataExtractor value_extractor;
 lldb_private::Error 

Re: [Lldb-commits] [PATCH] D17745: Fix bug with function resolution when using IR Interpreter

2016-03-01 Thread Ted Woodward via lldb-commits
ted updated this revision to Diff 49542.
ted added a comment.

Updated to address Sean's comments


http://reviews.llvm.org/D17745

Files:
  include/lldb/Expression/IRInterpreter.h
  source/Expression/IRExecutionUnit.cpp
  source/Expression/IRInterpreter.cpp
  source/Expression/LLVMUserExpression.cpp

Index: source/Expression/LLVMUserExpression.cpp
===
--- source/Expression/LLVMUserExpression.cpp
+++ source/Expression/LLVMUserExpression.cpp
@@ -121,7 +121,7 @@
 function_stack_top = m_stack_frame_top;
 
 IRInterpreter::Interpret(*module, *function, args, *m_execution_unit_sp.get(), interpreter_error,
- function_stack_bottom, function_stack_top, exe_ctx);
+function_stack_bottom, function_stack_top, exe_ctx);
 
 if (m_materialized_address != LLDB_INVALID_ADDRESS)
 if (exe_ctx.GetProcessPtr())
Index: source/Expression/IRInterpreter.cpp
===
--- source/Expression/IRInterpreter.cpp
+++ source/Expression/IRInterpreter.cpp
@@ -7,14 +7,16 @@
 //
 //===--===//
 
+#include "lldb/Core/ConstString.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Scalar.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Expression/IRInterpreter.h"
 #include "lldb/Host/Endian.h"
@@ -101,7 +103,7 @@
 
 ValueMapm_values;
 DataLayout _target_data;
-lldb_private::IRMemoryMap  _memory_map;
+lldb_private::IRExecutionUnit  _execution_unit;
 const BasicBlock   *m_bb;
 BasicBlock::const_iterator  m_ii;
 BasicBlock::const_iterator  m_ie;
@@ -114,11 +116,11 @@
 size_t  m_addr_byte_size;
 
 InterpreterStackFrame (DataLayout _data,
-   lldb_private::IRMemoryMap _map,
+   lldb_private::IRExecutionUnit _unit,
lldb::addr_t stack_frame_bottom,
lldb::addr_t stack_frame_top) :
 m_target_data (target_data),
-m_memory_map (memory_map)
+m_execution_unit (execution_unit)
 {
 m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle : lldb::eByteOrderBig);
 m_addr_byte_size = (target_data.getPointerSize(0));
@@ -203,7 +205,7 @@
 lldb_private::DataExtractor value_extractor;
 lldb_private::Error extract_error;
 
-m_memory_map.GetMemoryData(value_extractor, process_address, value_size, extract_error);
+m_execution_unit.GetMemoryData(value_extractor, process_address, value_size, extract_error);
 
 if (!extract_error.Success())
 return false;
@@ -242,7 +244,7 @@
 
 lldb_private::Error write_error;
 
-m_memory_map.WriteMemory(process_address, buf.GetBytes(), buf.GetByteSize(), write_error);
+m_execution_unit.WriteMemory(process_address, buf.GetBytes(), buf.GetByteSize(), write_error);
 
 return write_error.Success();
 }
@@ -253,6 +255,17 @@
 {
 default:
 break;
+case Value::FunctionVal:
+if (const Function *constant_func = dyn_cast(constant))
+{
+lldb_private::ConstString name(constant_func->getName());
+lldb::addr_t addr = m_execution_unit.FindSymbol(name);
+if (addr == LLDB_INVALID_ADDRESS)
+return false;
+value = APInt(m_target_data.getPointerSizeInBits(), addr);
+return true;
+}
+break;
 case Value::ConstantIntVal:
 if (const ConstantInt *constant_int = dyn_cast(constant))
 {
@@ -329,12 +342,12 @@
 
 lldb_private::Error write_error;
 
-m_memory_map.WritePointerToMemory(data_address, address, write_error);
+m_execution_unit.WritePointerToMemory(data_address, address, write_error);
 
 if (!write_error.Success())
 {
 lldb_private::Error free_error;
-m_memory_map.Free(data_address, free_error);
+m_execution_unit.Free(data_address, free_error);
 return false;
 }
 
@@ -360,8 +373,8 @@
 return false;
 
 lldb_private::StreamString buffer (lldb_private::Stream::eBinary,
-   m_memory_map.GetAddressByteSize(),
-   m_memory_map.GetByteOrder());
+

[Lldb-commits] [PATCH] D17745: Fix bug with function resolution when using IR Interpreter

2016-02-29 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added a reviewer: spyffe.
ted added a subscriber: lldb-commits.

Recent changes to the expression parser broke function name resolution when 
using the IR interpreter instead of JIT. This patch changes the IRMemoryMap 
ivar in InterpreterStackFrame to an IRExecutionUnitSP (which is a subclass), 
allowing InterpreterStackFrame::ResolveConstantValue() to call FindSymbol() on 
the name of the Value when it's a FunctionVal. It also changes 
IRExecutionUnit::FindInSymbols() to call GetFileAddress() on the symball if 
ResolveCallableAddress() fails and there is no valid Process.

http://reviews.llvm.org/D17745

Files:
  include/lldb/Expression/IRInterpreter.h
  source/Expression/IRExecutionUnit.cpp
  source/Expression/IRInterpreter.cpp
  source/Expression/LLVMUserExpression.cpp

Index: source/Expression/LLVMUserExpression.cpp
===
--- source/Expression/LLVMUserExpression.cpp
+++ source/Expression/LLVMUserExpression.cpp
@@ -120,8 +120,8 @@
 function_stack_bottom = m_stack_frame_bottom;
 function_stack_top = m_stack_frame_top;
 
-IRInterpreter::Interpret(*module, *function, args, *m_execution_unit_sp.get(), interpreter_error,
- function_stack_bottom, function_stack_top, exe_ctx);
+IRInterpreter::Interpret(*module, *function, args, m_execution_unit_sp, interpreter_error,
+function_stack_bottom, function_stack_top, exe_ctx);
 
 if (m_materialized_address != LLDB_INVALID_ADDRESS)
 if (exe_ctx.GetProcessPtr())
Index: source/Expression/IRInterpreter.cpp
===
--- source/Expression/IRInterpreter.cpp
+++ source/Expression/IRInterpreter.cpp
@@ -7,14 +7,16 @@
 //
 //===--===//
 
+#include "lldb/Core/ConstString.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Scalar.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Expression/IRMemoryMap.h"
 #include "lldb/Expression/IRInterpreter.h"
 #include "lldb/Host/Endian.h"
@@ -101,7 +103,7 @@
 
 ValueMapm_values;
 DataLayout _target_data;
-lldb_private::IRMemoryMap  _memory_map;
+lldb::IRExecutionUnitSP m_execution_unit_sp;
 const BasicBlock   *m_bb;
 BasicBlock::const_iterator  m_ii;
 BasicBlock::const_iterator  m_ie;
@@ -114,11 +116,11 @@
 size_t  m_addr_byte_size;
 
 InterpreterStackFrame (DataLayout _data,
-   lldb_private::IRMemoryMap _map,
+   lldb::IRExecutionUnitSP execution_unit_sp,
lldb::addr_t stack_frame_bottom,
lldb::addr_t stack_frame_top) :
 m_target_data (target_data),
-m_memory_map (memory_map)
+m_execution_unit_sp (execution_unit_sp)
 {
 m_byte_order = (target_data.isLittleEndian() ? lldb::eByteOrderLittle : lldb::eByteOrderBig);
 m_addr_byte_size = (target_data.getPointerSize(0));
@@ -203,7 +205,7 @@
 lldb_private::DataExtractor value_extractor;
 lldb_private::Error extract_error;
 
-m_memory_map.GetMemoryData(value_extractor, process_address, value_size, extract_error);
+m_execution_unit_sp.get()->GetMemoryData(value_extractor, process_address, value_size, extract_error);
 
 if (!extract_error.Success())
 return false;
@@ -242,7 +244,7 @@
 
 lldb_private::Error write_error;
 
-m_memory_map.WriteMemory(process_address, buf.GetBytes(), buf.GetByteSize(), write_error);
+m_execution_unit_sp.get()->WriteMemory(process_address, buf.GetBytes(), buf.GetByteSize(), write_error);
 
 return write_error.Success();
 }
@@ -253,6 +255,17 @@
 {
 default:
 break;
+case Value::FunctionVal:
+if (const Function *constant_func = dyn_cast(constant))
+{
+lldb_private::ConstString name(constant_func->getName());
+lldb::addr_t addr = m_execution_unit_sp->FindSymbol(name);
+if (addr == LLDB_INVALID_ADDRESS)
+return false;
+value = APInt(m_target_data.getPointerSizeInBits(), addr);
+return true;
+}
+break;
 case Value::ConstantIntVal:
 if (const ConstantInt *constant_int = dyn_cast(constant))
 {
@@ -329,12 +342,12 @@
 
 lldb_private::Error 

[Lldb-commits] [lldb] r255374 - Remove hardcoded registers from Hexagon ABI

2015-12-11 Thread Ted Woodward via lldb-commits
Author: ted
Date: Fri Dec 11 15:52:47 2015
New Revision: 255374

URL: http://llvm.org/viewvc/llvm-project?rev=255374=rev
Log:
Remove hardcoded registers from Hexagon ABI

Summary: The Hexagon ABI plugin uses hardcoded registers when setting up 
function calls. This is OK for the Hexagon simulator, but the register numbers 
are different on the gdbserver running on hardware. Change the hardcoded 
registers to LLDB generic registers.

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D15457

Modified:
lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp

Modified: lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp?rev=255374=255373=255374=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp Fri Dec 11 
15:52:47 2015
@@ -226,7 +226,7 @@ ABISysV_hexagon::PrepareTrivialCall ( Th
 //  . handle 64bit values and their register / stack requirements
 
 */
-#define HEX_ABI_DEBUG 1
+#define HEX_ABI_DEBUG 0
 bool
 ABISysV_hexagon::PrepareTrivialCall ( Thread , 
   lldb::addr_t  sp  , 
@@ -242,6 +242,23 @@ ABISysV_hexagon::PrepareTrivialCall ( Th
 // grab the process so we have access to the memory for spilling
 lldb::ProcessSP proc = thread.GetProcess( );
 
+// get the register context for modifying all of the registers
+RegisterContext *reg_ctx = thread.GetRegisterContext().get();
+if (!reg_ctx)
+return false;
+
+uint32_t pc_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_PC);
+if (pc_reg == LLDB_INVALID_REGNUM)
+return false;
+
+uint32_t ra_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_RA);
+if (ra_reg == LLDB_INVALID_REGNUM)
+return false;
+
+uint32_t sp_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_SP);
+if (sp_reg == LLDB_INVALID_REGNUM)
+return false;
+
 // push host data onto target
 for ( size_t i = 0; i < args.size( ); i++ )
 {
@@ -276,11 +293,6 @@ ABISysV_hexagon::PrepareTrivialCall ( Th
 // check if this is a variable argument function
 bool isVArg = prototype.isFunctionVarArg();
 
-// get the register context for modifying all of the registers
-RegisterContext *reg_ctx = thread.GetRegisterContext().get();
-if (!reg_ctx)
-return false;
-
 // number of arguments passed by register
 int nRegArgs = nVArgRegParams;
 if (! isVArg )
@@ -323,10 +335,9 @@ ABISysV_hexagon::PrepareTrivialCall ( Th
 }
 
 // update registers with current function call state
-reg_ctx->WriteRegisterFromUnsigned ( 41, pc );
-reg_ctx->WriteRegisterFromUnsigned ( 31, ra );
-reg_ctx->WriteRegisterFromUnsigned ( 29, sp );
-//  reg_ctx->WriteRegisterFromUnsigned ( FP ??? );
+reg_ctx->WriteRegisterFromUnsigned(pc_reg, pc);
+reg_ctx->WriteRegisterFromUnsigned(ra_reg, ra);
+reg_ctx->WriteRegisterFromUnsigned(sp_reg, sp);
 
 #if HEX_ABI_DEBUG
 // quick and dirty stack dumper for debugging


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r255340 - Change finishSwigPythonLLDB.py to copy six.py instead of simlink it

2015-12-11 Thread Ted Woodward via lldb-commits
Author: ted
Date: Fri Dec 11 09:43:36 2015
New Revision: 255340

URL: http://llvm.org/viewvc/llvm-project?rev=255340=rev
Log:
Change finishSwigPythonLLDB.py to copy six.py instead of simlink it

Summary: If six.py is simlink'd, an installation won't be able to find it 
unless it has access to the source tree that lldb was built from.

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D15422

Modified:
lldb/trunk/scripts/Python/finishSwigPythonLLDB.py

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=255340=255339=255340=diff
==
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Fri Dec 11 09:43:36 2015
@@ -70,6 +70,8 @@ strErrMsgCreatePyPkgMissingSlash = "Para
 strErrMsgMkLinkExecute = "Command mklink failed: %s"
 strErrMsgMakeSymlink = "creating symbolic link"
 strErrMsgUnexpected = "Unexpected error: %s"
+strMsgCopySixPy = "Copying six.py from '%s' to '%s'"
+strErrMsgCopySixPyFailed = "Unable to copy '%s' to '%s'"
 
 def is_debug_interpreter():
 return hasattr(sys, 'gettotalrefcount')
@@ -336,14 +338,6 @@ def make_symlink(vDictArgs, vstrFramewor
 
 return make_symlink_native(vDictArgs, strSrc, strTarget)
 
-def make_symlink_six(vDictArgs, vstrFrameworkPythonDir):
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_six()")
-site_packages_dir = os.path.dirname(vstrFrameworkPythonDir)
-six_module_filename = "six.py"
-src_file = os.path.join(vDictArgs['--srcRoot'], "third_party", "Python", 
"module", "six", six_module_filename)
-src_file = os.path.normpath(src_file)
-target = os.path.join(site_packages_dir, six_module_filename)
-return make_symlink_native(vDictArgs, src_file, target)
 
 #++---
 # Details:  Make the symbolic that the script bridge for Python will need in
@@ -472,9 +466,6 @@ def create_symlinks(vDictArgs, vstrFrame
   vstrFrameworkPythonDir,
   strLibLldbFileName)
 
-if bOk:
-bOk, strErrMsg = make_symlink_six(vDictArgs, vstrFrameworkPythonDir)
-
 # Make symlink for darwin-debug on Darwin
 strDarwinDebugFileName = "darwin-debug"
 if bOk and eOSType == utilsOsType.EnumOsType.Darwin:
@@ -491,6 +482,27 @@ def create_symlinks(vDictArgs, vstrFrame
 
 return (bOk, strErrMsg)
 
+def copy_six(vDictArgs, vstrFrameworkPythonDir):
+dbg = utilsDebug.CDebugFnVerbose("Python script copy_six()")
+bDbg = "-d" in vDictArgs
+bOk = True
+strMsg = ""
+site_packages_dir = os.path.dirname(vstrFrameworkPythonDir)
+six_module_filename = "six.py"
+src_file = os.path.join(vDictArgs['--srcRoot'], "third_party", "Python", 
"module", "six", six_module_filename)
+src_file = os.path.normpath(src_file)
+target = os.path.join(site_packages_dir, six_module_filename)
+
+if bDbg:
+print((strMsgCopySixPy % (src_file, target)))
+try:
+shutil.copyfile(src_file, target)
+except:
+bOk = False
+strMsg = strErrMsgCopySixPyFailed % (src_file, target)
+
+return (bOk, strMsg)
+
 #++---
 # Details:  Look for the directory in which to put the Python files if it
 #   does not already exist, attempt to make it.
@@ -708,6 +720,9 @@ def main(vDictArgs):
 bOk, strMsg = create_symlinks(vDictArgs, strFrameworkPythonDir)
 
 if bOk:
+bOk, strMsg = copy_six(vDictArgs, strFrameworkPythonDir)
+
+if bOk:
 bOk, strMsg = copy_lldbpy_file_to_lldb_pkg_dir(vDictArgs,
strFrameworkPythonDir,
strCfgBldDir)


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15457: Remove hardcoded registers from Hexagon ABI

2015-12-11 Thread Ted Woodward via lldb-commits
ted updated this revision to Diff 42555.
ted added a comment.

Updated to check for invalid register numbers.


http://reviews.llvm.org/D15457

Files:
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp

Index: source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
===
--- source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
+++ source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
@@ -226,7 +226,7 @@
 //  . handle 64bit values and their register / stack requirements
 
 */
-#define HEX_ABI_DEBUG 1
+#define HEX_ABI_DEBUG 0
 bool
 ABISysV_hexagon::PrepareTrivialCall ( Thread , 
   lldb::addr_t  sp  , 
@@ -242,6 +242,23 @@
 // grab the process so we have access to the memory for spilling
 lldb::ProcessSP proc = thread.GetProcess( );
 
+// get the register context for modifying all of the registers
+RegisterContext *reg_ctx = thread.GetRegisterContext().get();
+if (!reg_ctx)
+return false;
+
+uint32_t pc_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_PC);
+if (pc_reg == LLDB_INVALID_REGNUM)
+return false;
+
+uint32_t ra_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_RA);
+if (ra_reg == LLDB_INVALID_REGNUM)
+return false;
+
+uint32_t sp_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_SP);
+if (sp_reg == LLDB_INVALID_REGNUM)
+return false;
+
 // push host data onto target
 for ( size_t i = 0; i < args.size( ); i++ )
 {
@@ -276,11 +293,6 @@
 // check if this is a variable argument function
 bool isVArg = prototype.isFunctionVarArg();
 
-// get the register context for modifying all of the registers
-RegisterContext *reg_ctx = thread.GetRegisterContext().get();
-if (!reg_ctx)
-return false;
-
 // number of arguments passed by register
 int nRegArgs = nVArgRegParams;
 if (! isVArg )
@@ -323,10 +335,9 @@
 }
 
 // update registers with current function call state
-reg_ctx->WriteRegisterFromUnsigned ( 41, pc );
-reg_ctx->WriteRegisterFromUnsigned ( 31, ra );
-reg_ctx->WriteRegisterFromUnsigned ( 29, sp );
-//  reg_ctx->WriteRegisterFromUnsigned ( FP ??? );
+reg_ctx->WriteRegisterFromUnsigned(pc_reg, pc);
+reg_ctx->WriteRegisterFromUnsigned(ra_reg, ra);
+reg_ctx->WriteRegisterFromUnsigned(sp_reg, sp);
 
 #if HEX_ABI_DEBUG
 // quick and dirty stack dumper for debugging


Index: source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
===
--- source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
+++ source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
@@ -226,7 +226,7 @@
 //  . handle 64bit values and their register / stack requirements
 
 */
-#define HEX_ABI_DEBUG 1
+#define HEX_ABI_DEBUG 0
 bool
 ABISysV_hexagon::PrepareTrivialCall ( Thread , 
   lldb::addr_t  sp  , 
@@ -242,6 +242,23 @@
 // grab the process so we have access to the memory for spilling
 lldb::ProcessSP proc = thread.GetProcess( );
 
+// get the register context for modifying all of the registers
+RegisterContext *reg_ctx = thread.GetRegisterContext().get();
+if (!reg_ctx)
+return false;
+
+uint32_t pc_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
+if (pc_reg == LLDB_INVALID_REGNUM)
+return false;
+
+uint32_t ra_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
+if (ra_reg == LLDB_INVALID_REGNUM)
+return false;
+
+uint32_t sp_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
+if (sp_reg == LLDB_INVALID_REGNUM)
+return false;
+
 // push host data onto target
 for ( size_t i = 0; i < args.size( ); i++ )
 {
@@ -276,11 +293,6 @@
 // check if this is a variable argument function
 bool isVArg = prototype.isFunctionVarArg();
 
-// get the register context for modifying all of the registers
-RegisterContext *reg_ctx = thread.GetRegisterContext().get();
-if (!reg_ctx)
-return false;
-
 // number of arguments passed by register
 int nRegArgs = nVArgRegParams;
 if (! isVArg )
@@ -323,10 +335,9 @@
 }
 
 // update registers with current function call state
-reg_ctx->WriteRegisterFromUnsigned ( 41, pc );
-reg_ctx->WriteRegisterFromUnsigned ( 31, ra );
-reg_ctx->WriteRegisterFromUnsigned ( 29, sp );
-//  reg_ctx->WriteRegisterFromUnsigned ( FP ??? );
+reg_ctx->WriteRegisterFromUnsigned(pc_reg, pc);
+reg_ctx->WriteRegisterFromUnsigned(ra_reg, ra);
+reg_ctx->WriteRegisterFromUnsigned(sp_reg, sp);
 
 #if HEX_ABI_DEBUG
 // quick and dirty stack dumper for 

[Lldb-commits] [PATCH] D15457: Remove hardcoded registers from Hexagon ABI

2015-12-11 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added a reviewer: clayborg.
ted added a subscriber: lldb-commits.

The Hexagon ABI plugin uses hardcoded registers when setting up function calls. 
This is OK for the Hexagon simulator, but the register numbers are different on 
the gdbserver running on hardware. Change the hardcoded registers to LLDB 
generic registers.

http://reviews.llvm.org/D15457

Files:
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp

Index: source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
===
--- source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
+++ source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
@@ -226,7 +226,7 @@
 //  . handle 64bit values and their register / stack requirements
 
 */
-#define HEX_ABI_DEBUG 1
+#define HEX_ABI_DEBUG 0
 bool
 ABISysV_hexagon::PrepareTrivialCall ( Thread , 
   lldb::addr_t  sp  , 
@@ -323,10 +323,12 @@
 }
 
 // update registers with current function call state
-reg_ctx->WriteRegisterFromUnsigned ( 41, pc );
-reg_ctx->WriteRegisterFromUnsigned ( 31, ra );
-reg_ctx->WriteRegisterFromUnsigned ( 29, sp );
-//  reg_ctx->WriteRegisterFromUnsigned ( FP ??? );
+uint32_t pc_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_PC);
+reg_ctx->WriteRegisterFromUnsigned(pc_reg, pc);
+uint32_t ra_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_RA);
+reg_ctx->WriteRegisterFromUnsigned(ra_reg, ra);
+uint32_t sp_reg = 
reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_SP);
+reg_ctx->WriteRegisterFromUnsigned(sp_reg, sp);
 
 #if HEX_ABI_DEBUG
 // quick and dirty stack dumper for debugging


Index: source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
===
--- source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
+++ source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
@@ -226,7 +226,7 @@
 //  . handle 64bit values and their register / stack requirements
 
 */
-#define HEX_ABI_DEBUG 1
+#define HEX_ABI_DEBUG 0
 bool
 ABISysV_hexagon::PrepareTrivialCall ( Thread , 
   lldb::addr_t  sp  , 
@@ -323,10 +323,12 @@
 }
 
 // update registers with current function call state
-reg_ctx->WriteRegisterFromUnsigned ( 41, pc );
-reg_ctx->WriteRegisterFromUnsigned ( 31, ra );
-reg_ctx->WriteRegisterFromUnsigned ( 29, sp );
-//  reg_ctx->WriteRegisterFromUnsigned ( FP ??? );
+uint32_t pc_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
+reg_ctx->WriteRegisterFromUnsigned(pc_reg, pc);
+uint32_t ra_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
+reg_ctx->WriteRegisterFromUnsigned(ra_reg, ra);
+uint32_t sp_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
+reg_ctx->WriteRegisterFromUnsigned(sp_reg, sp);
 
 #if HEX_ABI_DEBUG
 // quick and dirty stack dumper for debugging
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r255268 - Add Hexagon ABI to System Initialization

2015-12-10 Thread Ted Woodward via lldb-commits
Author: ted
Date: Thu Dec 10 11:53:07 2015
New Revision: 255268

URL: http://llvm.org/viewvc/llvm-project?rev=255268=rev
Log:
Add Hexagon ABI to System Initialization

Summary: When the Hexagon ABI was added, it was inadvertently left out of 
initialization/termination. This patch adds it.

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D15347

Modified:
lldb/trunk/source/API/SystemInitializerFull.cpp

Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=255268=255267=255268=diff
==
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Thu Dec 10 11:53:07 2015
@@ -32,6 +32,7 @@
 #include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
 #include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
 #include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
+#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
 #include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
 #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
 #include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
@@ -277,6 +278,7 @@ SystemInitializerFull::Initialize()
 ABIMacOSX_arm64::Initialize();
 ABISysV_arm::Initialize();
 ABISysV_arm64::Initialize();
+ABISysV_hexagon::Initialize();
 ABISysV_i386::Initialize();
 ABISysV_x86_64::Initialize();
 ABISysV_ppc::Initialize();
@@ -395,6 +397,7 @@ SystemInitializerFull::Terminate()
 ABIMacOSX_arm64::Terminate();
 ABISysV_arm::Terminate();
 ABISysV_arm64::Terminate();
+ABISysV_hexagon::Terminate();
 ABISysV_i386::Terminate();
 ABISysV_x86_64::Terminate();
 ABISysV_ppc::Terminate();


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15422: Change finishSwigPythonLLDB.py to copy six.py instead of simlink it

2015-12-10 Thread Ted Woodward via lldb-commits
ted added a comment.

Oops! :-)

-

Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux 
Foundation Collaborative Project


http://reviews.llvm.org/D15422



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D15347: Add Hexagon ABI to System Initialization

2015-12-08 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added a reviewer: clayborg.
ted added a subscriber: lldb-commits.

When the Hexagon ABI was added, it was inadvertently left out of 
initialization/termination. This patch adds it.

http://reviews.llvm.org/D15347

Files:
  source/API/SystemInitializerFull.cpp

Index: source/API/SystemInitializerFull.cpp
===
--- source/API/SystemInitializerFull.cpp
+++ source/API/SystemInitializerFull.cpp
@@ -32,6 +32,7 @@
 #include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
 #include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
 #include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
+#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
 #include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
 #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
 #include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
@@ -277,6 +278,7 @@
 ABIMacOSX_arm64::Initialize();
 ABISysV_arm::Initialize();
 ABISysV_arm64::Initialize();
+ABISysV_hexagon::Initialize();
 ABISysV_i386::Initialize();
 ABISysV_x86_64::Initialize();
 ABISysV_ppc::Initialize();
@@ -395,6 +397,7 @@
 ABIMacOSX_arm64::Terminate();
 ABISysV_arm::Terminate();
 ABISysV_arm64::Terminate();
+ABISysV_hexagon::Terminate();
 ABISysV_i386::Terminate();
 ABISysV_x86_64::Terminate();
 ABISysV_ppc::Terminate();


Index: source/API/SystemInitializerFull.cpp
===
--- source/API/SystemInitializerFull.cpp
+++ source/API/SystemInitializerFull.cpp
@@ -32,6 +32,7 @@
 #include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
 #include "Plugins/ABI/SysV-arm/ABISysV_arm.h"
 #include "Plugins/ABI/SysV-arm64/ABISysV_arm64.h"
+#include "Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h"
 #include "Plugins/ABI/SysV-i386/ABISysV_i386.h"
 #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
 #include "Plugins/ABI/SysV-ppc/ABISysV_ppc.h"
@@ -277,6 +278,7 @@
 ABIMacOSX_arm64::Initialize();
 ABISysV_arm::Initialize();
 ABISysV_arm64::Initialize();
+ABISysV_hexagon::Initialize();
 ABISysV_i386::Initialize();
 ABISysV_x86_64::Initialize();
 ABISysV_ppc::Initialize();
@@ -395,6 +397,7 @@
 ABIMacOSX_arm64::Terminate();
 ABISysV_arm::Terminate();
 ABISysV_arm64::Terminate();
+ABISysV_hexagon::Terminate();
 ABISysV_i386::Terminate();
 ABISysV_x86_64::Terminate();
 ABISysV_ppc::Terminate();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D10247: Fix crash when cu_comp_dir parameter to DWARFDebugLine::ParseSupportFiles() is an empty string

2015-11-23 Thread Ted Woodward via lldb-commits
ted abandoned this revision.
ted added a comment.

Handled by another patch


http://reviews.llvm.org/D10247



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D14932: Fix watchpoint check to use watchpoint ranges

2015-11-23 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added a reviewer: clayborg.
ted added a subscriber: lldb-commits.

Watchpoints, unlike breakpoints, have an address range. This patch changes 
WatchpointList::FindByAddress() to match on any address in the watchpoint 
range, instead of only matching on the watchpoint's base address.

http://reviews.llvm.org/D14932

Files:
  source/Breakpoint/WatchpointList.cpp

Index: source/Breakpoint/WatchpointList.cpp
===
--- source/Breakpoint/WatchpointList.cpp
+++ source/Breakpoint/WatchpointList.cpp
@@ -75,10 +75,15 @@
 {
 wp_collection::const_iterator pos, end = m_watchpoints.end();
 for (pos = m_watchpoints.begin(); pos != end; ++pos)
-if ((*pos)->GetLoadAddress() == addr) {
+{
+lldb::addr_t wp_addr = (*pos)->GetLoadAddress();
+uint32_t wp_bytesize = (*pos)->GetByteSize();
+if ((wp_addr <= addr) && ((wp_addr + wp_bytesize) > addr))
+{
 wp_sp = *pos;
 break;
 }
+}
 }
 
 return wp_sp;


Index: source/Breakpoint/WatchpointList.cpp
===
--- source/Breakpoint/WatchpointList.cpp
+++ source/Breakpoint/WatchpointList.cpp
@@ -75,10 +75,15 @@
 {
 wp_collection::const_iterator pos, end = m_watchpoints.end();
 for (pos = m_watchpoints.begin(); pos != end; ++pos)
-if ((*pos)->GetLoadAddress() == addr) {
+{
+lldb::addr_t wp_addr = (*pos)->GetLoadAddress();
+uint32_t wp_bytesize = (*pos)->GetByteSize();
+if ((wp_addr <= addr) && ((wp_addr + wp_bytesize) > addr))
+{
 wp_sp = *pos;
 break;
 }
+}
 }
 
 return wp_sp;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits