Re: [Lldb-commits] [PATCH] D12187: [NativeProcessLinux] Reduce the number of casts

2015-08-21 Thread Pavel Labath via lldb-commits
labath marked an inline comment as done.
labath added a comment.

Passing around pointers (shared or otherwise) encourages people to litter the 
code with null pointer checks. For the next cleanup, I would like to move these 
checks to a single place and then convert more of these functions to take 
references.


http://reviews.llvm.org/D12187



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


[Lldb-commits] [lldb] r245681 - [NativeProcessLinux] Reduce the number of casts

2015-08-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Aug 21 04:13:53 2015
New Revision: 245681

URL: http://llvm.org/viewvc/llvm-project?rev=245681&view=rev
Log:
[NativeProcessLinux] Reduce the number of casts

Summary:
NPL used to be peppered with casts of the NativeThreadProtocol objects into 
NativeThreadLinux. I
move these closer to the source where we obtain these objects. This way, the 
rest of the code can
assume we are working with the correct type of objects.

Reviewers: ovyalov, tberghammer

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=245681&r1=245680&r2=245681&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Fri Aug 21 
04:13:53 2015
@@ -532,9 +532,6 @@ NativeProcessLinux::Launch(LaunchArgs *a
 const size_t err_len = 1024;
 char err_str[err_len];
 lldb::pid_t pid;
-NativeThreadProtocolSP thread_sp;
-
-lldb::ThreadSP inferior;
 
 // Propagate the environment if one is not supplied.
 if (envp == NULL || envp[0] == NULL)
@@ -763,10 +760,10 @@ NativeProcessLinux::Launch(LaunchArgs *a
 if (log)
 log->Printf ("NativeProcessLinux::%s() adding pid = %" PRIu64, 
__FUNCTION__, pid);
 
-thread_sp = AddThread (pid);
+NativeThreadLinuxSP thread_sp = AddThread(pid);
 assert (thread_sp && "AddThread() returned a nullptr thread");
-std::static_pointer_cast 
(thread_sp)->SetStoppedBySignal (SIGSTOP);
-ThreadWasCreated(pid);
+thread_sp->SetStoppedBySignal(SIGSTOP);
+ThreadWasCreated(*thread_sp);
 
 // Let our process instance know the thread has stopped.
 SetCurrentThreadID (thread_sp->GetID ());
@@ -791,7 +788,6 @@ NativeProcessLinux::Launch(LaunchArgs *a
 ::pid_t
 NativeProcessLinux::Attach(lldb::pid_t pid, Error &error)
 {
-lldb::ThreadSP inferior;
 Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
 // Use a map to keep track of the threads which we have attached/need to 
attach.
@@ -857,12 +853,12 @@ NativeProcessLinux::Attach(lldb::pid_t p
 it->second = true;
 
 // Create the thread, mark it as stopped.
-NativeThreadProtocolSP thread_sp (AddThread 
(static_cast (tid)));
+NativeThreadLinuxSP thread_sp 
(AddThread(static_cast(tid)));
 assert (thread_sp && "AddThread() returned a nullptr");
 
 // This will notify this is a new thread and tell the system 
it is stopped.
-std::static_pointer_cast 
(thread_sp)->SetStoppedBySignal (SIGSTOP);
-ThreadWasCreated(tid);
+thread_sp->SetStoppedBySignal(SIGSTOP);
+ThreadWasCreated(*thread_sp);
 SetCurrentThreadID (thread_sp->GetID ());
 }
 
@@ -1056,7 +1052,7 @@ NativeProcessLinux::WaitForNewThread(::p
 {
 Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
-NativeThreadLinuxSP new_thread_sp = 
std::static_pointer_cast(GetThreadByID(tid));
+NativeThreadLinuxSP new_thread_sp = GetThreadByID(tid);
 
 if (new_thread_sp)
 {
@@ -1114,9 +1110,9 @@ NativeProcessLinux::WaitForNewThread(::p
 log->Printf ("NativeProcessLinux::%s() pid = %" PRIu64 ": tracking new 
thread tid %" PRIu32,
  __FUNCTION__, GetID (), tid);
 
-new_thread_sp = 
std::static_pointer_cast(AddThread(tid));
+new_thread_sp = AddThread(tid);
 ResumeThread(new_thread_sp, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
-ThreadWasCreated(tid);
+ThreadWasCreated(*new_thread_sp);
 }
 
 void
@@ -1132,7 +1128,7 @@ NativeProcessLinux::MonitorSIGTRAP(const
 Mutex::Locker locker (m_threads_mutex);
 
 // See if we can find a thread for this signal.
-NativeThreadLinuxSP thread_sp = 
std::static_pointer_cast(GetThreadByID(pid));
+NativeThreadLinuxSP thread_sp = GetThreadByID(pid);
 if (!thread_sp)
 {
 if (log)
@@ -1167,7 +1163,7 @@ NativeProcessLinux::MonitorSIGTRAP(const
 
 case (SIGTRAP | (PTRACE_EVENT_EXEC << 8)):
 {
-NativeThreadProtocolSP main_thread_sp;
+NativeThreadLinuxSP main_thread_sp;
 if (log)
 log->Printf ("NativeProcessLinux::%s() received exec event, code = 
%d", __FUNCTION__, info->si_code ^ SIGTRAP);
 
@@ -1183,13 +1179,12 @@ NativeProcessLinux::MonitorSIGTRAP(const
 const bool is_main_thread = thread_sp && thread_sp->GetID () == 
GetID ();
 if (is_main_thread)
 {
-main_thread_sp = thread_sp;
+main_thread_sp = 

Re: [Lldb-commits] [PATCH] D12187: [NativeProcessLinux] Reduce the number of casts

2015-08-21 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245681: [NativeProcessLinux] Reduce the number of casts 
(authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D12187?vs=32673&id=32805#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12187

Files:
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h

Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
===
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -113,6 +113,9 @@
 Error
 GetFileLoadAddress(const llvm::StringRef& file_name, lldb::addr_t& load_addr) override;
 
+NativeThreadLinuxSP
+GetThreadByID(lldb::tid_t id);
+
 // -
 // Interface used by NativeRegisterContext-derived classes.
 // -
@@ -225,13 +228,13 @@
 MonitorSIGTRAP(const siginfo_t *info, lldb::pid_t pid);
 
 void
-MonitorTrace(lldb::pid_t pid, NativeThreadProtocolSP thread_sp);
+MonitorTrace(lldb::pid_t pid, const NativeThreadLinuxSP &thread_sp);
 
 void
-MonitorBreakpoint(lldb::pid_t pid, NativeThreadProtocolSP thread_sp);
+MonitorBreakpoint(lldb::pid_t pid, const NativeThreadLinuxSP &thread_sp);
 
 void
-MonitorWatchpoint(lldb::pid_t pid, NativeThreadProtocolSP thread_sp, uint32_t wp_index);
+MonitorWatchpoint(NativeThreadLinux &thread, uint32_t wp_index);
 
 void
 MonitorSignal(const siginfo_t *info, lldb::pid_t pid, bool exited);
@@ -265,14 +268,14 @@
 bool
 StopTrackingThread (lldb::tid_t thread_id);
 
-NativeThreadProtocolSP
+NativeThreadLinuxSP
 AddThread (lldb::tid_t thread_id);
 
 Error
 GetSoftwareBreakpointPCOffset (NativeRegisterContextSP context_sp, uint32_t &actual_opcode_size);
 
 Error
-FixupBreakpointPCAsNeeded (NativeThreadProtocolSP &thread_sp);
+FixupBreakpointPCAsNeeded(const NativeThreadLinuxSP &thread_sp);
 
 /// Writes a siginfo_t structure corresponding to the given thread ID to the
 /// memory region pointed to by @p siginfo.
@@ -317,7 +320,7 @@
 ResumeThread(const NativeThreadLinuxSP &thread_sp, lldb::StateType state, int signo);
 
 void
-ThreadWasCreated (lldb::tid_t tid);
+ThreadWasCreated(NativeThreadLinux &thread);
 
 void
 SigchldHandler();
Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -532,9 +532,6 @@
 const size_t err_len = 1024;
 char err_str[err_len];
 lldb::pid_t pid;
-NativeThreadProtocolSP thread_sp;
-
-lldb::ThreadSP inferior;
 
 // Propagate the environment if one is not supplied.
 if (envp == NULL || envp[0] == NULL)
@@ -763,10 +760,10 @@
 if (log)
 log->Printf ("NativeProcessLinux::%s() adding pid = %" PRIu64, __FUNCTION__, pid);
 
-thread_sp = AddThread (pid);
+NativeThreadLinuxSP thread_sp = AddThread(pid);
 assert (thread_sp && "AddThread() returned a nullptr thread");
-std::static_pointer_cast (thread_sp)->SetStoppedBySignal (SIGSTOP);
-ThreadWasCreated(pid);
+thread_sp->SetStoppedBySignal(SIGSTOP);
+ThreadWasCreated(*thread_sp);
 
 // Let our process instance know the thread has stopped.
 SetCurrentThreadID (thread_sp->GetID ());
@@ -791,7 +788,6 @@
 ::pid_t
 NativeProcessLinux::Attach(lldb::pid_t pid, Error &error)
 {
-lldb::ThreadSP inferior;
 Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
 
 // Use a map to keep track of the threads which we have attached/need to attach.
@@ -857,12 +853,12 @@
 it->second = true;
 
 // Create the thread, mark it as stopped.
-NativeThreadProtocolSP thread_sp (AddThread (static_cast (tid)));
+NativeThreadLinuxSP thread_sp (AddThread(static_cast(tid)));
 assert (thread_sp && "AddThread() returned a nullptr");
 
 // This will notify this is a new thread and tell the system it is stopped.
-std::static_pointer_cast (thread_sp)->SetStoppedBySignal (SIGSTOP);
-ThreadWasCreated(tid);
+thread_sp->SetStoppedBySignal(SIGSTOP);
+ThreadWasCreated(*thread_sp);
 SetCurrentThreadID (thread_sp->GetID ());
 }
 
@@ -1056,7 +1052,7 @@
 {
 Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS))

Re: [Lldb-commits] [PATCH] D12187: [NativeProcessLinux] Reduce the number of casts

2015-08-21 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

Thanks for the info about the plans. If you plan to move to this direction then 
it make sense to leave these functions with reference arguments.

Side note: Why we use a shared_ptr for NTL? I would expect a unique_ptr would 
be sufficient in NPL (or possibly a store by value with move constructors).


Repository:
  rL LLVM

http://reviews.llvm.org/D12187



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


Re: [Lldb-commits] [PATCH] D12218: Implement handling of `library:` keys in thread stop replies.

2015-08-21 Thread Tamas Berghammer via lldb-commits
tberghammer resigned from this revision.
tberghammer removed a reviewer: tberghammer.
tberghammer added a comment.

I leave this review to the others as I have no idea about how library loading 
works on Windows. (On Linux/Android we use a breakpoint on a special symbol 
exposed by the linker)


http://reviews.llvm.org/D12218



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


[Lldb-commits] [lldb] r245687 - Add repro test case for bug #24530

2015-08-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Aug 21 05:38:31 2015
New Revision: 245687

URL: http://llvm.org/viewvc/llvm-project?rev=245687&view=rev
Log:
Add repro test case for bug #24530

Modified:
lldb/trunk/test/functionalities/signal/raise/TestRaise.py

Modified: lldb/trunk/test/functionalities/signal/raise/TestRaise.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/signal/raise/TestRaise.py?rev=245687&r1=245686&r2=245687&view=diff
==
--- lldb/trunk/test/functionalities/signal/raise/TestRaise.py (original)
+++ lldb/trunk/test/functionalities/signal/raise/TestRaise.py Fri Aug 21 
05:38:31 2015
@@ -8,11 +8,11 @@ import lldbutil
 import re
 
 
+@skipIfWindows # signals do not exist on Windows
 class RaiseTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipIfWindows # signals do not exist on Windows
 @skipUnlessDarwin
 @dsym_test
 @expectedFailureDarwin("llvm.org/pr23610") # process doesn't stop at a 
breakpoint on the third launch
@@ -21,7 +21,6 @@ class RaiseTestCase(TestBase):
 self.signal_test('SIGSTOP', False)
 # passing of SIGSTOP is not correctly handled, so not testing that 
scenario: https://llvm.org/bugs/show_bug.cgi?id=23574
 
-@skipIfWindows # signals do not exist on Windows
 @dwarf_test
 @expectedFailureDarwin("llvm.org/pr23610") # process doesn't stop at a 
breakpoint on the third launch
 def test_sigstop_with_dwarf(self):
@@ -29,7 +28,6 @@ class RaiseTestCase(TestBase):
 self.signal_test('SIGSTOP', False)
 # passing of SIGSTOP is not correctly handled, so not testing that 
scenario: https://llvm.org/bugs/show_bug.cgi?id=23574
 
-@skipIfWindows # signals do not exist on Windows
 @dwarf_test
 @skipIfDarwin # darwin does not support real time signals
 @skipIfTargetAndroid()
@@ -158,6 +156,89 @@ class RaiseTestCase(TestBase):
 # reset signal handling to default
 self.set_handle(signal, default_pass, default_stop, default_notify)
 
+@dwarf_test
+@expectedFailureLinux("llvm.org/pr24530") # the signal the inferior 
generates gets lost
+@expectedFailureDarwin("llvm.org/pr24530") # the signal the inferior 
generates gets lost
+def test_restart_bug_with_dwarf(self):
+self.buildDwarf()
+self.restart_bug_test()
+
+@dsym_test
+@expectedFailureDarwin("llvm.org/pr24530") # the signal the inferior 
generates gets lost
+def test_restart_bug_with_dsym(self):
+self.buildDsym()
+self.restart_bug_test()
+
+def restart_bug_test(self):
+"""Test that we catch a signal in the edge case where the process 
receives it while we are
+about to interrupt it"""
+
+exe = os.path.join(os.getcwd(), "a.out")
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+bkpt = target.BreakpointCreateByName("main")
+self.assertTrue(bkpt.IsValid(), VALID_BREAKPOINT)
+
+# launch the inferior and don't wait for it to stop
+self.dbg.SetAsync(True)
+error = lldb.SBError()
+listener = lldb.SBListener("my listener")
+process = target.Launch (listener,
+["SIGSTOP"], # argv
+None,# envp
+None,# stdin_path
+None,# stdout_path
+None,# stderr_path
+None,# working directory
+0,   # launch flags
+False,   # Stop at entry
+error)   # error
+
+self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
+
+event = lldb.SBEvent()
+
+# Give the child enough time to reach the breakpoint,
+# while clearing out all the pending events.
+# The last WaitForEvent call will time out after 2 seconds.
+while listener.WaitForEvent(2, event):
+if self.TraceOn():
+print "Process changing state to:", 
self.dbg.StateAsCString(process.GetStateFromEvent(event))
+
+# now the process should be stopped
+self.assertEqual(process.GetState(), lldb.eStateStopped, 
PROCESS_STOPPED)
+
self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint(process, 
bkpt)), 1,
+"A thread should be stopped at breakpoint")
+
+# Remove all breakpoints. This makes sure we don't have to single-step 
over them when we
+# resume the process below
+target.DeleteAllBreakpoints()
+
+# resume the process and immediately try to set another breakpoint. 
When using the remote
+# stub, this will trigger a request to stop the process just as it is 
about to stop
+# naturally due to a SIGSTOP signal it raises. Make sure we do not 
lose this signal.
+process.Continue()
+self.assertTrue(target.Breakpoi

[Lldb-commits] [lldb] r245690 - Fix assertion failure caused by r245546

2015-08-21 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Aug 21 05:49:09 2015
New Revision: 245690

URL: http://llvm.org/viewvc/llvm-project?rev=245690&view=rev
Log:
Fix assertion failure caused by r245546

Change the way EmulateInstruction::eContextPopRegisterOffStack handled
in UnwindAssemblyInstEmulation::WriteRegister to accomodate for
additional cases when eContextPopRegisterOffStack (pop PC/FLAGS).

Modified:
lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp

lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=245690&r1=245689&r2=245690&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp 
(original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Fri Aug 
21 05:49:09 2015
@@ -10321,8 +10321,7 @@ EmulateInstructionARM::EmulateLDRDImmedi
 return false;
   
 //R[t2] = MemA[address+4,4];
-  
-context.SetRegisterPlusOffset (base_reg, (address + 4) - Rn);
+context.SetAddress(address + 4);
 data = MemARead (context, address + 4, addr_byte_size, 0, &success);
 if (!success)
 return false;

Modified: 
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=245690&r1=245689&r2=245690&view=diff
==
--- 
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 Fri Aug 21 05:49:09 2015
@@ -580,17 +580,32 @@ UnwindAssemblyInstEmulation::WriteRegist
 const uint32_t generic_regnum = 
reg_info->kinds[eRegisterKindGeneric];
 if (reg_num != LLDB_INVALID_REGNUM && generic_regnum != 
LLDB_REGNUM_GENERIC_SP)
 {
-if (context.info_type == 
EmulateInstruction::eInfoTypeAddress)
+switch (context.info_type)
 {
-if (m_pushed_regs.find (reg_num) != 
m_pushed_regs.end () &&
-context.info.address == m_pushed_regs[reg_num])
-{
-m_curr_row->SetRegisterLocationToSame 
(reg_num, /*must_replace*/ false);
-m_curr_row_modified = true;
-}
+case EmulateInstruction::eInfoTypeAddress:
+if (m_pushed_regs.find(reg_num) != 
m_pushed_regs.end() &&
+context.info.address == 
m_pushed_regs[reg_num])
+{
+
m_curr_row->SetRegisterLocationToSame(reg_num,
+  
false /*must_replace*/);
+m_curr_row_modified = true;
+}
+break;
+case EmulateInstruction::eInfoTypeISA:
+assert((generic_regnum == 
LLDB_REGNUM_GENERIC_PC ||
+generic_regnum == 
LLDB_REGNUM_GENERIC_FLAGS) &&
+   "eInfoTypeISA used for poping a 
register other the the PC/FLAGS");
+if (generic_regnum != 
LLDB_REGNUM_GENERIC_FLAGS)
+{
+
m_curr_row->SetRegisterLocationToSame(reg_num,
+  
false /*must_replace*/);
+m_curr_row_modified = true;
+}
+break;
+default:
+assert(false && "unhandled case, add code to 
handle this!");
+break;
 }
-else
-assert (!"unhandled case, add code to handle 
this!");
 }
 }
 }


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


[Lldb-commits] [lldb] r245691 - Increase timeout in TestExpressionInSyscall

2015-08-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Aug 21 05:52:02 2015
New Revision: 245691

URL: http://llvm.org/viewvc/llvm-project?rev=245691&view=rev
Log:
Increase timeout in TestExpressionInSyscall

test times out on the windows->android buildbot (probably due to android 
emulator being slow)

Modified:

lldb/trunk/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py

Modified: 
lldb/trunk/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py?rev=245691&r1=245690&r2=245691&view=diff
==
--- 
lldb/trunk/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py 
(original)
+++ 
lldb/trunk/test/expression_command/expr-in-syscall/TestExpressionInSyscall.py 
Fri Aug 21 05:52:02 2015
@@ -60,7 +60,7 @@ class ExprSyscallTestCase(TestBase):
 
 # send the process a signal
 process.SendAsyncInterrupt()
-while listener.WaitForEvent(1, event):
+while listener.WaitForEvent(2, event):
 pass
 
 # as a result the process should stop


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


[Lldb-commits] [PATCH] D12233: Add absolute load address support for the DynamicLoader plugins

2015-08-21 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added reviewers: sas, clayborg.
tberghammer added a subscriber: lldb-commits.

Add absolute load address support for the DynamicLoader plugins

The POSIX linker generally reports the load bias for the loaded
libraries but in some case it is useful to handle a library based on
absolute load address. Example use cases:
* Windows linker uses absolute addresses
* Library list came from different source (e.g. /proc//maps)

http://reviews.llvm.org/D12233

Files:
  include/lldb/Target/DynamicLoader.h
  source/Core/DynamicLoader.cpp
  source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
  source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
  source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -847,40 +847,52 @@
 SectionList *section_list = GetSectionList ();
 if (section_list)
 {
-if (value_is_offset)
+if (!value_is_offset)
 {
-const size_t num_sections = section_list->GetSize();
-size_t sect_idx = 0;
-
-for (sect_idx = 0; sect_idx < num_sections; ++sect_idx)
+bool found_offset = false;
+for (size_t i = 0, count = GetProgramHeaderCount(); i < count; ++i)
 {
-// Iterate through the object file sections to find all
-// of the sections that have SHF_ALLOC in their flag bits.
-SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx));
-// if (section_sp && !section_sp->IsThreadSpecific())
-if (section_sp && section_sp->Test(SHF_ALLOC))
-{
-lldb::addr_t load_addr = section_sp->GetFileAddress() + value;
-
-// On 32-bit systems the load address have to fit into 4 bytes. The rest of
-// the bytes are the overflow from the addition.
-if (GetAddressByteSize() == 4)
-load_addr &= 0x;
-
-if (target.GetSectionLoadList().SetSectionLoadAddress (section_sp, load_addr))
-++num_loaded_sections;
-}
+const elf::ELFProgramHeader* header = GetProgramHeaderByIndex(i);
+if (header == nullptr)
+continue;
+
+if (header->p_type != PT_LOAD || header->p_offset != 0)
+continue;
+
+value = value - header->p_vaddr;
+found_offset = true;
+break;
 }
-return num_loaded_sections > 0;
+if (!found_offset)
+return false;
 }
-else
+
+const size_t num_sections = section_list->GetSize();
+size_t sect_idx = 0;
+
+for (sect_idx = 0; sect_idx < num_sections; ++sect_idx)
 {
-// Not sure how to slide an ELF file given the base address
-// of the ELF file in memory
+// Iterate through the object file sections to find all
+// of the sections that have SHF_ALLOC in their flag bits.
+SectionSP section_sp (section_list->GetSectionAtIndex (sect_idx));
+// if (section_sp && !section_sp->IsThreadSpecific())
+if (section_sp && section_sp->Test(SHF_ALLOC))
+{
+lldb::addr_t load_addr = section_sp->GetFileAddress() + value;
+
+// On 32-bit systems the load address have to fit into 4 bytes. The rest of
+// the bytes are the overflow from the addition.
+if (GetAddressByteSize() == 4)
+load_addr &= 0x;
+
+if (target.GetSectionLoadList().SetSectionLoadAddress (section_sp, load_addr))
+++num_loaded_sections;
+}
 }
+return num_loaded_sections > 0;
 }
 }
-return false; // If it changed
+return false;
 }
 
 ByteOrder
Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
===
--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
+++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
@@ -103,7 +103,7 @@
 
 /// Enables a breakpoint on a function called by the runtime
 /

Re: [Lldb-commits] [PATCH] D11947: Improve instruction emulation based stack unwinding

2015-08-21 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

Fixed by http://reviews.llvm.org/rL245546


Repository:
  rL LLVM

http://reviews.llvm.org/D11947



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


[Lldb-commits] [lldb] r245695 - Fix type of dw_form_t in dwarf.h

2015-08-21 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Aug 21 07:14:47 2015
New Revision: 245695

URL: http://llvm.org/viewvc/llvm-project?rev=245695&view=rev
Log:
Fix type of dw_form_t in dwarf.h

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

Modified: lldb/trunk/include/lldb/Core/dwarf.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/dwarf.h?rev=245695&r1=245694&r2=245695&view=diff
==
--- lldb/trunk/include/lldb/Core/dwarf.h (original)
+++ lldb/trunk/include/lldb/Core/dwarf.h Fri Aug 21 07:14:47 2015
@@ -20,7 +20,7 @@ using namespace llvm::dwarf;
 typedef uint32_tdw_uleb128_t;
 typedef int32_t dw_sleb128_t;
 typedef uint16_tdw_attr_t;
-typedef uint8_t dw_form_t;
+typedef uint16_tdw_form_t;
 typedef uint16_tdw_tag_t;
 typedef uint64_tdw_addr_t;  // Dwarf address define that must be big 
enough for any addresses in the compile units that get parsed
 


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


[Lldb-commits] [lldb] r245696 - Fix BuildAddressRangeTable function when no debug arranges present

2015-08-21 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Aug 21 07:14:50 2015
New Revision: 245696

URL: http://llvm.org/viewvc/llvm-project?rev=245696&view=rev
Log:
Fix BuildAddressRangeTable function when no debug arranges present

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=245696&r1=245695&r2=245696&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fri Aug 21 
07:14:50 2015
@@ -383,6 +383,8 @@ DWARFCompileUnit::BuildAddressRangeTable
 // in order to produce a compile unit level set of address ranges that
 // is accurate.
 
+size_t num_debug_aranges = debug_aranges->GetNumRanges();
+
 // First get the compile unit DIE only and check if it has a DW_AT_ranges
 const DWARFDebugInfoEntry* die = GetCompileUnitDIEOnly();
 
@@ -417,7 +419,7 @@ DWARFCompileUnit::BuildAddressRangeTable
 if (die)
 die->BuildAddressRangeTable(dwarf2Data, this, debug_aranges);
 
-if (debug_aranges->IsEmpty())
+if (debug_aranges->GetNumRanges() == num_debug_aranges)
 {
 // We got nothing from the functions, maybe we have a line tables only
 // situation. Check the line tables and build the arange table from 
this.
@@ -448,7 +450,7 @@ DWARFCompileUnit::BuildAddressRangeTable
 }
 }
 
-if (debug_aranges->IsEmpty())
+if (debug_aranges->GetNumRanges() == num_debug_aranges)
 {
 // We got nothing from the functions, maybe we have a line tables only
 // situation. Check the line tables and build the arange table from 
this.


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


[Lldb-commits] [PATCH] D12237: [NativeProcessLinux] Pass around threads by reference

2015-08-21 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: tberghammer.
labath added a subscriber: lldb-commits.

Most NPL private functions took (shared) pointers to threads as arguments. This 
meant that the
callee could not be sure if the pointer was valid and so most functions were 
peppered with
null-checks. Now, I move the check closer to the source, and pass around the 
threads as
references (which are then assumed to be valid).

http://reviews.llvm.org/D12237

Files:
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h

Index: source/Plugins/Process/Linux/NativeProcessLinux.h
===
--- source/Plugins/Process/Linux/NativeProcessLinux.h
+++ source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -225,25 +225,25 @@
 WaitForNewThread(::pid_t tid);
 
 void
-MonitorSIGTRAP(const siginfo_t *info, lldb::pid_t pid);
+MonitorSIGTRAP(const siginfo_t &info, NativeThreadLinux &thread);
 
 void
-MonitorTrace(lldb::pid_t pid, const NativeThreadLinuxSP &thread_sp);
+MonitorTrace(NativeThreadLinux &thread);
 
 void
-MonitorBreakpoint(lldb::pid_t pid, const NativeThreadLinuxSP &thread_sp);
+MonitorBreakpoint(NativeThreadLinux &thread);
 
 void
 MonitorWatchpoint(NativeThreadLinux &thread, uint32_t wp_index);
 
 void
-MonitorSignal(const siginfo_t *info, lldb::pid_t pid, bool exited);
+MonitorSignal(const siginfo_t &info, NativeThreadLinux &thread, bool exited);
 
 bool
 SupportHardwareSingleStepping() const;
 
 Error
-SetupSoftwareSingleStepping(NativeThreadProtocolSP thread_sp);
+SetupSoftwareSingleStepping(NativeThreadLinux &thread);
 
 #if 0
 static ::ProcessMessage::CrashReason
@@ -262,20 +262,17 @@
 bool
 HasThreadNoLock (lldb::tid_t thread_id);
 
-NativeThreadProtocolSP
-MaybeGetThreadNoLock (lldb::tid_t thread_id);
-
 bool
 StopTrackingThread (lldb::tid_t thread_id);
 
 NativeThreadLinuxSP
 AddThread (lldb::tid_t thread_id);
 
 Error
-GetSoftwareBreakpointPCOffset (NativeRegisterContextSP context_sp, uint32_t &actual_opcode_size);
+GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size);
 
 Error
-FixupBreakpointPCAsNeeded(const NativeThreadLinuxSP &thread_sp);
+FixupBreakpointPCAsNeeded(NativeThreadLinux &thread);
 
 /// Writes a siginfo_t structure corresponding to the given thread ID to the
 /// memory region pointed to by @p siginfo.
@@ -317,7 +314,7 @@
 // Resume the given thread, optionally passing it the given signal. The type of resume
 // operation (continue, single-step) depends on the state parameter.
 Error
-ResumeThread(const NativeThreadLinuxSP &thread_sp, lldb::StateType state, int signo);
+ResumeThread(NativeThreadLinux &thread, lldb::StateType state, int signo);
 
 void
 ThreadWasCreated(NativeThreadLinux &thread);
Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -988,20 +988,47 @@
 return;
 }
 
-// Get details on the signal raised.
 siginfo_t info;
-const auto err = GetSignalInfo(pid, &info);
-if (err.Success())
+const auto info_err = GetSignalInfo(pid, &info);
+auto thread_sp = GetThreadByID(pid);
+
+if (! thread_sp)
+{
+// Normally, the only situation when we cannot find the thread is if we have just
+// received a new thread notification. This is indicated by GetSignalInfo() returning
+// si_code == SI_USER and si_pid == 0
+if (log)
+log->Printf("NativeProcessLinux::%s received notification about an unknown tid %" PRIu64 ".", __FUNCTION__, pid);
+
+if (info_err.Fail())
+{
+if (log)
+log->Printf("NativeProcessLinux::%s (tid %" PRIu64 ") GetSignalInfo failed (%s). Ingoring this notification.", __FUNCTION__, pid, info_err.AsCString());
+return;
+}
+
+if (log && (info.si_code != SI_USER || info.si_pid != 0))
+log->Printf("NativeProcessLinux::%s (tid %" PRIu64 ") unexpected signal info (si_code: %d, si_pid: %d). Treating as a new thread notification anyway.", __FUNCTION__, pid, info.si_code, info.si_pid);
+
+auto thread_sp = AddThread(pid);
+// Resume the newly created thread.
+ResumeThread(*thread_sp, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER);
+ThreadWasCreated(*thread_sp);
+return;
+}
+
+// Get details on the signal raised.
+if (info_err.Success())
 {
 // We have retrieved the signal info.  Dispatch appropriately.

[Lldb-commits] [PATCH] D12238: Add support for DW_FORM_GNU_[addr, str]_index

2015-08-21 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added reviewers: clayborg, labath.
tberghammer added a subscriber: lldb-commits.

Add support for DW_FORM_GNU_[addr,str]_index

These are 2 new value currently in experimental status used when split debug 
info is enabled.

Note: This CL is part of a long series of CLs to add fission support to LLDB

http://reviews.llvm.org/D12238

Files:
  include/lldb/lldb-enumerations.h
  source/Expression/IRExecutionUnit.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
  source/Symbol/ClangASTContext.cpp
  source/Symbol/ObjectFile.cpp
  source/Utility/ConvertEnum.cpp

Index: source/Utility/ConvertEnum.cpp
===
--- source/Utility/ConvertEnum.cpp
+++ source/Utility/ConvertEnum.cpp
@@ -63,6 +63,8 @@
 return "objc-cfstrings";
 case eSectionTypeDWARFDebugAbbrev:
 return "dwarf-abbrev";
+case eSectionTypeDWARFDebugAddr:
+return "dwarf-addr";
 case eSectionTypeDWARFDebugAranges:
 return "dwarf-aranges";
 case eSectionTypeDWARFDebugFrame:
@@ -83,6 +85,8 @@
 return "dwarf-ranges";
 case eSectionTypeDWARFDebugStr:
 return "dwarf-str";
+case eSectionTypeDWARFDebugStrOffsets:
+return "dwarf-str-offsets";
 case eSectionTypeELFSymbolTable:
 return "elf-symbol-table";
 case eSectionTypeELFDynamicSymbols:
Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -354,6 +354,7 @@
 return eAddressClassData;
 case eSectionTypeDebug:
 case eSectionTypeDWARFDebugAbbrev:
+case eSectionTypeDWARFDebugAddr:
 case eSectionTypeDWARFDebugAranges:
 case eSectionTypeDWARFDebugFrame:
 case eSectionTypeDWARFDebugInfo:
@@ -364,6 +365,7 @@
 case eSectionTypeDWARFDebugPubTypes:
 case eSectionTypeDWARFDebugRanges:
 case eSectionTypeDWARFDebugStr:
+case eSectionTypeDWARFDebugStrOffsets:
 case eSectionTypeDWARFAppleNames:
 case eSectionTypeDWARFAppleTypes:
 case eSectionTypeDWARFAppleNamespaces:
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -8964,7 +8964,8 @@
 {
 case DW_AT_name:
 if (attributes.ExtractFormValueAtIndex(dwarf, i, form_value))
-name = form_value.AsCString(&dwarf->get_debug_str_data());
+name = form_value.AsCString(&dwarf->get_debug_str_data(),
+&dwarf->get_debug_str_offsets_data());
 break;
 
 case DW_AT_type:
@@ -9494,7 +9495,8 @@
 break;
 
 case DW_AT_name:
-name = form_value.AsCString(&dwarf->get_debug_str_data());
+name = form_value.AsCString(&dwarf->get_debug_str_data(),
+&dwarf->get_debug_str_offsets_data());
 break;
 
 case DW_AT_description:
@@ -9871,7 +9873,7 @@
 case DW_AT_decl_file:   decl.SetFile(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(form_value.Unsigned())); break;
 case DW_AT_decl_line:   decl.SetLine(form_value.Unsigned()); break;
 case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break;
-case DW_AT_name:name = form_value.AsCString(&dwarf->get_debug_str_data()); break;
+case DW_AT_name:name = form_value.AsCString(&dwarf->get_debug_str_data(), &dwarf->get_debug_str_offsets_data()); break;
 case DW_AT_type:encoding_uid = form_v

Re: [Lldb-commits] [PATCH] D12238: Add support for DW_FORM_GNU_[addr, str]_index

2015-08-21 Thread Tamas Berghammer via lldb-commits
tberghammer added inline comments.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h:56
@@ -55,2 +55,3 @@
 dw_addr_t   GetBaseAddress() const { return m_base_addr; }
+dw_addr_t   GetAddrBase() const { return 0; } // TODO: Read out 
DW_AT_addr_base from the parent compile unit
 voidClearDIEs(bool keep_compile_unit_die);

This will be completed by a later patch because fetching it require parts what 
will be only added later.


http://reviews.llvm.org/D12238



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


[Lldb-commits] [PATCH] D12239: Fix buffer overflow for fixed_form_sizes

2015-08-21 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added reviewers: labath, clayborg.
tberghammer added a subscriber: lldb-commits.

Fix buffer overflow for fixed_form_sizes

The array is indexed by the value in the DW_FORM filed what can be
bigger then the size of the array. This CL add bound checking to avoid
buffer overflows.

Note: This CL is part of a long series of CLs to add fission support to LLDB

http://reviews.llvm.org/D12239

Files:
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Symbol/ClangASTContext.cpp

Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -8941,7 +8941,7 @@
 case DW_TAG_template_type_parameter:
 case DW_TAG_template_value_parameter:
 {
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
+auto fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
 
 DWARFDebugInfoEntry::Attributes attributes;
 const size_t num_attributes = die->GetAttributes (dwarf,
@@ -9461,7 +9461,7 @@
 
 size_t enumerators_added = 0;
 const DWARFDebugInfoEntry *die;
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
+auto fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
 
 for (die = parent_die->GetFirstChild(); die != NULL; die = die->GetSibling())
 {
@@ -9820,7 +9820,7 @@
 
 size_t count = 0;
 const DWARFDebugInfoEntry *die;
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
+auto fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
 uint32_t member_idx = 0;
 BitfieldInfo last_field_info;
 ModuleSP module_sp = dwarf->GetObjectFile()->GetModule();
@@ -10402,7 +10402,7 @@
 if (parent_die == NULL)
 return 0;
 
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
+auto fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
 
 size_t arg_idx = 0;
 const DWARFDebugInfoEntry *die;
@@ -10580,7 +10580,7 @@
 return;
 
 const DWARFDebugInfoEntry *die;
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
+auto fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64());
 for (die = parent_die->GetFirstChild(); die != NULL; die = die->GetSibling())
 {
 const dw_tag_t tag = die->Tag();
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4053,9 +4053,9 @@
 else if (DWARFFormValue::IsDataForm(form_value.Form()))
 {
 // Retrieve the value as a data expression.
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (attributes.CompileUnitAtIndex(i)->GetAddressByteSize(), attributes.CompileUnitAtIndex(i)->IsDWARF64());
+auto fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (attributes.CompileUnitAtIndex(i)->GetAddressByteSize(), attributes.CompileUnitAtIndex(i)->IsDWARF64());
 uint32_t data_offset = attributes.DIEOffsetAtIndex(i);
-uint32_t data_length = fixed_form_sizes[form_value.Form()];
+uint32_t data_length = form_value.Form() < fixed_form_sizes->size() ? fixed_form_sizes->at(form_value.Form()) : 0;
 if (data_length == 0)
 {
 const uint8_t *data_pointer = form_value.BlockData();
@@ -4077,9 +4077,9 @@
 // Retrieve the value as a string expression.
 if (form_

Re: [Lldb-commits] [PATCH] D12239: Fix buffer overflow for fixed_form_sizes

2015-08-21 Thread Pavel Labath via lldb-commits
labath added inline comments.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp:24
@@ -25,1 +23,3 @@
+static DWARFFormValue::FixedFormSizes
+g_form_sizes_addr4 {
 0, // 0x00 unused

Will these be linker-initialized? As I understand it, we are trying to avoid 
static constructors..


Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.h:39
@@ -38,1 +38,3 @@
+
+typedef const std::vector FixedFormSizes;
 

I don't think hiding const in the type name is a good idea. It makes it quite 
hard to tell you are declaring constant arrays below.


http://reviews.llvm.org/D12239



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


Re: [Lldb-commits] [PATCH] D12238: Add support for DW_FORM_GNU_[addr, str]_index

2015-08-21 Thread Pavel Labath via lldb-commits
labath added a comment.

Looks reasonable at a first glance, but I'll leave the review to someone else.


http://reviews.llvm.org/D12238



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


Re: [Lldb-commits] [PATCH] D12237: [NativeProcessLinux] Pass around threads by reference

2015-08-21 Thread Tamas Berghammer via lldb-commits
tberghammer accepted this revision.
tberghammer added a comment.
This revision is now accepted and ready to land.

Looks good (I assume when you dropped const from the argument it was 
intentional)


http://reviews.llvm.org/D12237



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


Re: [Lldb-commits] [PATCH] D12218: Implement handling of `library:` keys in thread stop replies.

2015-08-21 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D12218



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


Re: [Lldb-commits] [lldb] r245547 - [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue

2015-08-21 Thread Greg Clayton via lldb-commits
I agree that this change has caused many problems and is quite large to commit 
to a release branch with little testing.

I do really want to get to a Scalar and RegisterValue that uses llvm::APInt and 
llvm::APFloat as soon as possible, but seeing as this patch has continually 
caused crashes it seems a little late in the cycle to get this in.

Greg

> On Aug 21, 2015, at 3:32 AM, Tamas Berghammer  wrote:
> 
> I don't see where is the dependency between the 2 CL, but I understand that 
> you want to have r245240 in 3.7 to have better MIPS support. Personally I 
> would prefer to fix the compile issue at the release branch with a small 
> change if possible and then leave this CL out, but if you agree with Greg 
> that merging this CL is the good solution then I am fine with it. I won't 
> depend on the release branch, but still would like to see a fairly stable 
> version there.
> 
> Thanks,
> Tamas
> 
> On Fri, Aug 21, 2015 at 11:23 AM  wrote:
> Hi Tamas,
> 
> The code in release branch will fail to compile on mips if we don’t merge 
> this change because the commit r245240 in the release branch is dependant on 
> this change.  If we don't want to merge this change to the release branch 
> then we will have to revert r245240 from the release branch so that the code 
> from release branch can compile properly.
> 
> Thanks,
> Sagar
> 
> 
> On Friday 21 August 2015 03:06 PM, Tamas Berghammer wrote:
>> Hi Sagar,
>> 
>> I don't really happy with merging a big change to the release branch at the 
>> last moment (after RC3) especially as this commit caused several issues in 
>> the past and I don't think we tested it extensively enough to be sure it is 
>> works as intended at the moment.
>> 
>> Is there any reason you really want this change in LLDB 3.7 considering that 
>> we won't create a binary with the release as far as I know?
>> 
>> Thanks,
>> Tamas
>> 
>> On Fri, Aug 21, 2015 at 10:20 AM via lldb-commits 
>>  wrote:
>> Hi Hans,
>> 
>> Could you please merge r245547 to the release branch ?
>> 
>> Thanks,
>> Sagar
>> 
>> On Thursday 20 August 2015 02:42 PM, Sagar Thakur via lldb-commits wrote:
>> > Author: slthakur
>> > Date: Thu Aug 20 04:12:46 2015
>> > New Revision: 245547
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=245547&view=rev
>> > Log:
>> > [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue
>> >
>> > Eliminated ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp and 
>> > use llvm::APInt and llvm::APFloat for all integer and floating point 
>> > types. Also used Scalar in RegisterValue.cpp
>> >
>> > Reviewers: tberghammer, ovyalov, clayborg, labath
>> > Subscribers: lldb-commits, nitesh.jain, jaydeep
>> > Differential: http://reviews.llvm.org/D12100
>> >
>> > Modified:
>> >  lldb/trunk/include/lldb/Core/RegisterValue.h
>> >  lldb/trunk/include/lldb/Core/Scalar.h
>> >  lldb/trunk/include/lldb/Core/Value.h
>> >  lldb/trunk/include/lldb/lldb-private-types.h
>> >  lldb/trunk/source/Core/RegisterValue.cpp
>> >  lldb/trunk/source/Core/Scalar.cpp
>> >  lldb/trunk/source/Core/ValueObject.cpp
>> >
>> > Modified: lldb/trunk/include/lldb/Core/RegisterValue.h
>> > URL: 
>> > http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RegisterValue.h?rev=245547&r1=245546&r2=245547&view=diff
>> > ==
>> > --- lldb/trunk/include/lldb/Core/RegisterValue.h (original)
>> > +++ lldb/trunk/include/lldb/Core/RegisterValue.h Thu Aug 20 04:12:46 2015
>> > @@ -19,8 +19,9 @@
>> >   #include "lldb/lldb-public.h"
>> >   #include "lldb/lldb-private.h"
>> >   #include "lldb/Host/Endian.h"
>> > +#include "llvm/ADT/APInt.h"
>> > +#include "lldb/Core/Scalar.h"
>> >
>> > -//#define ENABLE_128_BIT_SUPPORT 1
>> >   namespace lldb_private {
>> >
>> >   class RegisterValue
>> > @@ -37,9 +38,7 @@ namespace lldb_private {
>> >   eTypeUInt16,
>> >   eTypeUInt32,
>> >   eTypeUInt64,
>> > -#if defined (ENABLE_128_BIT_SUPPORT)
>> >   eTypeUInt128,
>> > -#endif
>> >   eTypeFloat,
>> >   eTypeDouble,
>> >   eTypeLongDouble,
>> > @@ -47,7 +46,8 @@ namespace lldb_private {
>> >   };
>> >
>> >   RegisterValue () :
>> > -m_type (eTypeInvalid)
>> > +m_type (eTypeInvalid),
>> > +m_scalar ((unsigned long)0)
>> >   {
>> >   }
>> >
>> > @@ -55,57 +55,55 @@ namespace lldb_private {
>> >   RegisterValue (uint8_t inst) :
>> >   m_type (eTypeUInt8)
>> >   {
>> > -m_data.uint8 = inst;
>> > +m_scalar = inst;
>> >   }
>> >
>> >   explicit
>> >   RegisterValue (uint16_t inst) :
>> >   m_type (eTypeUInt16)
>> >   {
>> > -m_data.uint16 = inst;
>> > +m_scalar = inst;
>> >   }
>> >
>> >   explicit
>> >   RegisterValue (uint3

Re: [Lldb-commits] [PATCH] D12233: Add absolute load address support for the DynamicLoader plugins

2015-08-21 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D12233



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


Re: [Lldb-commits] [PATCH] D12239: Fix buffer overflow for fixed_form_sizes

2015-08-21 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

See inlined comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:179
@@ -178,3 +178,3 @@
 bool prev_die_had_children = false;
-const uint8_t *fixed_form_sizes = 
DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), 
m_is_dwarf64);
+auto fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize 
(GetAddressByteSize(), m_is_dwarf64);
 while (offset < next_cu_offset &&

Please don't use auto for simple types. For template types yes (for things like 
"std::vector::iterator", but not for simple types.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:665
@@ -664,3 +664,3 @@
 
-const uint8_t *fixed_form_sizes = 
DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), 
m_is_dwarf64);
+auto fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize 
(GetAddressByteSize(), m_is_dwarf64);
 

Please don't use auto for simple types. For template types yes (for things like 
"std::vector::iterator", but not for simple types.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:161
@@ -160,3 +160,3 @@
 
-const uint8_t fixed_skip_size = fixed_form_sizes [form];
+const uint8_t fixed_skip_size = form < fixed_form_sizes->size() ? 
fixed_form_sizes->at(form) : 0;
 if (fixed_skip_size)

This should be a method on DWARFFormValue::FixedFormSizes.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:1286
@@ -1285,3 +1285,3 @@
 {
-const uint8_t fixed_skip_size = fixed_form_sizes [form];
+const uint8_t fixed_skip_size = form < 
fixed_form_sizes->size() ? fixed_form_sizes->at(form) : 0;
 if (fixed_skip_size)

This should be a method on DWARFFormValue::FixedFormSizes.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp:91
@@ -90,3 +90,3 @@
 
-const uint8_t *fixed_form_sizes = 
DWARFFormValue::GetFixedFormSizesForAddressSize (cu->GetAddressByteSize(), 
cu->IsDWARF64());
+auto fixed_form_sizes = 
DWARFFormValue::GetFixedFormSizesForAddressSize (cu->GetAddressByteSize(), 
cu->IsDWARF64());
 

"DWARFFormValue::FixedFormSizes *" instead of "auto".


Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp:23-24
@@ -22,4 +22,4 @@
 
-static uint8_t g_form_sizes_addr4[] = 
-{
+static DWARFFormValue::FixedFormSizes
+g_form_sizes_addr4 {
 0, // 0x00 unused

You could probably leave these as "static uint8_t g_form_sizes_addr4[]" and 
then have the new DWARFFormValue::FixedFormSizes struct/class that we make get 
intialized with these const arrays and do the bounds checking. This would avoid 
static constructors and also provide bounds checking.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp:60-61
@@ -60,5 +59,4 @@
 
-static uint8_t
-g_form_sizes_addr8[] = 
-{
+static DWARFFormValue::FixedFormSizes
+g_form_sizes_addr8 {
 0, // 0x00 unused

You could probably leave these as "static uint8_t g_form_sizes_addr8[]" and 
then have the new DWARFFormValue::FixedFormSizes struct/class that we make get 
intialized with these const arrays and do the bounds checking. This would avoid 
static constructors and also provide bounds checking.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp:99-100
@@ -100,5 +98,4 @@
 // DW_FORM_strp and DW_FORM_sec_offset are 8 instead of 4
-static uint8_t
-g_form_sizes_addr8_dwarf64[] =
-{
+static DWARFFormValue::FixedFormSizes
+g_form_sizes_addr8_dwarf64 {
 0, // 0x00 unused

Ditto above comment.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp:136-151
@@ -138,18 +135,18 @@
 
-const uint8_t * 
+DWARFFormValue::FixedFormSizes*
 DWARFFormValue::GetFixedFormSizesForAddressSize (uint8_t addr_size, bool 
is_dwarf64)
 {
 if (!is_dwarf64) {
 switch (addr_size)
 {
-case 4: return g_form_sizes_addr4;
-case 8: return g_form_sizes_addr8;
+case 4: return &g_form_sizes_addr4;
+case 8: return &g_form_sizes_addr8;
 }
 } else {
 if (addr_size == 8)
-return g_form_sizes_addr8_dwarf64;
+return &g_form_sizes_addr8_dwarf64;
 // is_dwarf64 && addr_size == 4 : no provider does this.
 }
-return NULL;
+return nullptr;
 }
 

Change this function to use the original static arrays and construct a 
DWARFFormValue::FixedFormSizes with a pointer and array size to provide bounds 
checking. No need to use a std::vector for const data.


Comment at: source/Plugins/SymbolFile/DWARF/D

Re: [Lldb-commits] [PATCH] D12238: Add support for DW_FORM_GNU_[addr, str]_index

2015-08-21 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Looks good, a few changes needed.

We might consider changing FormValue::AsCString() to take a "SymbolFileDWARF*" 
instead of the data extractor for .debug_str and .debug_str_offsets. This way 
it would be only one parameter and it would clean up the code. It would help 
errors like on DWARFCompileUnit.cpp:729 and DWARFCompileUnit.cpp:745 where both 
were not passed.

Other than that we might consider modifying FormValue::Address(...) as 
suggested in the inlined comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:729
@@ -727,3 +728,3 @@
 if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, 
form_value))
-name = form_value.AsCString(debug_str);
+name = form_value.AsCString(debug_str, 
debug_str_offsets);
 break;

Don't we need to pass both debug_str and debug_str_offsets here? Other places 
seem to pass both like on DWARFDebugInfoEntry.cpp:826


Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:745
@@ -743,3 +744,3 @@
 if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, 
form_value))
-mangled_cstr = form_value.AsCString(debug_str);

+mangled_cstr = form_value.AsCString(debug_str, 
debug_str_offsets);
 break;

Don't we need to pass both debug_str and debug_str_offsets here? Other places 
seem to pass both like on DWARFDebugInfoEntry.cpp:826



Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp:190
@@ -189,7 +189,3 @@
 case DW_FORM_data8: m_value.value.uval = data.GetU64(offset_ptr);  
 break;
-case DW_FORM_string:m_value.value.cstr = data.GetCStr(offset_ptr);
-// Set the string value to also be the data 
for inlined cstr form values only
-// so we can tell the difference between 
DW_FORM_string and DW_FORM_strp form
-// values;
-m_value.data = (const 
uint8_t*)m_value.value.cstr;  break;
+case DW_FORM_string:m_value.value.cstr = data.GetCStr(offset_ptr); 
 break;
 case DW_FORM_exprloc:

We we not longer need "m_value.data" set to the cstring value to tell the 
difference between DW_FORM_string and DW_FORM_strp? This might have been left 
over from the code this originated from and might be able to be removed, but I 
just wanted to verify that you intended to remove this.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.h:68
@@ -68,1 +67,3 @@
+  const lldb_private::DWARFDataExtractor* 
debug_str_offsets_data_ptr) const;
+dw_addr_t   Address(const lldb_private::DWARFDataExtractor* 
debug_addr_data_ptr) const;
 boolSkipValue(const lldb_private::DWARFDataExtractor& 
debug_info_data, lldb::offset_t *offset_ptr) const;

Should be pass in a lldb::addr_t base_addr in case the DW_FORM is one where we 
need to add to the low_pc? Then code like this:

```
dw_form_t form = form_value.Form();
if (form == DW_FORM_addr || form == DW_FORM_GNU_addr_index)
return form_value.Address(&dwarf2Data->get_debug_addr_data());

// DWARF4 can specify the hi_pc as an 
return lo_pc + form_value.Unsigned();
```

Becomes:

```
return form_value.Address(&dwarf2Data->get_debug_addr_data(), 
lo_pc);
```

The "base_addr" could default to LLDB_INVALID_ADDRESS and if we get a relative 
address we should assert in debug builds using LLDB_ASSERT.



http://reviews.llvm.org/D12238



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


[Lldb-commits] [lldb] r245708 - Implement handling of `library:` keys in thread stop replies.

2015-08-21 Thread Stephane Sezer via lldb-commits
Author: sas
Date: Fri Aug 21 11:51:56 2015
New Revision: 245708

URL: http://llvm.org/viewvc/llvm-project?rev=245708&view=rev
Log:
Implement handling of `library:` keys in thread stop replies.

Summary:
When a windows remote stops because of a DLL load/unload, the debug server
sends a stop reply packet that contains a `library` key with any value (usually
just `library:1`). This indicates to the debugger that a library has been
loaded or unloaded and that the list of libraries should be refreshed (usually
with `qXfer:libraries:read`).

This change just triggers a call to `LoadModules()` which in turns will send a
remote library read command when a stop reply that requests it is received.

Reviewers: clayborg, zturner, tberghammer

Subscribers: lldb-commits

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

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

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=245708&r1=245707&r2=245708&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Aug 
21 11:51:56 2015
@@ -2523,6 +2523,10 @@ ProcessGDBRemote::SetThreadStopInfo (Str
 ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
 description = ostr.GetString().c_str();
 }
+else if (key.compare("library") == 0)
+{
+LoadModules();
+}
 else if (key.size() == 2 && ::isxdigit(key[0]) && 
::isxdigit(key[1]))
 {
 uint32_t reg = StringConvert::ToUInt32 (key.c_str(), 
UINT32_MAX, 16);


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


Re: [Lldb-commits] [PATCH] D12218: Implement handling of `library:` keys in thread stop replies.

2015-08-21 Thread Stephane Sezer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245708: Implement handling of `library:` keys in thread stop 
replies. (authored by sas).

Changed prior to commit:
  http://reviews.llvm.org/D12218?vs=32766&id=32835#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12218

Files:
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2523,6 +2523,10 @@
 ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
 description = ostr.GetString().c_str();
 }
+else if (key.compare("library") == 0)
+{
+LoadModules();
+}
 else if (key.size() == 2 && ::isxdigit(key[0]) && 
::isxdigit(key[1]))
 {
 uint32_t reg = StringConvert::ToUInt32 (key.c_str(), 
UINT32_MAX, 16);


Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2523,6 +2523,10 @@
 ostr.Printf("%" PRIu64 " %" PRIu32, wp_addr, wp_index);
 description = ostr.GetString().c_str();
 }
+else if (key.compare("library") == 0)
+{
+LoadModules();
+}
 else if (key.size() == 2 && ::isxdigit(key[0]) && ::isxdigit(key[1]))
 {
 uint32_t reg = StringConvert::ToUInt32 (key.c_str(), UINT32_MAX, 16);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Stephane Sezer via lldb-commits
sas created this revision.
sas added reviewers: clayborg, zturner.
sas added a subscriber: lldb-commits.

This commit implements basic DidAttach and DidLaunch for the windows
DynamicLoader plugin which allow us to load shared libraries from the
inferior.

At the moment, I'm unsure how we're going to gather the load address of
the main module over gdb protocol so I always use an offset of 0, which
works well for processes we create ourselves (no randomization). I will
address this point later on.

http://reviews.llvm.org/D12245

Files:
  source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp

Index: source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
===
--- source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -9,6 +9,7 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -72,11 +73,38 @@
 void
 DynamicLoaderWindowsDYLD::DidAttach()
 {
+Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf ("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+DidLaunch();
+
+m_process->LoadModules();
 }
 
 void
 DynamicLoaderWindowsDYLD::DidLaunch()
 {
+Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf ("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ModuleSP executable = GetTargetExecutable();
+
+if (!executable.get())
+  return;
+
+ModuleList module_list;
+module_list.Append(executable);
+// FIXME: We probably should not always use 0 as the load address
+// here. Testing showed that when debugging a process that we start
+// ourselves, there's no randomization of the load address of the
+// main module, therefore an offset of 0 will be valid.
+// If we attach to an already running process, this is probably
+// going to be wrong and we'll have to get the load address somehow.
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
+
+m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 Error


Index: source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
===
--- source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -9,6 +9,7 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -72,11 +73,38 @@
 void
 DynamicLoaderWindowsDYLD::DidAttach()
 {
+Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf ("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+DidLaunch();
+
+m_process->LoadModules();
 }
 
 void
 DynamicLoaderWindowsDYLD::DidLaunch()
 {
+Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf ("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ModuleSP executable = GetTargetExecutable();
+
+if (!executable.get())
+  return;
+
+ModuleList module_list;
+module_list.Append(executable);
+// FIXME: We probably should not always use 0 as the load address
+// here. Testing showed that when debugging a process that we start
+// ourselves, there's no randomization of the load address of the
+// main module, therefore an offset of 0 will be valid.
+// If we attach to an already running process, this is probably
+// going to be wrong and we'll have to get the load address somehow.
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
+
+m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 Error
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Fine for now.


http://reviews.llvm.org/D12245



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


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Zachary Turner via lldb-commits
zturner added a comment.

Can you verify that this does not break local debugging on Windows?


http://reviews.llvm.org/D12245



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


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Stephane Sezer via lldb-commits
sas updated this revision to Diff 32842.
sas added a comment.

Style.


http://reviews.llvm.org/D12245

Files:
  source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp

Index: source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
===
--- source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -9,6 +9,7 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -72,11 +73,38 @@
 void
 DynamicLoaderWindowsDYLD::DidAttach()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+DidLaunch();
+
+m_process->LoadModules();
 }
 
 void
 DynamicLoaderWindowsDYLD::DidLaunch()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ModuleSP executable = GetTargetExecutable();
+
+if (!executable.get())
+return;
+
+ModuleList module_list;
+module_list.Append(executable);
+// FIXME: We probably should not always use 0 as the load address
+// here. Testing showed that when debugging a process that we start
+// ourselves, there's no randomization of the load address of the
+// main module, therefore an offset of 0 will be valid.
+// If we attach to an already running process, this is probably
+// going to be wrong and we'll have to get the load address somehow.
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
+
+m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 Error


Index: source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
===
--- source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -9,6 +9,7 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -72,11 +73,38 @@
 void
 DynamicLoaderWindowsDYLD::DidAttach()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+DidLaunch();
+
+m_process->LoadModules();
 }
 
 void
 DynamicLoaderWindowsDYLD::DidLaunch()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ModuleSP executable = GetTargetExecutable();
+
+if (!executable.get())
+return;
+
+ModuleList module_list;
+module_list.Append(executable);
+// FIXME: We probably should not always use 0 as the load address
+// here. Testing showed that when debugging a process that we start
+// ourselves, there's no randomization of the load address of the
+// main module, therefore an offset of 0 will be valid.
+// If we attach to an already running process, this is probably
+// going to be wrong and we'll have to get the load address somehow.
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
+
+m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 Error
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Stephane Sezer via lldb-commits
sas added a comment.

@zturner, will do before submitting.


http://reviews.llvm.org/D12245



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


Re: [Lldb-commits] [lldb] r245547 - [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue

2015-08-21 Thread Hans Wennborg via lldb-commits
I'm not happy about this.

lldb builds fine on Linux for me. What's the build problem on mips? I
also don't see the relation between r245240 (which was also a large
patch) and this, but I haven't looked closely and am not familiar with
the code.

In general it would be nice if merge requests don't break the build. I
do check that the build works on x86_64 Linux before committing a
merge, but I don't have a mips machine.

RC3 was just tagged and will be the final release unless a critical
regression comes up.

If you need a build fix or revert for MIPS I'd be willing to squeeze
that in if we do an RC4 for some other reason, or before committing
the -final tag (but then it really has to be a mips-only change that
would not affect other platforms).


Thanks,
Hans

On Fri, Aug 21, 2015 at 3:17 AM,   wrote:
> Hi Tamas,
>
> The code in release branch will fail to compile on mips if we don’t merge
> this change because the commit r245240 in the release branch is dependant on
> this change.  If we don't want to merge this change to the release branch
> then we will have to revert r245240 from the release branch so that the code
> from release branch can compile properly.
>
> Thanks,
> Sagar
>
>
> On Friday 21 August 2015 03:06 PM, Tamas Berghammer wrote:
>
> Hi Sagar,
>
> I don't really happy with merging a big change to the release branch at the
> last moment (after RC3) especially as this commit caused several issues in
> the past and I don't think we tested it extensively enough to be sure it is
> works as intended at the moment.
>
> Is there any reason you really want this change in LLDB 3.7 considering that
> we won't create a binary with the release as far as I know?
>
> Thanks,
> Tamas
>
> On Fri, Aug 21, 2015 at 10:20 AM via lldb-commits
>  wrote:
>>
>> Hi Hans,
>>
>> Could you please merge r245547 to the release branch ?
>>
>> Thanks,
>> Sagar
>>
>> On Thursday 20 August 2015 02:42 PM, Sagar Thakur via lldb-commits wrote:
>> > Author: slthakur
>> > Date: Thu Aug 20 04:12:46 2015
>> > New Revision: 245547
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=245547&view=rev
>> > Log:
>> > [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue
>> >
>> > Eliminated ENABLE_128_BIT_SUPPORT and union ValueData from Scalar.cpp
>> > and use llvm::APInt and llvm::APFloat for all integer and floating point
>> > types. Also used Scalar in RegisterValue.cpp
>> >
>> > Reviewers: tberghammer, ovyalov, clayborg, labath
>> > Subscribers: lldb-commits, nitesh.jain, jaydeep
>> > Differential: http://reviews.llvm.org/D12100
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Zachary Turner via lldb-commits
Tested on Windows, I don't see any problems, so lgtm.

If you're going to be doing a non-trivial amount of work on ProcessWindows
or DynamicLoaderWindows, would it be possible for you to set up a Windows
box you can test from?  I'm happy to help you get this set up if you need.

On Fri, Aug 21, 2015 at 10:33 AM Stephane Sezer  wrote:

> sas added a comment.
>
> @zturner, will do before submitting.
>
>
> http://reviews.llvm.org/D12245
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Stephane Sezer via lldb-commits
sas added a comment.

Thanks for the testing. I'll definitely setup a windows box.


http://reviews.llvm.org/D12245



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


[Lldb-commits] [lldb] r245725 - Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Stephane Sezer via lldb-commits
Author: sas
Date: Fri Aug 21 14:28:34 2015
New Revision: 245725

URL: http://llvm.org/viewvc/llvm-project?rev=245725&view=rev
Log:
Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

Summary:
This commit implements basic DidAttach and DidLaunch for the windows
DynamicLoader plugin which allow us to load shared libraries from the
inferior.

At the moment, I'm unsure how we're going to gather the load address of
the main module over gdb protocol so I always use an offset of 0, which
works well for processes we create ourselves (no randomization). I will
address this point later on.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

Modified:

lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp?rev=245725&r1=245724&r2=245725&view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
 Fri Aug 21 14:28:34 2015
@@ -9,6 +9,7 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -72,11 +73,38 @@ DynamicLoaderWindowsDYLD::CreateInstance
 void
 DynamicLoaderWindowsDYLD::DidAttach()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+DidLaunch();
+
+m_process->LoadModules();
 }
 
 void
 DynamicLoaderWindowsDYLD::DidLaunch()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ModuleSP executable = GetTargetExecutable();
+
+if (!executable.get())
+return;
+
+ModuleList module_list;
+module_list.Append(executable);
+// FIXME: We probably should not always use 0 as the load address
+// here. Testing showed that when debugging a process that we start
+// ourselves, there's no randomization of the load address of the
+// main module, therefore an offset of 0 will be valid.
+// If we attach to an already running process, this is probably
+// going to be wrong and we'll have to get the load address somehow.
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
+
+m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 Error


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


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Stephane Sezer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL245725: Implement basic DidAttach and DidLaunch for 
DynamicLoaderWindowsDYLD. (authored by sas).

Changed prior to commit:
  http://reviews.llvm.org/D12245?vs=32842&id=32853#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12245

Files:
  
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp

Index: 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
===
--- 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -9,6 +9,7 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -72,11 +73,38 @@
 void
 DynamicLoaderWindowsDYLD::DidAttach()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+DidLaunch();
+
+m_process->LoadModules();
 }
 
 void
 DynamicLoaderWindowsDYLD::DidLaunch()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ModuleSP executable = GetTargetExecutable();
+
+if (!executable.get())
+return;
+
+ModuleList module_list;
+module_list.Append(executable);
+// FIXME: We probably should not always use 0 as the load address
+// here. Testing showed that when debugging a process that we start
+// ourselves, there's no randomization of the load address of the
+// main module, therefore an offset of 0 will be valid.
+// If we attach to an already running process, this is probably
+// going to be wrong and we'll have to get the load address somehow.
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
+
+m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 Error


Index: lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
===
--- lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -9,6 +9,7 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -72,11 +73,38 @@
 void
 DynamicLoaderWindowsDYLD::DidAttach()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+DidLaunch();
+
+m_process->LoadModules();
 }
 
 void
 DynamicLoaderWindowsDYLD::DidLaunch()
 {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+ModuleSP executable = GetTargetExecutable();
+
+if (!executable.get())
+return;
+
+ModuleList module_list;
+module_list.Append(executable);
+// FIXME: We probably should not always use 0 as the load address
+// here. Testing showed that when debugging a process that we start
+// ourselves, there's no randomization of the load address of the
+// main module, therefore an offset of 0 will be valid.
+// If we attach to an already running process, this is probably
+// going to be wrong and we'll have to get the load address somehow.
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
+
+m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 Error
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] LLVM buildmaster will be restarted tonight

2015-08-21 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be restarted after 6 PM Pacific time today.

Thanks

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


[Lldb-commits] [lldb] r245748 - Skip TestCreateAfterAttach on Windows.

2015-08-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Aug 21 17:11:21 2015
New Revision: 245748

URL: http://llvm.org/viewvc/llvm-project?rev=245748&view=rev
Log:
Skip TestCreateAfterAttach on Windows.

As with every other platform, this test occasionally hangs on
Windows.

Modified:

lldb/trunk/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py

Modified: 
lldb/trunk/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py?rev=245748&r1=245747&r2=245748&view=diff
==
--- 
lldb/trunk/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
 (original)
+++ 
lldb/trunk/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
 Fri Aug 21 17:11:21 2015
@@ -23,7 +23,7 @@ class CreateAfterAttachTestCase(TestBase
# not yet investigated.  Revisit once required functionality
# is implemented for FreeBSD.
 @skipIfLinux # Occasionally hangs on the build bot, expectedFailureLinux
-
+@skipIfWindows # Occasionally hangs on Windows, may be same as other 
issues.
 @dwarf_test
 def test_create_after_attach_with_dwarf_and_popen(self):
 """Test thread creation after process attach."""


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


[Lldb-commits] [lldb] r245747 - XFAIL Tests that require C++ exceptions on Windows.

2015-08-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Aug 21 17:11:09 2015
New Revision: 245747

URL: http://llvm.org/viewvc/llvm-project?rev=245747&view=rev
Log:
XFAIL Tests that require C++ exceptions on Windows.

clang-cl does not yet support C++ exceptions, so these tests will
not even compile.

Re-enabling these tests is tracked by llvm.org/pr24538

Modified:
lldb/trunk/test/api/multithreaded/TestMultithreaded.py

lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
lldb/trunk/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py

Modified: lldb/trunk/test/api/multithreaded/TestMultithreaded.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multithreaded/TestMultithreaded.py?rev=245747&r1=245746&r2=245747&view=diff
==
--- lldb/trunk/test/api/multithreaded/TestMultithreaded.py (original)
+++ lldb/trunk/test/api/multithreaded/TestMultithreaded.py Fri Aug 21 17:11:09 
2015
@@ -22,6 +22,7 @@ class SBBreakpointCallbackCase(TestBase)
 @skipIfRemote
 @skipIfNoSBHeaders
 @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", 
compiler_version=[">=","4.9"], archs=["x86_64"])
+@expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support 
throw or catch
 def test_breakpoint_callback(self):
 """Test the that SBBreakpoint callback is invoked when a breakpoint is 
hit. """
 self.build_and_test('driver.cpp test_breakpoint_callback.cpp',
@@ -30,6 +31,7 @@ class SBBreakpointCallbackCase(TestBase)
 @skipIfRemote
 @skipIfNoSBHeaders
 @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", 
compiler_version=[">=","4.9"], archs=["x86_64"])
+@expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support 
throw or catch
 def test_sb_api_listener_event_description(self):
 """ Test the description of an SBListener breakpoint event is valid."""
 self.build_and_test('driver.cpp listener_test.cpp 
test_listener_event_description.cpp',
@@ -40,6 +42,7 @@ class SBBreakpointCallbackCase(TestBase)
 @skipIfNoSBHeaders
 @expectedFlakeyLinux # Driver occasionally returns '1' as exit status
 @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", 
compiler_version=[">=","4.9"], archs=["x86_64"])
+@expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support 
throw or catch
 def test_sb_api_listener_event_process_state(self):
 """ Test that a registered SBListener receives events when a process
 changes state.
@@ -52,6 +55,7 @@ class SBBreakpointCallbackCase(TestBase)
 @skipIfRemote
 @skipIfNoSBHeaders
 @expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", 
compiler_version=[">=","4.8"], archs=["x86_64"])
+@expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support 
throw or catch
 def test_sb_api_listener_resume(self):
 """ Test that a process can be resumed from a non-main thread. """
 self.build_and_test('driver.cpp listener_test.cpp 
test_listener_resume.cpp',

Modified: 
lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py?rev=245747&r1=245746&r2=245747&view=diff
==
--- 
lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
 (original)
+++ 
lldb/trunk/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
 Fri Aug 21 17:11:09 2015
@@ -23,6 +23,7 @@ class TestCPPExceptionBreakpoint (TestBa
 self.do_cpp_exception_bkpt ()
 
 @python_api_test
+@expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support 
throw or catch
 @dwarf_test
 def test_cpp_exception_breakpoint_with_dwarf(self):
 """Test setting and hitting the C++ exception breakpoint."""

Modified: lldb/trunk/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py?rev=245747&r1=245746&r2=245747&view=diff
==
--- lldb/trunk/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py 
(original)
+++ lldb/trunk/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py Fri Aug 
21 17:11:09 2015
@@ -20,6 +20,7 @@ class CPPBreakpointTestCase(TestBase):
 self.cpp_exceptions()
 
 @dwarf_test
+@expectedFailureWindows("llvm.org/pr24538") # clang-cl does not support 
throw or catch
 def test_with_dwarf(self):
 """Test lldb exception breakpoint command for CPP."""
 self.buildDwarf()


___
lldb-commits mailing list
lldb-commits@lists.llvm.org

[Lldb-commits] [lldb] r245750 - Fix TestPaths on Windows.

2015-08-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Aug 21 17:11:40 2015
New Revision: 245750

URL: http://llvm.org/viewvc/llvm-project?rev=245750&view=rev
Log:
Fix TestPaths on Windows.

Modified:
lldb/trunk/test/functionalities/paths/TestPaths.py

Modified: lldb/trunk/test/functionalities/paths/TestPaths.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/paths/TestPaths.py?rev=245750&r1=245749&r2=245750&view=diff
==
--- lldb/trunk/test/functionalities/paths/TestPaths.py (original)
+++ lldb/trunk/test/functionalities/paths/TestPaths.py Fri Aug 21 17:11:40 2015
@@ -39,8 +39,8 @@ class TestPaths(TestBase):
 '''Test to check the path with double slash is handled correctly '''
 # Create a path and see if lldb gets the directory and file right
 fspec = lldb.SBFileSpec("C:\\dummy1\\dummy2//unknown_file", True);
-self.assertTrue (fspec.GetDirectory() == "C:/dummy1/dummy2");
-self.assertTrue (fspec.GetFilename() == "unknown_file");
+self.assertEqual(os.path.normpath(fspec.GetDirectory()), 
os.path.normpath("C:/dummy1/dummy2"));
+self.assertEqual(fspec.GetFilename(), "unknown_file");
 
 if __name__ == '__main__':
 import atexit


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


[Lldb-commits] [lldb] r245751 - XFAIL pthreads test on Windows.

2015-08-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Aug 21 17:11:50 2015
New Revision: 245751

URL: http://llvm.org/viewvc/llvm-project?rev=245751&view=rev
Log:
XFAIL pthreads test on Windows.

This test needs to be ported to c++ threads.

Modified:
lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py

Modified: 
lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py?rev=245751&r1=245750&r2=245751&view=diff
==
--- lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py 
(original)
+++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py 
Fri Aug 21 17:11:50 2015
@@ -25,6 +25,7 @@ class ExprDoesntDeadlockTestCase(TestBas
 @dwarf_test
 @expectedFailureFreeBSD('llvm.org/pr17946')
 @expectedFlakeyLinux # failed 1/365 test runs, line 61, thread.IsValid()
+@expectedFailureWindows # Windows doesn't have pthreads, need to port this 
test.
 def test_with_dwarf_and_run_command(self):
 """Test that expr will time out and allow other threads to run if it 
blocks."""
 self.buildDwarf()


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


[Lldb-commits] [lldb] r245749 - XFAIL the last Windows test that calls a function in the target.

2015-08-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Aug 21 17:11:31 2015
New Revision: 245749

URL: http://llvm.org/viewvc/llvm-project?rev=245749&view=rev
Log:
XFAIL the last Windows test that calls a function in the target.

Modified:
lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py

Modified: lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py?rev=245749&r1=245748&r2=245749&view=diff
==
--- lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py (original)
+++ lldb/trunk/test/lang/cpp/static_methods/TestCPPStaticMethods.py Fri Aug 21 
17:11:31 2015
@@ -18,6 +18,7 @@ class CPPStaticMethodsTestCase(TestBase)
 self.static_method_commands()
 
 @dwarf_test
+@expectedFailureWindows
 def test_with_dwarf_and_run_command(self):
 """Test that static methods are properly distinguished from regular 
methods"""
 self.buildDwarf()


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


Re: [Lldb-commits] [PATCH] D12252: Reorg code to allow Windows Process Plugins to share some common code.

2015-08-21 Thread Zachary Turner via lldb-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

Looks good.  I'm guessing that at some point the RegisterContext and 
ExceptionRecord stuff will be moved to Common?


http://reviews.llvm.org/D12252



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


[Lldb-commits] [lldb] r245765 - Revert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD."

2015-08-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Aug 21 18:57:25 2015
New Revision: 245765

URL: http://llvm.org/viewvc/llvm-project?rev=245765&view=rev
Log:
Revert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD."

This reverts commit 7749a10ddbe22767d0e055753c674fcde7f28d39.

This commit introduces about 15-20 new test failures with windows local
targets.

Modified:

lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp?rev=245765&r1=245764&r2=245765&view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
 Fri Aug 21 18:57:25 2015
@@ -9,7 +9,6 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
-#include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
@@ -73,38 +72,11 @@ DynamicLoaderWindowsDYLD::CreateInstance
 void
 DynamicLoaderWindowsDYLD::DidAttach()
 {
-Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-if (log)
-log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
-
-DidLaunch();
-
-m_process->LoadModules();
 }
 
 void
 DynamicLoaderWindowsDYLD::DidLaunch()
 {
-Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-if (log)
-log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
-
-ModuleSP executable = GetTargetExecutable();
-
-if (!executable.get())
-return;
-
-ModuleList module_list;
-module_list.Append(executable);
-// FIXME: We probably should not always use 0 as the load address
-// here. Testing showed that when debugging a process that we start
-// ourselves, there's no randomization of the load address of the
-// main module, therefore an offset of 0 will be valid.
-// If we attach to an already running process, this is probably
-// going to be wrong and we'll have to get the load address somehow.
-UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
-
-m_process->GetTarget().ModulesDidLoad(module_list);
 }
 
 Error


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


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Zachary Turner via lldb-commits
Hi Stephane, I'm sorry but I had to revert this change.  When I tested it
locally, I did it without running the full test suite, but when I did run
the full test suite it showed about 15-20 new test failures.  I should have
caught this earlier by running the full test suite, so sorry about that.

I'm not 100% sure what the cause of the failure is, but I suspect it could
be related to DynamicLoaderWindows adding modules to the list *and*
ProcessWindows adding modules to the list as well.

If you need help setting up a Windows machine to test this on let me know.
Unfortunately it's not that trivial, but luckily once you get it set up and
correctly configured it becomes pretty easy to keep it going smoothly.

Let me know if you need more information.

On Fri, Aug 21, 2015 at 12:29 PM Stephane Sezer  wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL245725: Implement basic DidAttach and DidLaunch for
> DynamicLoaderWindowsDYLD. (authored by sas).
>
> Changed prior to commit:
>   http://reviews.llvm.org/D12245?vs=32842&id=32853#toc
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D12245
>
> Files:
>
> lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
>
> Index:
> lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
> ===
> ---
> lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
> +++
> lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
> @@ -9,6 +9,7 @@
>
>  #include "DynamicLoaderWindowsDYLD.h"
>
> +#include "lldb/Core/Log.h"
>  #include "lldb/Core/PluginManager.h"
>  #include "lldb/Target/Process.h"
>  #include "lldb/Target/Target.h"
> @@ -72,11 +73,38 @@
>  void
>  DynamicLoaderWindowsDYLD::DidAttach()
>  {
> +Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
> +if (log)
> +log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
> +
> +DidLaunch();
> +
> +m_process->LoadModules();
>  }
>
>  void
>  DynamicLoaderWindowsDYLD::DidLaunch()
>  {
> +Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
> +if (log)
> +log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
> +
> +ModuleSP executable = GetTargetExecutable();
> +
> +if (!executable.get())
> +return;
> +
> +ModuleList module_list;
> +module_list.Append(executable);
> +// FIXME: We probably should not always use 0 as the load address
> +// here. Testing showed that when debugging a process that we start
> +// ourselves, there's no randomization of the load address of the
> +// main module, therefore an offset of 0 will be valid.
> +// If we attach to an already running process, this is probably
> +// going to be wrong and we'll have to get the load address somehow.
> +UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
> +
> +m_process->GetTarget().ModulesDidLoad(module_list);
>  }
>
>  Error
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Zachary Turner via lldb-commits
By the way, I'm actively working on getting the test suite completely
running on a buildbot, but I need to get down to a green baseline first.
Still a few weeks out, but hopefully this type of thing will be caught
automatically in the future.

On Fri, Aug 21, 2015 at 5:00 PM Zachary Turner  wrote:

> Hi Stephane, I'm sorry but I had to revert this change.  When I tested it
> locally, I did it without running the full test suite, but when I did run
> the full test suite it showed about 15-20 new test failures.  I should have
> caught this earlier by running the full test suite, so sorry about that.
>
> I'm not 100% sure what the cause of the failure is, but I suspect it could
> be related to DynamicLoaderWindows adding modules to the list *and*
> ProcessWindows adding modules to the list as well.
>
> If you need help setting up a Windows machine to test this on let me
> know.  Unfortunately it's not that trivial, but luckily once you get it set
> up and correctly configured it becomes pretty easy to keep it going
> smoothly.
>
> Let me know if you need more information.
>
> On Fri, Aug 21, 2015 at 12:29 PM Stephane Sezer  wrote:
>
>> This revision was automatically updated to reflect the committed changes.
>> Closed by commit rL245725: Implement basic DidAttach and DidLaunch for
>> DynamicLoaderWindowsDYLD. (authored by sas).
>>
>> Changed prior to commit:
>>   http://reviews.llvm.org/D12245?vs=32842&id=32853#toc
>>
>> Repository:
>>   rL LLVM
>>
>> http://reviews.llvm.org/D12245
>>
>> Files:
>>
>> lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
>>
>> Index:
>> lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
>> ===
>> ---
>> lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
>> +++
>> lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
>> @@ -9,6 +9,7 @@
>>
>>  #include "DynamicLoaderWindowsDYLD.h"
>>
>> +#include "lldb/Core/Log.h"
>>  #include "lldb/Core/PluginManager.h"
>>  #include "lldb/Target/Process.h"
>>  #include "lldb/Target/Target.h"
>> @@ -72,11 +73,38 @@
>>  void
>>  DynamicLoaderWindowsDYLD::DidAttach()
>>  {
>> +Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
>> +if (log)
>> +log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
>> +
>> +DidLaunch();
>> +
>> +m_process->LoadModules();
>>  }
>>
>>  void
>>  DynamicLoaderWindowsDYLD::DidLaunch()
>>  {
>> +Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
>> +if (log)
>> +log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
>> +
>> +ModuleSP executable = GetTargetExecutable();
>> +
>> +if (!executable.get())
>> +return;
>> +
>> +ModuleList module_list;
>> +module_list.Append(executable);
>> +// FIXME: We probably should not always use 0 as the load address
>> +// here. Testing showed that when debugging a process that we start
>> +// ourselves, there's no randomization of the load address of the
>> +// main module, therefore an offset of 0 will be valid.
>> +// If we attach to an already running process, this is probably
>> +// going to be wrong and we'll have to get the load address somehow.
>> +UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, 0);
>> +
>> +m_process->GetTarget().ModulesDidLoad(module_list);
>>  }
>>
>>  Error
>>
>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12245: Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD.

2015-08-21 Thread Stephane Sezer via lldb-commits
sas added a comment.

Not a problem at all. Sorry for breaking the tests.

I'm setting up a Windows VM now to be able to run these tests. I'll let you 
know if I'm stuck.


Repository:
  rL LLVM

http://reviews.llvm.org/D12245



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