diff options
Diffstat (limited to 'source/API')
-rw-r--r-- | source/API/SBInstruction.cpp | 10 | ||||
-rw-r--r-- | source/API/SBInstructionList.cpp | 5 | ||||
-rw-r--r-- | source/API/SBLaunchInfo.cpp | 278 | ||||
-rw-r--r-- | source/API/SBPlatform.cpp | 157 | ||||
-rw-r--r-- | source/API/SBStream.cpp | 6 | ||||
-rw-r--r-- | source/API/SBTarget.cpp | 256 | ||||
-rw-r--r-- | source/API/SBThread.cpp | 3 | ||||
-rw-r--r-- | source/API/SBType.cpp | 25 | ||||
-rw-r--r-- | source/API/SBTypeCategory.cpp | 4 | ||||
-rw-r--r-- | source/API/SBValue.cpp | 3 |
10 files changed, 407 insertions, 340 deletions
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp index eccc4e2..6158418 100644 --- a/source/API/SBInstruction.cpp +++ b/source/API/SBInstruction.cpp @@ -178,8 +178,9 @@ SBInstruction::GetDescription (lldb::SBStream &s) module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc); // Use the "ref()" instead of the "get()" accessor in case the SBStream // didn't have a stream already created, one will get created... - const char *disassemble_format = "${addr-file-or-load}: "; - m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, disassemble_format); + FormatEntity::Entry format; + FormatEntity::Parse("${addr}: ", format); + m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, &format); return true; } return false; @@ -199,8 +200,9 @@ SBInstruction::Print (FILE *out) if (module_sp) module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc); StreamFile out_stream (out, false); - const char *disassemble_format = "${addr-file-or-load}: "; - m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, disassemble_format); + FormatEntity::Entry format; + FormatEntity::Parse("${addr}: ", format); + m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, &format); } } diff --git a/source/API/SBInstructionList.cpp b/source/API/SBInstructionList.cpp index 31585b3..812824b 100644 --- a/source/API/SBInstructionList.cpp +++ b/source/API/SBInstructionList.cpp @@ -102,7 +102,8 @@ SBInstructionList::GetDescription (lldb::SBStream &description) // exist already inside description... Stream &sref = description.ref(); const uint32_t max_opcode_byte_size = m_opaque_sp->GetInstructionList().GetMaxOpcocdeByteSize(); - const char *disassemble_format = "${addr-file-or-load}: "; + FormatEntity::Entry format; + FormatEntity::Parse("${addr}: ", format); SymbolContext sc; SymbolContext prev_sc; for (size_t i=0; i<num_instructions; ++i) @@ -119,7 +120,7 @@ SBInstructionList::GetDescription (lldb::SBStream &description) module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc); } - inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, disassemble_format); + inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, &format); sref.EOL(); } return true; diff --git a/source/API/SBLaunchInfo.cpp b/source/API/SBLaunchInfo.cpp new file mode 100644 index 0000000..dcb0e1b --- /dev/null +++ b/source/API/SBLaunchInfo.cpp @@ -0,0 +1,278 @@ +//===-- SBLaunchInfo.cpp ----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/lldb-python.h" + +#include "lldb/API/SBLaunchInfo.h" + +#include "lldb/API/SBFileSpec.h" +#include "lldb/API/SBListener.h" +#include "lldb/Target/ProcessLaunchInfo.h" + +using namespace lldb; +using namespace lldb_private; + +SBLaunchInfo::SBLaunchInfo (const char **argv) : + m_opaque_sp(new ProcessLaunchInfo()) +{ + m_opaque_sp->GetFlags().Reset (eLaunchFlagDebug | eLaunchFlagDisableASLR); + if (argv && argv[0]) + m_opaque_sp->GetArguments().SetArguments(argv); +} + +SBLaunchInfo::~SBLaunchInfo() +{ +} + +lldb_private::ProcessLaunchInfo & +SBLaunchInfo::ref () +{ + return *m_opaque_sp; +} + +lldb::pid_t +SBLaunchInfo::GetProcessID() +{ + return m_opaque_sp->GetProcessID(); +} + +uint32_t +SBLaunchInfo::GetUserID() +{ + return m_opaque_sp->GetUserID(); +} + +uint32_t +SBLaunchInfo::GetGroupID() +{ + return m_opaque_sp->GetGroupID(); +} + +bool +SBLaunchInfo::UserIDIsValid () +{ + return m_opaque_sp->UserIDIsValid(); +} + +bool +SBLaunchInfo::GroupIDIsValid () +{ + return m_opaque_sp->GroupIDIsValid(); +} + +void +SBLaunchInfo::SetUserID (uint32_t uid) +{ + m_opaque_sp->SetUserID (uid); +} + +void +SBLaunchInfo::SetGroupID (uint32_t gid) +{ + m_opaque_sp->SetGroupID (gid); +} + +SBFileSpec +SBLaunchInfo::GetExecutableFile () +{ + return SBFileSpec (m_opaque_sp->GetExecutableFile()); +} + +void +SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg) +{ + m_opaque_sp->SetExecutableFile(exe_file.ref(), add_as_first_arg); +} + +SBListener +SBLaunchInfo::GetListener () +{ + return SBListener(m_opaque_sp->GetListener()); +} + +void +SBLaunchInfo::SetListener (SBListener &listener) +{ + m_opaque_sp->SetListener(listener.GetSP()); +} + +uint32_t +SBLaunchInfo::GetNumArguments () +{ + return m_opaque_sp->GetArguments().GetArgumentCount(); +} + +const char * +SBLaunchInfo::GetArgumentAtIndex (uint32_t idx) +{ + return m_opaque_sp->GetArguments().GetArgumentAtIndex(idx); +} + +void +SBLaunchInfo::SetArguments (const char **argv, bool append) +{ + if (append) + { + if (argv) + m_opaque_sp->GetArguments().AppendArguments(argv); + } + else + { + if (argv) + m_opaque_sp->GetArguments().SetArguments(argv); + else + m_opaque_sp->GetArguments().Clear(); + } +} + +uint32_t +SBLaunchInfo::GetNumEnvironmentEntries () +{ + return m_opaque_sp->GetEnvironmentEntries().GetArgumentCount(); +} + +const char * +SBLaunchInfo::GetEnvironmentEntryAtIndex (uint32_t idx) +{ + return m_opaque_sp->GetEnvironmentEntries().GetArgumentAtIndex(idx); +} + +void +SBLaunchInfo::SetEnvironmentEntries (const char **envp, bool append) +{ + if (append) + { + if (envp) + m_opaque_sp->GetEnvironmentEntries().AppendArguments(envp); + } + else + { + if (envp) + m_opaque_sp->GetEnvironmentEntries().SetArguments(envp); + else + m_opaque_sp->GetEnvironmentEntries().Clear(); + } +} + +void +SBLaunchInfo::Clear () +{ + m_opaque_sp->Clear(); +} + +const char * +SBLaunchInfo::GetWorkingDirectory () const +{ + return m_opaque_sp->GetWorkingDirectory(); +} + +void +SBLaunchInfo::SetWorkingDirectory (const char *working_dir) +{ + m_opaque_sp->SetWorkingDirectory(working_dir); +} + +uint32_t +SBLaunchInfo::GetLaunchFlags () +{ + return m_opaque_sp->GetFlags().Get(); +} + +void +SBLaunchInfo::SetLaunchFlags (uint32_t flags) +{ + m_opaque_sp->GetFlags().Reset(flags); +} + +const char * +SBLaunchInfo::GetProcessPluginName () +{ + return m_opaque_sp->GetProcessPluginName(); +} + +void +SBLaunchInfo::SetProcessPluginName (const char *plugin_name) +{ + return m_opaque_sp->SetProcessPluginName (plugin_name); +} + +const char * +SBLaunchInfo::GetShell () +{ + // Constify this string so that it is saved in the string pool. Otherwise + // it would be freed when this function goes out of scope. + ConstString shell(m_opaque_sp->GetShell().GetPath().c_str()); + return shell.AsCString(); +} + +void +SBLaunchInfo::SetShell (const char * path) +{ + m_opaque_sp->SetShell (FileSpec(path, false)); +} + +uint32_t +SBLaunchInfo::GetResumeCount () +{ + return m_opaque_sp->GetResumeCount(); +} + +void +SBLaunchInfo::SetResumeCount (uint32_t c) +{ + m_opaque_sp->SetResumeCount (c); +} + +bool +SBLaunchInfo::AddCloseFileAction (int fd) +{ + return m_opaque_sp->AppendCloseFileAction(fd); +} + +bool +SBLaunchInfo::AddDuplicateFileAction (int fd, int dup_fd) +{ + return m_opaque_sp->AppendDuplicateFileAction(fd, dup_fd); +} + +bool +SBLaunchInfo::AddOpenFileAction (int fd, const char *path, bool read, bool write) +{ + return m_opaque_sp->AppendOpenFileAction(fd, path, read, write); +} + +bool +SBLaunchInfo::AddSuppressFileAction (int fd, bool read, bool write) +{ + return m_opaque_sp->AppendSuppressFileAction(fd, read, write); +} + +void +SBLaunchInfo::SetLaunchEventData (const char *data) +{ + m_opaque_sp->SetLaunchEventData (data); +} + +const char * +SBLaunchInfo::GetLaunchEventData () const +{ + return m_opaque_sp->GetLaunchEventData (); +} + +void +SBLaunchInfo::SetDetachOnError (bool enable) +{ + m_opaque_sp->SetDetachOnError (enable); +} + +bool +SBLaunchInfo::GetDetachOnError () const +{ + return m_opaque_sp->GetDetachOnError (); +} diff --git a/source/API/SBPlatform.cpp b/source/API/SBPlatform.cpp index d3e769a..b23891d 100644 --- a/source/API/SBPlatform.cpp +++ b/source/API/SBPlatform.cpp @@ -10,6 +10,7 @@ #include "lldb/API/SBPlatform.h" #include "lldb/API/SBError.h" #include "lldb/API/SBFileSpec.h" +#include "lldb/API/SBLaunchInfo.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Error.h" #include "lldb/Host/File.h" @@ -17,6 +18,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Platform.h" +#include <functional> + using namespace lldb; using namespace lldb_private; @@ -484,104 +487,108 @@ SBError SBPlatform::Put (SBFileSpec &src, SBFileSpec &dst) { - SBError sb_error; - - PlatformSP platform_sp(GetSP()); - if (platform_sp) - { - if (src.Exists()) + return ExecuteConnected( + [&](const lldb::PlatformSP& platform_sp) + { + if (src.Exists()) + { + uint32_t permissions = src.ref().GetPermissions(); + if (permissions == 0) + { + if (src.ref().GetFileType() == FileSpec::eFileTypeDirectory) + permissions = eFilePermissionsDirectoryDefault; + else + permissions = eFilePermissionsFileDefault; + } + + return platform_sp->PutFile(src.ref(), dst.ref(), permissions); + } + + Error error; + error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str()); + return error; + }); +} + +SBError +SBPlatform::Install (SBFileSpec &src, + SBFileSpec &dst) +{ + return ExecuteConnected( + [&](const lldb::PlatformSP& platform_sp) + { + if (src.Exists()) + return platform_sp->Install(src.ref(), dst.ref()); + + Error error; + error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str()); + return error; + }); +} + + +SBError +SBPlatform::Run (SBPlatformShellCommand &shell_command) +{ + return ExecuteConnected( + [&](const lldb::PlatformSP& platform_sp) { - uint32_t permissions = src.ref().GetPermissions(); - if (permissions == 0) + const char *command = shell_command.GetCommand(); + if (!command) + return Error("invalid shell command (empty)"); + + const char *working_dir = shell_command.GetWorkingDirectory(); + if (working_dir == NULL) { - if (src.ref().GetFileType() == FileSpec::eFileTypeDirectory) - permissions = eFilePermissionsDirectoryDefault; - else - permissions = eFilePermissionsFileDefault; + working_dir = platform_sp->GetWorkingDirectory().GetCString(); + if (working_dir) + shell_command.SetWorkingDirectory(working_dir); } + return platform_sp->RunShellCommand(command, + working_dir, + &shell_command.m_opaque_ptr->m_status, + &shell_command.m_opaque_ptr->m_signo, + &shell_command.m_opaque_ptr->m_output, + shell_command.m_opaque_ptr->m_timeout_sec); + }); +} - sb_error.ref() = platform_sp->PutFile(src.ref(), - dst.ref(), - permissions); - } - else +SBError +SBPlatform::Launch (SBLaunchInfo &launch_info) +{ + return ExecuteConnected( + [&](const lldb::PlatformSP& platform_sp) { - sb_error.ref().SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str()); - } - } - else - { - sb_error.SetErrorString("invalid platform"); - } - return sb_error; + return platform_sp->LaunchProcess(launch_info.ref()); + }); } SBError -SBPlatform::Install (SBFileSpec &src, - SBFileSpec &dst) +SBPlatform::Kill (const lldb::pid_t pid) { - SBError sb_error; - PlatformSP platform_sp(GetSP()); - if (platform_sp) - { - if (src.Exists()) - { - sb_error.ref() = platform_sp->Install(src.ref(), dst.ref()); - } - else + return ExecuteConnected( + [&](const lldb::PlatformSP& platform_sp) { - sb_error.ref().SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str()); - } - } - else - { - sb_error.SetErrorString("invalid platform"); - } - return sb_error; + return platform_sp->KillProcess(pid); + }); } - SBError -SBPlatform::Run (SBPlatformShellCommand &shell_command) +SBPlatform::ExecuteConnected (const std::function<Error(const lldb::PlatformSP&)>& func) { SBError sb_error; - PlatformSP platform_sp(GetSP()); + const auto platform_sp(GetSP()); if (platform_sp) { if (platform_sp->IsConnected()) - { - const char *command = shell_command.GetCommand(); - if (command) - { - const char *working_dir = shell_command.GetWorkingDirectory(); - if (working_dir == NULL) - { - working_dir = platform_sp->GetWorkingDirectory().GetCString(); - if (working_dir) - shell_command.SetWorkingDirectory(working_dir); - } - sb_error.ref() = platform_sp->RunShellCommand(command, - working_dir, - &shell_command.m_opaque_ptr->m_status, - &shell_command.m_opaque_ptr->m_signo, - &shell_command.m_opaque_ptr->m_output, - shell_command.m_opaque_ptr->m_timeout_sec); - } - else - { - sb_error.SetErrorString("invalid shell command (empty)"); - } - } + sb_error.ref() = func(platform_sp); else - { sb_error.SetErrorString("not connected"); - } } else - { sb_error.SetErrorString("invalid platform"); - } - return sb_error; + + return sb_error; } SBError diff --git a/source/API/SBStream.cpp b/source/API/SBStream.cpp index f5b5c08..f50334f 100644 --- a/source/API/SBStream.cpp +++ b/source/API/SBStream.cpp @@ -70,6 +70,9 @@ SBStream::Printf (const char *format, ...) void SBStream::RedirectToFile (const char *path, bool append) { + if (path == nullptr) + return; + std::string local_data; if (m_opaque_ap.get()) { @@ -104,6 +107,9 @@ SBStream::RedirectToFile (const char *path, bool append) void SBStream::RedirectToFileHandle (FILE *fh, bool transfer_fh_ownership) { + if (fh == nullptr) + return; + std::string local_data; if (m_opaque_ap.get()) { diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp index b87b1ac..b13d828 100644 --- a/source/API/SBTarget.cpp +++ b/source/API/SBTarget.cpp @@ -66,259 +66,6 @@ using namespace lldb_private; #define DEFAULT_DISASM_BYTE_SIZE 32 -SBLaunchInfo::SBLaunchInfo (const char **argv) : - m_opaque_sp(new ProcessLaunchInfo()) -{ - m_opaque_sp->GetFlags().Reset (eLaunchFlagDebug | eLaunchFlagDisableASLR); - if (argv && argv[0]) - m_opaque_sp->GetArguments().SetArguments(argv); -} - -SBLaunchInfo::~SBLaunchInfo() -{ -} - -lldb_private::ProcessLaunchInfo & -SBLaunchInfo::ref () -{ - return *m_opaque_sp; -} - - -uint32_t -SBLaunchInfo::GetUserID() -{ - return m_opaque_sp->GetUserID(); -} - -uint32_t -SBLaunchInfo::GetGroupID() -{ - return m_opaque_sp->GetGroupID(); -} - -bool -SBLaunchInfo::UserIDIsValid () -{ - return m_opaque_sp->UserIDIsValid(); -} - -bool -SBLaunchInfo::GroupIDIsValid () -{ - return m_opaque_sp->GroupIDIsValid(); -} - -void -SBLaunchInfo::SetUserID (uint32_t uid) -{ - m_opaque_sp->SetUserID (uid); -} - -void -SBLaunchInfo::SetGroupID (uint32_t gid) -{ - m_opaque_sp->SetGroupID (gid); -} - -SBFileSpec -SBLaunchInfo::GetExecutableFile () -{ - return SBFileSpec (m_opaque_sp->GetExecutableFile()); -} - -void -SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg) -{ - m_opaque_sp->SetExecutableFile(exe_file.ref(), add_as_first_arg); -} - -SBListener -SBLaunchInfo::GetListener () -{ - return SBListener(m_opaque_sp->GetListener()); -} - -void -SBLaunchInfo::SetListener (SBListener &listener) -{ - m_opaque_sp->SetListener(listener.GetSP()); -} - -uint32_t -SBLaunchInfo::GetNumArguments () -{ - return m_opaque_sp->GetArguments().GetArgumentCount(); -} - -const char * -SBLaunchInfo::GetArgumentAtIndex (uint32_t idx) -{ - return m_opaque_sp->GetArguments().GetArgumentAtIndex(idx); -} - -void -SBLaunchInfo::SetArguments (const char **argv, bool append) -{ - if (append) - { - if (argv) - m_opaque_sp->GetArguments().AppendArguments(argv); - } - else - { - if (argv) - m_opaque_sp->GetArguments().SetArguments(argv); - else - m_opaque_sp->GetArguments().Clear(); - } -} - -uint32_t -SBLaunchInfo::GetNumEnvironmentEntries () -{ - return m_opaque_sp->GetEnvironmentEntries().GetArgumentCount(); -} - -const char * -SBLaunchInfo::GetEnvironmentEntryAtIndex (uint32_t idx) -{ - return m_opaque_sp->GetEnvironmentEntries().GetArgumentAtIndex(idx); -} - -void -SBLaunchInfo::SetEnvironmentEntries (const char **envp, bool append) -{ - if (append) - { - if (envp) - m_opaque_sp->GetEnvironmentEntries().AppendArguments(envp); - } - else - { - if (envp) - m_opaque_sp->GetEnvironmentEntries().SetArguments(envp); - else - m_opaque_sp->GetEnvironmentEntries().Clear(); - } -} - -void -SBLaunchInfo::Clear () -{ - m_opaque_sp->Clear(); -} - -const char * -SBLaunchInfo::GetWorkingDirectory () const -{ - return m_opaque_sp->GetWorkingDirectory(); -} - -void -SBLaunchInfo::SetWorkingDirectory (const char *working_dir) -{ - m_opaque_sp->SetWorkingDirectory(working_dir); -} - -uint32_t -SBLaunchInfo::GetLaunchFlags () -{ - return m_opaque_sp->GetFlags().Get(); -} - -void -SBLaunchInfo::SetLaunchFlags (uint32_t flags) -{ - m_opaque_sp->GetFlags().Reset(flags); -} - -const char * -SBLaunchInfo::GetProcessPluginName () -{ - return m_opaque_sp->GetProcessPluginName(); -} - -void -SBLaunchInfo::SetProcessPluginName (const char *plugin_name) -{ - return m_opaque_sp->SetProcessPluginName (plugin_name); -} - -const char * -SBLaunchInfo::GetShell () -{ - // Constify this string so that it is saved in the string pool. Otherwise - // it would be freed when this function goes out of scope. - ConstString shell(m_opaque_sp->GetShell().GetPath().c_str()); - return shell.AsCString(); -} - -void -SBLaunchInfo::SetShell (const char * path) -{ - m_opaque_sp->SetShell (FileSpec(path, false)); -} - -uint32_t -SBLaunchInfo::GetResumeCount () -{ - return m_opaque_sp->GetResumeCount(); -} - -void -SBLaunchInfo::SetResumeCount (uint32_t c) -{ - m_opaque_sp->SetResumeCount (c); -} - -bool -SBLaunchInfo::AddCloseFileAction (int fd) -{ - return m_opaque_sp->AppendCloseFileAction(fd); -} - -bool -SBLaunchInfo::AddDuplicateFileAction (int fd, int dup_fd) -{ - return m_opaque_sp->AppendDuplicateFileAction(fd, dup_fd); -} - -bool -SBLaunchInfo::AddOpenFileAction (int fd, const char *path, bool read, bool write) -{ - return m_opaque_sp->AppendOpenFileAction(fd, path, read, write); -} - -bool -SBLaunchInfo::AddSuppressFileAction (int fd, bool read, bool write) -{ - return m_opaque_sp->AppendSuppressFileAction(fd, read, write); -} - -void -SBLaunchInfo::SetLaunchEventData (const char *data) -{ - m_opaque_sp->SetLaunchEventData (data); -} - -const char * -SBLaunchInfo::GetLaunchEventData () const -{ - return m_opaque_sp->GetLaunchEventData (); -} - -void -SBLaunchInfo::SetDetachOnError (bool enable) -{ - m_opaque_sp->SetDetachOnError (enable); -} - -bool -SBLaunchInfo::GetDetachOnError () const -{ - return m_opaque_sp->GetDetachOnError (); -} SBAttachInfo::SBAttachInfo () : m_opaque_sp (new ProcessAttachInfo()) @@ -729,6 +476,9 @@ SBTarget::Launch { Mutex::Locker api_locker (target_sp->GetAPIMutex()); + if (stop_at_entry) + launch_flags |= eLaunchFlagStopAtEntry; + if (getenv("LLDB_LAUNCH_FLAG_DISABLE_ASLR")) launch_flags |= eLaunchFlagDisableASLR; diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp index 6524d10..9fe0d02 100644 --- a/source/API/SBThread.cpp +++ b/source/API/SBThread.cpp @@ -1491,7 +1491,8 @@ SBThread::GetDescription (SBStream &description) const ExecutionContext exe_ctx (m_opaque_sp.get()); if (exe_ctx.HasThreadScope()) { - strm.Printf("SBThread: tid = 0x%4.4" PRIx64, exe_ctx.GetThreadPtr()->GetID()); + exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(strm, LLDB_INVALID_THREAD_ID); + //strm.Printf("SBThread: tid = 0x%4.4" PRIx64, exe_ctx.GetThreadPtr()->GetID()); } else strm.PutCString ("No value"); diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp index 8a0f5d8..31a4eba 100644 --- a/source/API/SBType.cpp +++ b/source/API/SBType.cpp @@ -143,7 +143,7 @@ SBType::GetByteSize() if (!IsValid()) return 0; - return m_opaque_sp->GetClangASTType(false).GetByteSize(); + return m_opaque_sp->GetClangASTType(false).GetByteSize(nullptr); } @@ -164,6 +164,14 @@ SBType::IsArrayType() } bool +SBType::IsVectorType() +{ + if (!IsValid()) + return false; + return m_opaque_sp->GetClangASTType(true).IsVectorType(nullptr, nullptr); +} + +bool SBType::IsReferenceType() { if (!IsValid()) @@ -220,7 +228,20 @@ SBType::GetArrayElementType() return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetClangASTType(true).GetArrayElementType()))); } -bool +SBType +SBType::GetVectorElementType () +{ + SBType type_sb; + if (IsValid()) + { + ClangASTType vector_element_type; + if (m_opaque_sp->GetClangASTType(true).IsVectorType(&vector_element_type, nullptr)) + type_sb.SetSP(TypeImplSP(new TypeImpl(vector_element_type))); + } + return type_sb; +} + +bool SBType::IsFunctionType () { if (!IsValid()) diff --git a/source/API/SBTypeCategory.cpp b/source/API/SBTypeCategory.cpp index 9fe4dad..66cf462 100644 --- a/source/API/SBTypeCategory.cpp +++ b/source/API/SBTypeCategory.cpp @@ -353,7 +353,7 @@ SBTypeCategory::AddTypeSummary (SBTypeNameSpecifier type_name, // this should eventually be fixed by deciding a final location in the LLDB object space for formatters if (summary.IsFunctionCode()) { - void *name_token = (void*)ConstString(type_name.GetName()).GetCString(); + const void *name_token = (const void*)ConstString(type_name.GetName()).GetCString(); const char* script = summary.GetData(); StringList input; input.SplitIntoLines(script, strlen(script)); uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers(); @@ -461,7 +461,7 @@ SBTypeCategory::AddTypeSynthetic (SBTypeNameSpecifier type_name, // this should eventually be fixed by deciding a final location in the LLDB object space for formatters if (synth.IsClassCode()) { - void *name_token = (void*)ConstString(type_name.GetName()).GetCString(); + const void *name_token = (const void*)ConstString(type_name.GetName()).GetCString(); const char* script = synth.GetData(); StringList input; input.SplitIntoLines(script, strlen(script)); uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers(); diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp index 0d3d7ad..edecb93 100644 --- a/source/API/SBValue.cpp +++ b/source/API/SBValue.cpp @@ -608,7 +608,8 @@ SBValue::GetValueDidChange () lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { - result = value_sp->GetValueDidChange (); + if (value_sp->UpdateValueIfNeeded(false)) + result = value_sp->GetValueDidChange (); } if (log) log->Printf ("SBValue(%p)::GetValueDidChange() => %i", |