Re: [Lldb-commits] [PATCH] D14226: Fix to solve Bug 23139 & Bug 23560

2015-11-12 Thread Abhishek via lldb-commits
abhishek.aggarwal updated this revision to Diff 40013.
abhishek.aggarwal added a comment.

Used Assert instead of If condition


http://reviews.llvm.org/D14226

Files:
  packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
  packages/Python/lldbsuite/test/expression_command/test/TestExprs.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
  
packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
  
packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
  
packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
  packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
  packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
  packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
  source/Plugins/Process/Utility/UnwindLLDB.cpp
  source/Plugins/Process/Utility/UnwindLLDB.h

Index: source/Plugins/Process/Utility/UnwindLLDB.h
===
--- source/Plugins/Process/Utility/UnwindLLDB.h
+++ source/Plugins/Process/Utility/UnwindLLDB.h
@@ -136,6 +136,15 @@
  
 std::vector m_user_supplied_trap_handler_functions;
 
+//-
+// Check if Full UnwindPlan of First frame is valid or not.
+// If not then try Fallback UnwindPlan of the frame. If Fallback
+// UnwindPlan succeeds then update the Full UnwindPlan with the
+// Fallback UnwindPlan.
+//-
+void
+UpdateUnwindPlanForFirstFrameIfInvalid (ABI* abi);
+
 CursorSP
 GetOneMoreFrame (ABI* abi);
 
Index: source/Plugins/Process/Utility/UnwindLLDB.cpp
===
--- source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -86,6 +86,9 @@
 if (m_frames.size() > 0)
 return true;
 
+ProcessSP process_sp (m_thread.GetProcess());
+ABI *abi = process_sp ? process_sp->GetABI().get() : NULL;
+
 // First, set up the 0th (initial) frame
 CursorSP first_cursor_sp(new Cursor ());
 RegisterContextLLDBSP reg_ctx_sp (new RegisterContextLLDB (m_thread, 
@@ -108,6 +111,10 @@
 // cursor own it in its shared pointer
 first_cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
 m_frames.push_back (first_cursor_sp);
+
+// Update the Full Unwind Plan for this frame if not valid
+UpdateUnwindPlanForFirstFrameIfInvalid(abi);
+
 return true;
 
 unwind_done:
@@ -161,7 +168,14 @@
 // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to that and return
 // true.  Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to be updated. Hence updating it.
+if ( !(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa)))
+return nullptr;
+
 return GetOneMoreFrame (abi);
+}
 
 if (log)
 log->Printf ("%*sFrame %d did not get a RegisterContext, stopping.",
@@ -175,7 +189,14 @@
 // See if the regctx below this on the stack has a fallback unwind plan it can use.
 // Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to be updated. Hence updating it.
+if ( !(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa)))
+return nullptr;
+
 return GetOneMoreFrame (abi);
+}
 
 if (log)
 log->Printf("%*sFrame %d invalid RegisterContext for this frame, stopping stack walk", 
@@ -187,7 +208,14 @@
 // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to that and return
 // true.  Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to be updated. Hence updating it.
+if ( !(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa)))
+return nullptr;
+
 return GetOneMoreFrame (abi);
+}
 
 if (log)
 log->Printf("%*sFrame %d did not get CFA for this frame, stopping stack walk",
@@ -212,7 +240,14 

Re: [Lldb-commits] [PATCH] D14226: Fix to solve Bug 23139 & Bug 23560

2015-11-12 Thread Abhishek via lldb-commits
abhishek.aggarwal updated this revision to Diff 40014.
abhishek.aggarwal added a comment.

Removed log and inserted statement terminator


http://reviews.llvm.org/D14226

Files:
  packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
  packages/Python/lldbsuite/test/expression_command/test/TestExprs.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
  
packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
  
packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
  
packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
  packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
  packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
  packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
  source/Plugins/Process/Utility/UnwindLLDB.cpp
  source/Plugins/Process/Utility/UnwindLLDB.h

Index: source/Plugins/Process/Utility/UnwindLLDB.h
===
--- source/Plugins/Process/Utility/UnwindLLDB.h
+++ source/Plugins/Process/Utility/UnwindLLDB.h
@@ -136,6 +136,15 @@
  
 std::vector m_user_supplied_trap_handler_functions;
 
+//-
+// Check if Full UnwindPlan of First frame is valid or not.
+// If not then try Fallback UnwindPlan of the frame. If Fallback
+// UnwindPlan succeeds then update the Full UnwindPlan with the
+// Fallback UnwindPlan.
+//-
+void
+UpdateUnwindPlanForFirstFrameIfInvalid (ABI* abi);
+
 CursorSP
 GetOneMoreFrame (ABI* abi);
 
Index: source/Plugins/Process/Utility/UnwindLLDB.cpp
===
--- source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -86,6 +86,9 @@
 if (m_frames.size() > 0)
 return true;
 
+ProcessSP process_sp (m_thread.GetProcess());
+ABI *abi = process_sp ? process_sp->GetABI().get() : NULL;
+
 // First, set up the 0th (initial) frame
 CursorSP first_cursor_sp(new Cursor ());
 RegisterContextLLDBSP reg_ctx_sp (new RegisterContextLLDB (m_thread, 
@@ -108,6 +111,10 @@
 // cursor own it in its shared pointer
 first_cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
 m_frames.push_back (first_cursor_sp);
+
+// Update the Full Unwind Plan for this frame if not valid
+UpdateUnwindPlanForFirstFrameIfInvalid(abi);
+
 return true;
 
 unwind_done:
@@ -161,7 +168,14 @@
 // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to that and return
 // true.  Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to be updated. Hence updating it.
+if ( !(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa)))
+return nullptr;
+
 return GetOneMoreFrame (abi);
+}
 
 if (log)
 log->Printf ("%*sFrame %d did not get a RegisterContext, stopping.",
@@ -175,7 +189,14 @@
 // See if the regctx below this on the stack has a fallback unwind plan it can use.
 // Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to be updated. Hence updating it.
+if ( !(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa)))
+return nullptr;
+
 return GetOneMoreFrame (abi);
+}
 
 if (log)
 log->Printf("%*sFrame %d invalid RegisterContext for this frame, stopping stack walk", 
@@ -187,7 +208,14 @@
 // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to that and return
 // true.  Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to be updated. Hence updating it.
+if ( !(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa)))
+return nullptr;
+
 return GetOneMoreFrame (abi);
+}
 
 if (log)
 log->Printf("%*sFrame %d did not get CFA for this frame, stopping stack walk",
@@ -212,

Re: [Lldb-commits] [PATCH] D14226: Fix to solve Bug 23139 & Bug 23560

2015-11-12 Thread Abhishek via lldb-commits
abhishek.aggarwal added a comment.

Hello Jason

No problem regarding the delay. Thanks a lot for reviewing the patch. I have 
made the changes as suggested by you. I will land it now.


http://reviews.llvm.org/D14226



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


Re: [Lldb-commits] [PATCH] D14226: Fix to solve Bug 23139 & Bug 23560

2015-11-13 Thread Abhishek via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253026: Fix to solve Bug 23139 & Bug 23560 (authored by 
Abhishek).

Changed prior to commit:
  http://reviews.llvm.org/D14226?vs=40014&id=40127#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14226

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
  lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
  lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h

Index: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
===
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
@@ -136,6 +136,15 @@
  
 std::vector m_user_supplied_trap_handler_functions;
 
+//-
+// Check if Full UnwindPlan of First frame is valid or not.
+// If not then try Fallback UnwindPlan of the frame. If Fallback
+// UnwindPlan succeeds then update the Full UnwindPlan with the
+// Fallback UnwindPlan.
+//-
+void
+UpdateUnwindPlanForFirstFrameIfInvalid (ABI* abi);
+
 CursorSP
 GetOneMoreFrame (ABI* abi);
 
Index: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
===
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -86,6 +86,9 @@
 if (m_frames.size() > 0)
 return true;
 
+ProcessSP process_sp (m_thread.GetProcess());
+ABI *abi = process_sp ? process_sp->GetABI().get() : NULL;
+
 // First, set up the 0th (initial) frame
 CursorSP first_cursor_sp(new Cursor ());
 RegisterContextLLDBSP reg_ctx_sp (new RegisterContextLLDB (m_thread, 
@@ -108,6 +111,10 @@
 // cursor own it in its shared pointer
 first_cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
 m_frames.push_back (first_cursor_sp);
+
+// Update the Full Unwind Plan for this frame if not valid
+UpdateUnwindPlanForFirstFrameIfInvalid(abi);
+
 return true;
 
 unwind_done:
@@ -161,7 +168,14 @@
 // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to that and return
 // true.  Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to be updated. Hence updating it.
+if ( !(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa)))
+return nullptr;
+
 return GetOneMoreFrame (abi);
+}
 
 if (log)
 log->Printf ("%*sFrame %d did not get a RegisterContext, stopping.",
@@ -175,7 +189,14 @@
 // See if the regctx below this on the stack has a fallback unwind plan it can use.
 // Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to be updated. Hence updating it.
+if ( !(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa)))
+return nullptr;
+
 return GetOneMoreFrame (abi);
+}
 
 if (log)
 log->Printf("%*sFrame %d invalid RegisterContext for this frame, stopping stack walk", 
@@ -187,7 +208,14 @@
 // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to that and return
 // true.  Subsequent calls to TryFallbackUnwindPlan() will return false.
 if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan())
+{
+// TryFallbackUnwindPlan for prev_frame succeeded and updated reg_ctx_lldb_sp field of
+// prev_frame. However, cfa field of prev_frame still needs to

Re: [Lldb-commits] [PATCH] D15042: PTRACE ABI to read FXSAVE area for 32-bit inferior

2015-11-30 Thread Abhishek via lldb-commits
abhishek.aggarwal updated this revision to Diff 41382.
abhishek.aggarwal added a comment.

Removed assert if ptrace API fails


http://reviews.llvm.org/D15042

Files:
  packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
  source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp

Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -327,6 +327,9 @@
 #ifndef NT_X86_XSTATE
 #define NT_X86_XSTATE 0x202
 #endif
+#ifndef NT_PRXFPREG
+#define NT_PRXFPREG 0x46e62b7f
+#endif
 
 NativeRegisterContextLinux*
 NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(const 
ArchSpec& target_arch,
@@ -868,10 +871,24 @@
 NativeRegisterContextLinux_x86_64::WriteFPR()
 {
 const FPRType fpr_type = GetFPRType ();
+const lldb_private::ArchSpec& target_arch = 
GetRegisterInfoInterface().GetTargetArchitecture();
 switch (fpr_type)
 {
 case FPRType::eFPRTypeFXSAVE:
-return NativeRegisterContextLinux::WriteFPR();
+// For 32-bit inferiors on x86_32/x86_64 architectures,
+// FXSAVE area can be written using PTRACE_SETREGSET ptrace api
+// For 64-bit inferiors on x86_64 architectures,
+// FXSAVE area can be written using PTRACE_SETFPREGS ptrace api
+switch (target_arch.GetMachine ())
+{
+case llvm::Triple::x86:
+return WriteRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), 
NT_PRXFPREG);
+case llvm::Triple::x86_64:
+return NativeRegisterContextLinux::WriteFPR();
+default:
+assert(false && "Unhandled target architecture.");
+break;
+}
 case FPRType::eFPRTypeXSAVE:
 return WriteRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), 
NT_X86_XSTATE);
 default:
@@ -980,10 +997,24 @@
 NativeRegisterContextLinux_x86_64::ReadFPR ()
 {
 const FPRType fpr_type = GetFPRType ();
+const lldb_private::ArchSpec& target_arch = 
GetRegisterInfoInterface().GetTargetArchitecture();
 switch (fpr_type)
 {
 case FPRType::eFPRTypeFXSAVE:
-return NativeRegisterContextLinux::ReadFPR();
+// For 32-bit inferiors on x86_32/x86_64 architectures,
+// FXSAVE area can be read using PTRACE_GETREGSET ptrace api
+// For 64-bit inferiors on x86_64 architectures,
+// FXSAVE area can be read using PTRACE_GETFPREGS ptrace api
+switch (target_arch.GetMachine ())
+{
+case llvm::Triple::x86:
+return ReadRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), 
NT_PRXFPREG);
+case llvm::Triple::x86_64:
+return NativeRegisterContextLinux::ReadFPR();
+default:
+assert(false && "Unhandled target architecture.");
+break;
+}
 case FPRType::eFPRTypeXSAVE:
 return ReadRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), 
NT_X86_XSTATE);
 default:
Index: 
packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
===
--- 
packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
+++ 
packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
@@ -16,7 +16,7 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-@expectedFailurei386
+@expectedFailureAll(oslist=["macosx","freebsd"], archs=["i386"])
 @expectedFailureWindows("llvm.org/pr24778")
 @add_test_categories(['pyapi'])
 def test_with_python(self):


Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -327,6 +327,9 @@
 #ifndef NT_X86_XSTATE
 #define NT_X86_XSTATE 0x202
 #endif
+#ifndef NT_PRXFPREG
+#define NT_PRXFPREG 0x46e62b7f
+#endif
 
 NativeRegisterContextLinux*
 NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(const ArchSpec& target_arch,
@@ -868,10 +871,24 @@
 NativeRegisterContextLinux_x86_64::WriteFPR()
 {
 const FPRType fpr_type = GetFPRType ();
+const lldb_private::ArchSpec& target_arch = GetRegisterInfoInterface().GetTargetArchitecture();
 switch (fpr_type)
 {
 case FPRType::eFPRTypeFXSAVE:
-return NativeRegisterContextLinux::WriteFPR();
+// For 32-bit inferiors on x86_32/x86_64 architectures,
+// FXSAVE area can be written using PTRACE_SETREGSET ptrace api
+// For 64-bit inferiors on x86_64 architectures,
+// FXSAVE area can be written using PTRACE_SETFPREGS ptrace api
+switch (target_arch.GetMachine ())
+   

Re: [Lldb-commits] [PATCH] D15042: PTRACE ABI to read FXSAVE area for 32-bit inferior

2015-12-01 Thread Abhishek via lldb-commits
abhishek.aggarwal added a comment.

Hello Greg

Is there anyone else , except the reviewers already included for the patch, I 
should put as the reviewer for this patch ?


http://reviews.llvm.org/D15042



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


Re: [Lldb-commits] [PATCH] D15042: PTRACE ABI to read FXSAVE area for 32-bit inferior

2015-12-01 Thread Abhishek via lldb-commits
abhishek.aggarwal updated this revision to Diff 41489.
abhishek.aggarwal added a comment.

Added Loggings

An indication through logs in case ptrace API fails
 to read FXSAVE/XSAVE area.


http://reviews.llvm.org/D15042

Files:
  packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
  source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp

Index: source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
===
--- source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -327,6 +327,9 @@
 #ifndef NT_X86_XSTATE
 #define NT_X86_XSTATE 0x202
 #endif
+#ifndef NT_PRXFPREG
+#define NT_PRXFPREG 0x46e62b7f
+#endif
 
 NativeRegisterContextLinux*
 NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(const ArchSpec& target_arch,
@@ -832,6 +835,7 @@
 NativeRegisterContextLinux_x86_64::FPRType
 NativeRegisterContextLinux_x86_64::GetFPRType () const
 {
+Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 if (m_fpr_type == eFPRTypeNotValid)
 {
 // TODO: Use assembly to call cpuid on the inferior and query ebx or ecx.
@@ -842,9 +846,15 @@
 {
 // Fall back to general floating point with no AVX support.
 m_fpr_type = eFPRTypeFXSAVE;
+
+// Check if FXSAVE area can be read.
+if (const_cast(this)->ReadFPR().Fail())
+{
+if (log)
+log->Printf("NativeRegisterContextLinux_x86_64::%s ptrace APIs failed to read XSAVE/FXSAVE area", __FUNCTION__);
+}
 }
 }
-
 return m_fpr_type;
 }
 
@@ -868,10 +878,24 @@
 NativeRegisterContextLinux_x86_64::WriteFPR()
 {
 const FPRType fpr_type = GetFPRType ();
+const lldb_private::ArchSpec& target_arch = GetRegisterInfoInterface().GetTargetArchitecture();
 switch (fpr_type)
 {
 case FPRType::eFPRTypeFXSAVE:
-return NativeRegisterContextLinux::WriteFPR();
+// For 32-bit inferiors on x86_32/x86_64 architectures,
+// FXSAVE area can be written using PTRACE_SETREGSET ptrace api
+// For 64-bit inferiors on x86_64 architectures,
+// FXSAVE area can be written using PTRACE_SETFPREGS ptrace api
+switch (target_arch.GetMachine ())
+{
+case llvm::Triple::x86:
+return WriteRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), NT_PRXFPREG);
+case llvm::Triple::x86_64:
+return NativeRegisterContextLinux::WriteFPR();
+default:
+assert(false && "Unhandled target architecture.");
+break;
+}
 case FPRType::eFPRTypeXSAVE:
 return WriteRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
 default:
@@ -980,10 +1004,24 @@
 NativeRegisterContextLinux_x86_64::ReadFPR ()
 {
 const FPRType fpr_type = GetFPRType ();
+const lldb_private::ArchSpec& target_arch = GetRegisterInfoInterface().GetTargetArchitecture();
 switch (fpr_type)
 {
 case FPRType::eFPRTypeFXSAVE:
-return NativeRegisterContextLinux::ReadFPR();
+// For 32-bit inferiors on x86_32/x86_64 architectures,
+// FXSAVE area can be read using PTRACE_GETREGSET ptrace api
+// For 64-bit inferiors on x86_64 architectures,
+// FXSAVE area can be read using PTRACE_GETFPREGS ptrace api
+switch (target_arch.GetMachine ())
+{
+case llvm::Triple::x86:
+return ReadRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), NT_PRXFPREG);
+case llvm::Triple::x86_64:
+return NativeRegisterContextLinux::ReadFPR();
+default:
+assert(false && "Unhandled target architecture.");
+break;
+}
 case FPRType::eFPRTypeXSAVE:
 return ReadRegisterSet(&m_iovec, sizeof(m_fpr.xstate.xsave), NT_X86_XSTATE);
 default:
Index: packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
===
--- packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
+++ packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
@@ -16,7 +16,7 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-@expectedFailurei386
+@expectedFailureAll(oslist=["macosx","freebsd"], archs=["i386"])
 @expectedFailureWindows("llvm.org/pr24778")
 @add_test_categories(['pyapi'])
 def test_with_python(self):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D15042: PTRACE ABI to read FXSAVE area for 32-bit inferior

2015-12-01 Thread Abhishek via lldb-commits
abhishek.aggarwal added a comment.

Hi Pavel and Tamas

I enabled logs in case ptrace API fails to read FXSAVE/XSAVE area. This will 
serve as an indicator to find the reason of failure if register read fails.


http://reviews.llvm.org/D15042



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


Re: [Lldb-commits] [PATCH] D15042: PTRACE ABI to read FXSAVE area for 32-bit inferior

2015-12-01 Thread Abhishek via lldb-commits
abhishek.aggarwal added a comment.

Comments Inlined.



Comment at: 
source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp:853-854
@@ +852,4 @@
+{
+if (log)
+log->Printf("NativeRegisterContextLinux_x86_64::%s ptrace 
APIs failed to read XSAVE/FXSAVE area", __FUNCTION__);
+}

tberghammer wrote:
> Adding a log message is a good idea but please include the error message from 
> ReadFPR in the log message. It will usually contain the error message 
> returned by the ptrace call.
Error message from ReadFPR along with the error number (in case ptrace API 
fails) are displayed during call of NativeProcessLinux::PtraceWrapper(). Hence, 
to avoid multiplicity, I didn't include it here. The Log message I included is 
an additional information regarding ptrace API failure. 


http://reviews.llvm.org/D15042



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


Re: [Lldb-commits] [PATCH] D22863: Improve code of loading plugins that provide cmnds

2016-07-28 Thread Abhishek via lldb-commits
abhishek.aggarwal added a comment.

Hi Greg

Please find my comments inlined. Let me know if I am missing something here.



Comment at: include/lldb/API/SBCommandInterpreter.h:141-142
@@ -140,4 +140,4 @@
 
 lldb::SBCommand
-AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const 
char* help);
+AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const 
char* help, const char* syntax);
 

clayborg wrote:
> You can't change public API, you can only add to it. Just add another 
> function with syntax and leave the other one alone.
After reading your review, I suggest to keep the following prototype of this 
function:

AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const char* 
help, const char* syntax = nullptr);

This will not break anyone's plugins written with old version of lldb shared 
library as syntax will be an optional argument.
This way, we will not need to add another API in this class thereby keeping the 
public APIs as minimal as possible and complete at the same time.

Please let me know if this fits our public API development conditions. Else I 
will add another variant of AddCommand API with syntax argument.


Comment at: include/lldb/API/SBCommandInterpreter.h:270
@@ -269,2 +269,3 @@
char** /*command*/,
+   size_t /*number of arguments*/,
lldb::SBCommandReturnObject & /*result*/)

clayborg wrote:
> Since this is a special class that does use virtual functions that is in the 
> public API, you can't change it. Previous code might have linked against the 
> LLDB shared library and changing this would break those plug-ins and they 
> would install their new implementation in the vtable slot for this function 
> and it would be called incorrectly. Revert this change. 
I will do it.


Comment at: include/lldb/API/SBCommandInterpreter.h:310
@@ -308,3 +309,3 @@
 lldb::SBCommand
-AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const 
char* help = nullptr);
+AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const 
char* help = nullptr, const char* syntax = nullptr);
 

clayborg wrote:
> You can't change public API, you can only add to it. Just add another 
> function with syntax and leave the other one alone.
Same comment as for SBCommandInterpreter::AddCommand API above

This will not break anyone's plugins written with old version of lldb shared 
library as syntax is an optional argument.
This way, we will not need to add another API in this class thereby keeping the 
public APIs as minimal as possible and complete at the same time.


Comment at: 
packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp:37
@@ -36,2 +36,3 @@
char** command,
+   size_t arg_count,
lldb::SBCommandReturnObject &result)

clayborg wrote:
> revert
Will do it.


Comment at: source/API/SBCommandInterpreter.cpp:152
@@ -151,3 +151,3 @@
 SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
-bool ret = m_backend->DoExecute 
(debugger_sb,(char**)command.GetArgumentVector(), sb_return);
+bool ret = m_backend->DoExecute 
(debugger_sb,(char**)command.GetArgumentVector(),command.GetArgumentCount(), 
sb_return);
 sb_return.Release();

clayborg wrote:
> Remove count, revert this line.
Will do it.


Comment at: source/API/SBCommandInterpreter.cpp:156
@@ -155,3 +155,3 @@
 }
-lldb::SBCommandPluginInterface* m_backend;
+std::shared_ptr m_backend;
 };

clayborg wrote:
> Can't change public API, revert this. This would break anyone's existing 
> commands as the layout of this class would change and possibly break and code 
> that links against this.
Few points which I want to say here:

1. class CommandPluginInterfaceImplementation is completely a part of 
implementation file and is not present in any public interface file. Hence, any 
API of this class will never be exposed to lldb shared library users.


2. I referring to  
packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp file 
as an example.
In lldb::PluginInitialize() function the ChildCommand instance is 
dynamically allocated and a pointer to this instance will be copied to 
m_backend data member of  CommandPluginInterfaceImplementation class. However, 
no one is freeing this dynamically allocated memory leading to memory leaks. I 
believe anyone who would have written plugins using this approach will be 
leaking memory as I just explained. In my opinion it is a bug and for this we 
need to change this pointer to a shared pointer.

Please let me know if I am missing something here.


Comment at: source/API/SBCommandInterpreter.cpp:598
@@ -597,3 +597,3 @@
 lldb::SBCom

Re: [Lldb-commits] [PATCH] D22863: Improve code of loading plugins that provide cmnds

2016-07-28 Thread Abhishek via lldb-commits
abhishek.aggarwal added inline comments.


Comment at: include/lldb/API/SBCommandInterpreter.h:141-142
@@ -140,4 +140,4 @@
 
 lldb::SBCommand
-AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const 
char* help);
+AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const 
char* help, const char* syntax);
 

labath wrote:
> abhishek.aggarwal wrote:
> > clayborg wrote:
> > > You can't change public API, you can only add to it. Just add another 
> > > function with syntax and leave the other one alone.
> > After reading your review, I suggest to keep the following prototype of 
> > this function:
> > 
> > AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const 
> > char* help, const char* syntax = nullptr);
> > 
> > This will not break anyone's plugins written with old version of lldb 
> > shared library as syntax will be an optional argument.
> > This way, we will not need to add another API in this class thereby keeping 
> > the public APIs as minimal as possible and complete at the same time.
> > 
> > Please let me know if this fits our public API development conditions. Else 
> > I will add another variant of AddCommand API with syntax argument.
> We are trying to maintain binary compatibility. So, while your proposal 
> maintains source-code level compatibilty, it will still break precompiled 
> binaries, as the mangled function name changes.
> 
> 
Thanks for the clarification. Any comments in SBCommandInterpreter.cpp file for 
changing m_backend data member of CommandPluginInterfaceImplementation class to 
a shared pointer?


https://reviews.llvm.org/D22863



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


Re: [Lldb-commits] [PATCH] D22863: Improve code of loading plugins that provide cmnds

2016-07-28 Thread Abhishek via lldb-commits
abhishek.aggarwal updated this revision to Diff 65903.
abhishek.aggarwal added a comment.

New patch according to review feedback

- Added another variant of AddCommand API with syntax as an additional argument


https://reviews.llvm.org/D22863

Files:
  include/lldb/API/SBCommandInterpreter.h
  source/API/SBCommandInterpreter.cpp

Index: source/API/SBCommandInterpreter.cpp
===
--- source/API/SBCommandInterpreter.cpp
+++ source/API/SBCommandInterpreter.cpp
@@ -153,7 +153,7 @@
 sb_return.Release();
 return ret;
 }
-lldb::SBCommandPluginInterface* m_backend;
+std::shared_ptr m_backend;
 };
 
 SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
@@ -605,6 +605,17 @@
 return lldb::SBCommand();
 }
 
+lldb::SBCommand
+SBCommandInterpreter::AddCommand (const char* name, 
lldb::SBCommandPluginInterface* impl, const char* help, const char* syntax)
+{
+lldb::CommandObjectSP new_command_sp;
+new_command_sp.reset(new 
CommandPluginInterfaceImplementation(*m_opaque_ptr,name, impl, help, syntax));
+
+if (new_command_sp && m_opaque_ptr->AddUserCommand(name, new_command_sp, 
true))
+return lldb::SBCommand(new_command_sp);
+return lldb::SBCommand();
+}
+
 SBCommand::SBCommand() = default;
 
 SBCommand::SBCommand (lldb::CommandObjectSP cmd_sp) : m_opaque_sp (cmd_sp)
@@ -677,6 +688,21 @@
 return lldb::SBCommand();
 }
 
+lldb::SBCommand
+SBCommand::AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, 
const char* help, const char* syntax)
+{
+if (!IsValid ())
+return lldb::SBCommand();
+if (!m_opaque_sp->IsMultiwordObject())
+return lldb::SBCommand();
+lldb::CommandObjectSP new_command_sp;
+new_command_sp.reset(new 
CommandPluginInterfaceImplementation(m_opaque_sp->GetCommandInterpreter(),name,impl,help,
 syntax));
+if (new_command_sp && m_opaque_sp->LoadSubCommand(name,new_command_sp))
+return lldb::SBCommand(new_command_sp);
+return lldb::SBCommand();
+}
+
+
 uint32_t
 SBCommand::GetFlags ()
 {
Index: include/lldb/API/SBCommandInterpreter.h
===
--- include/lldb/API/SBCommandInterpreter.h
+++ include/lldb/API/SBCommandInterpreter.h
@@ -141,6 +141,9 @@
 lldb::SBCommand
 AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const 
char* help);
 
+lldb::SBCommand
+AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const 
char* help, const char* syntax);
+
 void
 SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
 
@@ -308,6 +311,9 @@
 lldb::SBCommand
 AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const 
char* help = nullptr);
 
+lldb::SBCommand
+AddCommand(const char* name, lldb::SBCommandPluginInterface* impl, const 
char* help, const char* syntax);
+
 private:
 friend class SBDebugger;
 friend class SBCommandInterpreter;


Index: source/API/SBCommandInterpreter.cpp
===
--- source/API/SBCommandInterpreter.cpp
+++ source/API/SBCommandInterpreter.cpp
@@ -153,7 +153,7 @@
 sb_return.Release();
 return ret;
 }
-lldb::SBCommandPluginInterface* m_backend;
+std::shared_ptr m_backend;
 };
 
 SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
@@ -605,6 +605,17 @@
 return lldb::SBCommand();
 }
 
+lldb::SBCommand
+SBCommandInterpreter::AddCommand (const char* name, lldb::SBCommandPluginInterface* impl, const char* help, const char* syntax)
+{
+lldb::CommandObjectSP new_command_sp;
+new_command_sp.reset(new CommandPluginInterfaceImplementation(*m_opaque_ptr,name, impl, help, syntax));
+
+if (new_command_sp && m_opaque_ptr->AddUserCommand(name, new_command_sp, true))
+return lldb::SBCommand(new_command_sp);
+return lldb::SBCommand();
+}
+
 SBCommand::SBCommand() = default;
 
 SBCommand::SBCommand (lldb::CommandObjectSP cmd_sp) : m_opaque_sp (cmd_sp)
@@ -677,6 +688,21 @@
 return lldb::SBCommand();
 }
 
+lldb::SBCommand
+SBCommand::AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const char* help, const char* syntax)
+{
+if (!IsValid ())
+return lldb::SBCommand();
+if (!m_opaque_sp->IsMultiwordObject())
+return lldb::SBCommand();
+lldb::CommandObjectSP new_command_sp;
+new_command_sp.reset(new CommandPluginInterfaceImplementation(m_opaque_sp->GetCommandInterpreter(),name,impl,help, syntax));
+if (new_command_sp && m_opaque_sp->LoadSubCommand(name,new_command_sp))
+return lldb::SBCommand(new_command_sp);
+return lldb::SBCommand();
+}
+
+
 uint32_t
 SBCommand::GetFlags ()
 {
Index: include/lldb/API/SBCommandInterpreter.h
===
--- include/lldb/API/SBCommandInterpreter.h
+++ inc

Re: [Lldb-commits] [PATCH] D24251: LLDB: API for Permission of object file's sections

2016-09-07 Thread Abhishek via lldb-commits
abhishek.aggarwal updated this revision to Diff 70513.
abhishek.aggarwal added a comment.

Changes based on review

- Added header doc and ran clang-format on code


https://reviews.llvm.org/D24251

Files:
  include/lldb/API/SBSection.h
  scripts/interface/SBSection.i
  source/API/SBSection.cpp

Index: source/API/SBSection.cpp
===
--- source/API/SBSection.cpp
+++ source/API/SBSection.cpp
@@ -251,6 +251,15 @@
 }
 
 uint32_t
+SBSection::GetPermissions() const
+{
+SectionSP section_sp(GetSP());
+if (section_sp.get())
+return section_sp->GetPermissions();
+return 0;
+}
+
+uint32_t
 SBSection::GetTargetByteSize ()
 {
 SectionSP section_sp (GetSP());
Index: scripts/interface/SBSection.i
===
--- scripts/interface/SBSection.i
+++ scripts/interface/SBSection.i
@@ -90,6 +90,9 @@
 SectionType
 GetSectionType ();
 
+uint32_t
+GetPermissions() const;
+
 %feature("docstring", "
 //--
 /// Return the size of a target's byte represented by this section
Index: include/lldb/API/SBSection.h
===
--- include/lldb/API/SBSection.h
+++ include/lldb/API/SBSection.h
@@ -72,6 +72,21 @@
 GetSectionType ();
 
 //--
+/// Gets the permissions (RWX) of the section of the object file
+///
+/// Returns a mask of bits of enum lldb::Permissions for this section.
+/// Sections for which permissions are not defined, 0 is returned for
+/// them. The binary representation of this value corresponds to [XRW]
+/// i.e. for a section having read and execute permissions, the value
+/// returned is 6
+///
+/// @return
+/// Returns an unsigned value for Permissions for the section.
+//--
+uint32_t
+GetPermissions() const;
+
+//--
 /// Return the size of a target's byte represented by this section
 /// in numbers of host bytes. Note that certain architectures have
 /// varying minimum addressable unit (i.e. byte) size for their 


Index: source/API/SBSection.cpp
===
--- source/API/SBSection.cpp
+++ source/API/SBSection.cpp
@@ -251,6 +251,15 @@
 }
 
 uint32_t
+SBSection::GetPermissions() const
+{
+SectionSP section_sp(GetSP());
+if (section_sp.get())
+return section_sp->GetPermissions();
+return 0;
+}
+
+uint32_t
 SBSection::GetTargetByteSize ()
 {
 SectionSP section_sp (GetSP());
Index: scripts/interface/SBSection.i
===
--- scripts/interface/SBSection.i
+++ scripts/interface/SBSection.i
@@ -90,6 +90,9 @@
 SectionType
 GetSectionType ();
 
+uint32_t
+GetPermissions() const;
+
 %feature("docstring", "
 //--
 /// Return the size of a target's byte represented by this section
Index: include/lldb/API/SBSection.h
===
--- include/lldb/API/SBSection.h
+++ include/lldb/API/SBSection.h
@@ -72,6 +72,21 @@
 GetSectionType ();
 
 //--
+/// Gets the permissions (RWX) of the section of the object file
+///
+/// Returns a mask of bits of enum lldb::Permissions for this section.
+/// Sections for which permissions are not defined, 0 is returned for
+/// them. The binary representation of this value corresponds to [XRW]
+/// i.e. for a section having read and execute permissions, the value
+/// returned is 6
+///
+/// @return
+/// Returns an unsigned value for Permissions for the section.
+//--
+uint32_t
+GetPermissions() const;
+
+//--
 /// Return the size of a target's byte represented by this section
 /// in numbers of host bytes. Note that certain architectures have
 /// varying minimum addressable unit (i.e. byte) size for their 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D24251: LLDB: API for Permission of object file's sections

2016-09-08 Thread Abhishek via lldb-commits
abhishek.aggarwal updated this revision to Diff 70677.
abhishek.aggarwal added a comment.

Removed get() for shared_ptr


https://reviews.llvm.org/D24251

Files:
  include/lldb/API/SBSection.h
  scripts/interface/SBSection.i
  source/API/SBSection.cpp

Index: source/API/SBSection.cpp
===
--- source/API/SBSection.cpp
+++ source/API/SBSection.cpp
@@ -251,6 +251,15 @@
 }
 
 uint32_t
+SBSection::GetPermissions() const
+{
+SectionSP section_sp(GetSP());
+if (section_sp)
+return section_sp->GetPermissions();
+return 0;
+}
+
+uint32_t
 SBSection::GetTargetByteSize ()
 {
 SectionSP section_sp (GetSP());
Index: scripts/interface/SBSection.i
===
--- scripts/interface/SBSection.i
+++ scripts/interface/SBSection.i
@@ -90,6 +90,9 @@
 SectionType
 GetSectionType ();
 
+uint32_t
+GetPermissions() const;
+
 %feature("docstring", "
 //--
 /// Return the size of a target's byte represented by this section
Index: include/lldb/API/SBSection.h
===
--- include/lldb/API/SBSection.h
+++ include/lldb/API/SBSection.h
@@ -72,6 +72,21 @@
 GetSectionType ();
 
 //--
+/// Gets the permissions (RWX) of the section of the object file
+///
+/// Returns a mask of bits of enum lldb::Permissions for this section.
+/// Sections for which permissions are not defined, 0 is returned for
+/// them. The binary representation of this value corresponds to [XRW]
+/// i.e. for a section having read and execute permissions, the value
+/// returned is 6
+///
+/// @return
+/// Returns an unsigned value for Permissions for the section.
+//--
+uint32_t
+GetPermissions() const;
+
+//--
 /// Return the size of a target's byte represented by this section
 /// in numbers of host bytes. Note that certain architectures have
 /// varying minimum addressable unit (i.e. byte) size for their 


Index: source/API/SBSection.cpp
===
--- source/API/SBSection.cpp
+++ source/API/SBSection.cpp
@@ -251,6 +251,15 @@
 }
 
 uint32_t
+SBSection::GetPermissions() const
+{
+SectionSP section_sp(GetSP());
+if (section_sp)
+return section_sp->GetPermissions();
+return 0;
+}
+
+uint32_t
 SBSection::GetTargetByteSize ()
 {
 SectionSP section_sp (GetSP());
Index: scripts/interface/SBSection.i
===
--- scripts/interface/SBSection.i
+++ scripts/interface/SBSection.i
@@ -90,6 +90,9 @@
 SectionType
 GetSectionType ();
 
+uint32_t
+GetPermissions() const;
+
 %feature("docstring", "
 //--
 /// Return the size of a target's byte represented by this section
Index: include/lldb/API/SBSection.h
===
--- include/lldb/API/SBSection.h
+++ include/lldb/API/SBSection.h
@@ -72,6 +72,21 @@
 GetSectionType ();
 
 //--
+/// Gets the permissions (RWX) of the section of the object file
+///
+/// Returns a mask of bits of enum lldb::Permissions for this section.
+/// Sections for which permissions are not defined, 0 is returned for
+/// them. The binary representation of this value corresponds to [XRW]
+/// i.e. for a section having read and execute permissions, the value
+/// returned is 6
+///
+/// @return
+/// Returns an unsigned value for Permissions for the section.
+//--
+uint32_t
+GetPermissions() const;
+
+//--
 /// Return the size of a target's byte represented by this section
 /// in numbers of host bytes. Note that certain architectures have
 /// varying minimum addressable unit (i.e. byte) size for their 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D24251: LLDB: API for Permission of object file's sections

2016-09-09 Thread Abhishek via lldb-commits
abhishek.aggarwal closed this revision.
abhishek.aggarwal added a comment.

Already merged it in LLDb repo. So closing this revision.


https://reviews.llvm.org/D24251



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


Re: [Lldb-commits] [PATCH] D16767: Fix single-stepping onto a breakpoint

2016-02-01 Thread Abhishek via lldb-commits
abhishek.aggarwal added a comment.

source/Plugins/Process/FreeBSD/FreeBSDThread.cpp will not compile for FreeBSD. 
In Line 576, bp_id is undefined. Please replace it with bp_site_sp->GetID()


http://reviews.llvm.org/D16767



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


Re: [Lldb-commits] [PATCH] D12677: Bug 24733: TestRegisters.py for Clang inferiors

2015-09-07 Thread Abhishek via lldb-commits
abhishek.aggarwal added inline comments.


Comment at: test/functionalities/register/TestRegisters.py:195
@@ +194,3 @@
+for x in range(0,16):
+self.runCmd ("si", RUN_SUCCEEDED)
+

labath wrote:
> First I would like to applaud for writing a test case for such a delicate 
> issue. I know it's not easy given the current test infrastructure.
> 
> However, this change seems very fragile and likely to break due to random 
> changes in clang implementation and/or command line flags. Even the gcc path 
> can break if the gcc happens to produce slightly different output. I would 
> like to avoid relying on hardcoded instruction counts.
> 
> How about we try something like this:
> - in the inline assembly, we prepend the code you want to test with "int3"
> - run the inferior normally. it should hit the debugger trap and stop (you 
> can verify that the stop reason is indeed sigtrap)
> - the next instruction should point precisely at the code you want to test, 
> without relying on any debug info or instruction counts
> - proceed with the test normally
> 
> what do you think?
Thanks for suggesting a nice way to fix it. I agree with you. I will make the 
changes.


http://reviews.llvm.org/D12677



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


Re: [Lldb-commits] [PATCH] D12677: Bug 24733: TestRegisters.py for Clang inferiors

2015-09-07 Thread Abhishek via lldb-commits
abhishek.aggarwal updated this revision to Diff 34161.
abhishek.aggarwal added a comment.

Clang/GCC generate different assembly for same inferior.

Changed a.cpp to remove dependency of TestRegisters.py on assembly
instructions generated by Clang/GCC.

Changed TestRegisters.py to write a generic test vector for testing
Bug 24457.


http://reviews.llvm.org/D12677

Files:
  test/functionalities/register/TestRegisters.py
  test/functionalities/register/a.cpp

Index: test/functionalities/register/a.cpp
===
--- test/functionalities/register/a.cpp
+++ test/functionalities/register/a.cpp
@@ -13,6 +13,7 @@
 {
 float a=2, b=4,c=8, d=16, e=32, f=64, k=128, l=256, add=0;
 __asm__ (
+"int3 ;"
 "flds %1 ;"
 "flds %2 ;"
 "flds %3 ;"
Index: test/functionalities/register/TestRegisters.py
===
--- test/functionalities/register/TestRegisters.py
+++ test/functionalities/register/TestRegisters.py
@@ -36,7 +36,6 @@
 self.buildDefault()
 self.fp_register_write()
 
-@expectedFailureClang("llvm.org/pr24733")
 def test_fp_special_purpose_register_read(self):
 """Test commands that read fpu special purpose registers."""
 if not self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
@@ -168,15 +167,14 @@
 target = self.dbg.CreateTarget(exe)
 self.assertTrue(target, VALID_TARGET)
 
-# Find the line number to break inside a.cpp.
-self.line = line_number('a.cpp', '// Set break point at this line.')
-
-# Set breakpoint
-lldbutil.run_break_set_by_file_and_line (self, "a.cpp", self.line, 
num_expected_locations=1, loc_exact=True)
-
 # Launch the process, and do not stop at the entry point.
 self.runCmd ("run", RUN_SUCCEEDED)
 
+# Check stop reason; Should be SIGTRAP
+stop_reason = 'stop reason = signal SIGTRAP'
+self.expect("thread list", STOPPED_DUE_TO_SIGNAL,
+  substrs = ['stopped', stop_reason])
+
 process = target.GetProcess()
 self.assertTrue(process.GetState() == lldb.eStateStopped,
 PROCESS_STOPPED)


Index: test/functionalities/register/a.cpp
===
--- test/functionalities/register/a.cpp
+++ test/functionalities/register/a.cpp
@@ -13,6 +13,7 @@
 {
 float a=2, b=4,c=8, d=16, e=32, f=64, k=128, l=256, add=0;
 __asm__ (
+"int3 ;"
 "flds %1 ;"
 "flds %2 ;"
 "flds %3 ;"
Index: test/functionalities/register/TestRegisters.py
===
--- test/functionalities/register/TestRegisters.py
+++ test/functionalities/register/TestRegisters.py
@@ -36,7 +36,6 @@
 self.buildDefault()
 self.fp_register_write()
 
-@expectedFailureClang("llvm.org/pr24733")
 def test_fp_special_purpose_register_read(self):
 """Test commands that read fpu special purpose registers."""
 if not self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
@@ -168,15 +167,14 @@
 target = self.dbg.CreateTarget(exe)
 self.assertTrue(target, VALID_TARGET)
 
-# Find the line number to break inside a.cpp.
-self.line = line_number('a.cpp', '// Set break point at this line.')
-
-# Set breakpoint
-lldbutil.run_break_set_by_file_and_line (self, "a.cpp", self.line, num_expected_locations=1, loc_exact=True)
-
 # Launch the process, and do not stop at the entry point.
 self.runCmd ("run", RUN_SUCCEEDED)
 
+# Check stop reason; Should be SIGTRAP
+stop_reason = 'stop reason = signal SIGTRAP'
+self.expect("thread list", STOPPED_DUE_TO_SIGNAL,
+  substrs = ['stopped', stop_reason])
+
 process = target.GetProcess()
 self.assertTrue(process.GetState() == lldb.eStateStopped,
 PROCESS_STOPPED)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12677: Bug 24733: TestRegisters.py for Clang inferiors

2015-09-08 Thread Abhishek via lldb-commits
abhishek.aggarwal closed this revision.
abhishek.aggarwal added a comment.

Couldn't land this patch by arc due to merge conflicts. Hence merging it 
manually and closing this revision.


http://reviews.llvm.org/D12677



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


Re: [Lldb-commits] [PATCH] D12677: Bug 24733: TestRegisters.py for Clang inferiors

2015-09-09 Thread Abhishek via lldb-commits
abhishek.aggarwal added a comment.

In http://reviews.llvm.org/D12677#242006, @ovyalov wrote:

> I reverted the CL because it was causing 
> TestRegisters.test_fp_special_purpose_register_read to fail on OSX:
>
> - stop reason = EXC_BREAKPOINT
> - "register read ftag" yields 0x80 instead of expected 0x8000


Hi Oleksiy

Thanks for pointing out.  Two things:

1. Is it possible for you to share the failure log for this test on MacOSX? The 
expected value of ftag is 0x0080 and not 0x8000. Which compiler was used to 
compile inferior?
2. Do you think that this patch needs reversion? In my opinion, this patch 
provides a much better (genric) way to test X87 FPU on Linux OS (atleast). I 
don't know whether the status for MacOSX would have even changed after you 
reverted this patch. I believe, it should still fail for MacOSX. I can take a 
look for MacOSX once you provide me failure logs. I would recommend to keep 
this patch and for the time being skip it for MacOSX. Once I find a fix for it 
on MacOSX, we can enable it for the same as well. What do you think ?


http://reviews.llvm.org/D12677



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