[Lldb-commits] [lldb] r122027 - in /lldb/trunk: include/lldb/API/SBThread.h include/lldb/Core/Scalar.h source/API/SBThread.cpp source/Expression/ClangUserExpression.cpp
Greg Clayton
gclayton at apple.com
Thu Dec 16 18:26:25 PST 2010
Author: gclayton
Date: Thu Dec 16 20:26:24 2010
New Revision: 122027
URL: http://llvm.org/viewvc/llvm-project?rev=122027&view=rev
Log:
Added access to set the current stack frame within a thread so any command
line commands can use the current thread/frame.
Fixed an issue with expressions that get sandboxed in an objective C method
where unichar wasn't being passed down.
Added a "static size_t Scalar::GetMaxByteSize();" function in case we need
to know the max supported by size of something within a Scalar object.
Modified:
lldb/trunk/include/lldb/API/SBThread.h
lldb/trunk/include/lldb/Core/Scalar.h
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=122027&r1=122026&r2=122027&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Thu Dec 16 20:26:24 2010
@@ -96,6 +96,12 @@
lldb::SBFrame
GetFrameAtIndex (uint32_t idx);
+ lldb::SBFrame
+ GetSelectedFrame ();
+
+ lldb::SBFrame
+ SetSelectedFrame (uint32_t frame_idx);
+
lldb::SBProcess
GetProcess ();
Modified: lldb/trunk/include/lldb/Core/Scalar.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Scalar.h?rev=122027&r1=122026&r2=122027&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Scalar.h (original)
+++ lldb/trunk/include/lldb/Core/Scalar.h Thu Dec 16 20:26:24 2010
@@ -57,6 +57,12 @@
size_t
GetByteSize() const;
+ static size_t
+ GetMaxByteSize()
+ {
+ return std::max (sizeof(long double), sizeof (unsigned long long));
+ }
+
bool
GetData (DataExtractor &data, size_t limit_byte_size = UINT32_MAX) const;
Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=122027&r1=122026&r2=122027&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Thu Dec 16 20:26:24 2010
@@ -606,6 +606,53 @@
return sb_frame;
}
+lldb::SBFrame
+SBThread::GetSelectedFrame ()
+{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ SBFrame sb_frame;
+ if (m_opaque_sp)
+ sb_frame.SetFrame (m_opaque_sp->GetSelectedFrame ());
+
+ if (log)
+ {
+ SBStream sstr;
+ sb_frame.GetDescription (sstr);
+ log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
+ m_opaque_sp.get(), sb_frame.get(), sstr.GetData());
+ }
+
+ return sb_frame;
+}
+
+lldb::SBFrame
+SBThread::SetSelectedFrame (uint32_t idx)
+{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ SBFrame sb_frame;
+ if (m_opaque_sp)
+ {
+ lldb::StackFrameSP frame_sp (m_opaque_sp->GetStackFrameAtIndex (idx));
+ if (frame_sp)
+ {
+ m_opaque_sp->SetSelectedFrame (frame_sp.get());
+ sb_frame.SetFrame (frame_sp);
+ }
+ }
+
+ if (log)
+ {
+ SBStream sstr;
+ sb_frame.GetDescription (sstr);
+ log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
+ m_opaque_sp.get(), idx, sb_frame.get(), sstr.GetData());
+ }
+ return sb_frame;
+}
+
+
bool
SBThread::operator == (const SBThread &rhs) const
{
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=122027&r1=122026&r2=122027&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Thu Dec 16 20:26:24 2010
@@ -180,6 +180,7 @@
const char *function_name = FunctionName();
m_transformed_stream.Printf("%s \n"
+ "typedef unsigned short unichar; \n"
"@interface $__lldb_objc_class ($__lldb_category) \n"
"-(void)%s:(void *)$__lldb_arg; \n"
"@end \n"
More information about the lldb-commits
mailing list