diff options
Diffstat (limited to 'source/API/SBTarget.cpp')
| -rw-r--r-- | source/API/SBTarget.cpp | 453 | 
1 files changed, 229 insertions, 224 deletions
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp index 224349c0bce6..3d5828c5fe00 100644 --- a/source/API/SBTarget.cpp +++ b/source/API/SBTarget.cpp @@ -120,6 +120,18 @@ 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); +} +  uint32_t  SBLaunchInfo::GetNumArguments ()  { @@ -268,6 +280,29 @@ 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()) @@ -541,10 +576,9 @@ SBTarget::GetProcess ()      Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));      if (log) -    { -        log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)",  -                     target_sp.get(), process_sp.get()); -    } +        log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)", +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(process_sp.get()));      return sb_process;  } @@ -641,19 +675,15 @@ SBTarget::Launch      TargetSP target_sp(GetSP());      if (log) -    {          log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, stdin=%s, stdout=%s, stderr=%s, working-dir=%s, launch_flags=0x%x, stop_at_entry=%i, &error (%p))...", -                     target_sp.get(),  -                     argv,  -                     envp,  -                     stdin_path ? stdin_path : "NULL",  -                     stdout_path ? stdout_path : "NULL",  -                     stderr_path ? stderr_path : "NULL",  +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(argv), static_cast<void*>(envp), +                     stdin_path ? stdin_path : "NULL", +                     stdout_path ? stdout_path : "NULL", +                     stderr_path ? stderr_path : "NULL",                       working_directory ? working_directory : "NULL", -                     launch_flags,  -                     stop_at_entry,  -                     error.get()); -    } +                     launch_flags, stop_at_entry, +                     static_cast<void*>(error.get()));      if (target_sp)      { @@ -667,17 +697,17 @@ SBTarget::Launch          if (process_sp)          {              state = process_sp->GetState(); -             +              if (process_sp->IsAlive() && state != eStateConnected) -            {        +            {                  if (state == eStateAttaching)                      error.SetErrorString ("process attach is in progress");                  else                      error.SetErrorString ("a process is already being debugged");                  return sb_process; -            }             +            }          } -         +          if (state == eStateConnected)          {              // If we are already connected, then we have already specified the @@ -694,7 +724,7 @@ SBTarget::Launch              launch_flags |= eLaunchFlagDisableSTDIO;          ProcessLaunchInfo launch_info (stdin_path, stdout_path, stderr_path, working_directory, launch_flags); -         +          Module *exe_module = target_sp->GetExecutableModulePointer();          if (exe_module)              launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true); @@ -717,10 +747,9 @@ SBTarget::Launch      log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);      if (log) -    { -        log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)",  -                     target_sp.get(), sb_process.GetSP().get()); -    } +        log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)", +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(sb_process.GetSP().get()));      return sb_process;  } @@ -729,46 +758,48 @@ SBProcess  SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)  {      Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); -     +      SBProcess sb_process;      TargetSP target_sp(GetSP()); -     +      if (log) -    { -        log->Printf ("SBTarget(%p)::Launch (launch_info, error)...", target_sp.get()); -    } -     +        log->Printf ("SBTarget(%p)::Launch (launch_info, error)...", +                     static_cast<void*>(target_sp.get())); +      if (target_sp)      {          Mutex::Locker api_locker (target_sp->GetAPIMutex());          StateType state = eStateInvalid;          { -        ProcessSP process_sp = target_sp->GetProcessSP(); -        if (process_sp) -        { -            state = process_sp->GetState(); -             -            if (process_sp->IsAlive() && state != eStateConnected) -            {        -                if (state == eStateAttaching) -                    error.SetErrorString ("process attach is in progress"); -                else -                    error.SetErrorString ("a process is already being debugged"); -                return sb_process; -            }             -        } +            ProcessSP process_sp = target_sp->GetProcessSP(); +            if (process_sp) +            { +                state = process_sp->GetState(); +                 +                if (process_sp->IsAlive() && state != eStateConnected) +                { +                    if (state == eStateAttaching) +                        error.SetErrorString ("process attach is in progress"); +                    else +                        error.SetErrorString ("a process is already being debugged"); +                    return sb_process; +                } +            }          }          lldb_private::ProcessLaunchInfo &launch_info = sb_launch_info.ref(); -        Module *exe_module = target_sp->GetExecutableModulePointer(); -        if (exe_module) -            launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true); +        if (!launch_info.GetExecutableFile()) +        { +            Module *exe_module = target_sp->GetExecutableModulePointer(); +            if (exe_module) +                launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true); +        }          const ArchSpec &arch_spec = target_sp->GetArchitecture();          if (arch_spec.IsValid())              launch_info.GetArchitecture () = arch_spec; -         +          error.SetError (target_sp->Launch (target_sp->GetDebugger().GetListener(), launch_info));          sb_process.SetSP(target_sp->GetProcessSP());      } @@ -776,14 +807,13 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)      {          error.SetErrorString ("SBTarget is invalid");      } -     +      log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);      if (log) -    {          log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)", -                     target_sp.get(), sb_process.GetSP().get()); -    } -     +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(sb_process.GetSP().get())); +      return sb_process;  } @@ -791,41 +821,39 @@ lldb::SBProcess  SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)  {      Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); -     +      SBProcess sb_process;      ProcessSP process_sp;      TargetSP target_sp(GetSP()); -     +      if (log) -    { -        log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...", target_sp.get()); -    } -     +        log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...", +                     static_cast<void*>(target_sp.get())); +      if (target_sp)      {          Mutex::Locker api_locker (target_sp->GetAPIMutex()); -         +          StateType state = eStateInvalid;          process_sp = target_sp->GetProcessSP();          if (process_sp)          {              state = process_sp->GetState(); -             +              if (process_sp->IsAlive() && state != eStateConnected) -            {        +            {                  if (state == eStateAttaching)                      error.SetErrorString ("process attach is in progress");                  else                      error.SetErrorString ("a process is already being debugged");                  if (log) -                {                      log->Printf ("SBTarget(%p)::Attach (...) => error %s", -                                 target_sp.get(), error.GetCString()); -                } +                                 static_cast<void*>(target_sp.get()), +                                 error.GetCString());                  return sb_process; -            }             +            }          } -         +          if (state != eStateConnected)              process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL); @@ -850,7 +878,7 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)                          if (log)                          {                              log->Printf ("SBTarget(%p)::Attach (...) => error %s", -                                         target_sp.get(), error.GetCString()); +                                         static_cast<void*>(target_sp.get()), error.GetCString());                          }                          return sb_process;                      } @@ -875,13 +903,12 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)      {          error.SetErrorString ("SBTarget is invalid");      } -     +      if (log) -    {          log->Printf ("SBTarget(%p)::Attach (...) => SBProcess(%p)", -                     target_sp.get(), process_sp.get()); -    } -     +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(process_sp.get())); +      return sb_process;  } @@ -913,10 +940,9 @@ SBTarget::AttachToProcessWithID      TargetSP target_sp(GetSP());      if (log) -    { -        log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...", target_sp.get(), pid); -    } -     +        log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...", +                     static_cast<void*>(target_sp.get()), pid); +      if (target_sp)      {          Mutex::Locker api_locker (target_sp->GetAPIMutex()); @@ -926,15 +952,15 @@ SBTarget::AttachToProcessWithID          if (process_sp)          {              state = process_sp->GetState(); -             +              if (process_sp->IsAlive() && state != eStateConnected) -            {        +            {                  if (state == eStateAttaching)                      error.SetErrorString ("process attach is in progress");                  else                      error.SetErrorString ("a process is already being debugged");                  return sb_process; -            }             +            }          }          if (state == eStateConnected) @@ -958,10 +984,10 @@ SBTarget::AttachToProcessWithID          if (process_sp)          {              sb_process.SetSP (process_sp); -             +              ProcessAttachInfo attach_info;              attach_info.SetProcessID (pid); -             +              PlatformSP platform_sp = target_sp->GetPlatform();              ProcessInstanceInfo instance_info;              if (platform_sp->GetProcessInfo(pid, instance_info)) @@ -986,12 +1012,11 @@ SBTarget::AttachToProcessWithID      {          error.SetErrorString ("SBTarget is invalid");      } -     +      if (log) -    {          log->Printf ("SBTarget(%p)::AttachToProcessWithID (...) => SBProcess(%p)", -                     target_sp.get(), process_sp.get()); -    } +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(process_sp.get()));      return sb_process;  } @@ -1005,16 +1030,16 @@ SBTarget::AttachToProcessWithName  )  {      Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); -     +      SBProcess sb_process;      ProcessSP process_sp;      TargetSP target_sp(GetSP()); -     +      if (log) -    { -        log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...", target_sp.get(), name, wait_for ? "true" : "false"); -    } -     +        log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...", +                     static_cast<void*>(target_sp.get()), name, +                     wait_for ? "true" : "false"); +      if (name && target_sp)      {          Mutex::Locker api_locker (target_sp->GetAPIMutex()); @@ -1024,17 +1049,17 @@ SBTarget::AttachToProcessWithName          if (process_sp)          {              state = process_sp->GetState(); -             +              if (process_sp->IsAlive() && state != eStateConnected) -            {        +            {                  if (state == eStateAttaching)                      error.SetErrorString ("process attach is in progress");                  else                      error.SetErrorString ("a process is already being debugged");                  return sb_process; -            }             +            }          } -         +          if (state == eStateConnected)          {              // If we are already connected, then we have already specified the @@ -1078,12 +1103,11 @@ SBTarget::AttachToProcessWithName      {          error.SetErrorString ("SBTarget is invalid");      } -     +      if (log) -    {          log->Printf ("SBTarget(%p)::AttachToPorcessWithName (...) => SBProcess(%p)", -                     target_sp.get(), process_sp.get()); -    } +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(process_sp.get()));      return sb_process;  } @@ -1101,12 +1125,11 @@ SBTarget::ConnectRemote      SBProcess sb_process;      ProcessSP process_sp;      TargetSP target_sp(GetSP()); -     +      if (log) -    { -        log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...", target_sp.get(), url, plugin_name); -    } -     +        log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...", +                     static_cast<void*>(target_sp.get()), url, plugin_name); +      if (target_sp)      {          Mutex::Locker api_locker (target_sp->GetAPIMutex()); @@ -1114,8 +1137,7 @@ SBTarget::ConnectRemote              process_sp = target_sp->CreateProcess (listener.ref(), plugin_name, NULL);          else              process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), plugin_name, NULL); -         -         +          if (process_sp)          {              sb_process.SetSP (process_sp); @@ -1130,12 +1152,11 @@ SBTarget::ConnectRemote      {          error.SetErrorString ("SBTarget is invalid");      } -     +      if (log) -    {          log->Printf ("SBTarget(%p)::ConnectRemote (...) => SBProcess(%p)", -                     target_sp.get(), process_sp.get()); -    } +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(process_sp.get()));      return sb_process;  } @@ -1155,8 +1176,9 @@ SBTarget::GetExecutable ()      Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));      if (log)      { -        log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)",  -                     target_sp.get(), exe_file_spec.get()); +        log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)", +                     static_cast<void*>(target_sp.get()), +                     static_cast<const void*>(exe_file_spec.get()));      }      return exe_file_spec; @@ -1258,7 +1280,7 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,      if (target_sp && line != 0)      {          Mutex::Locker api_locker (target_sp->GetAPIMutex()); -         +          const LazyBool check_inlines = eLazyBoolCalculate;          const LazyBool skip_prologue = eLazyBoolCalculate;          const bool internal = false; @@ -1272,12 +1294,9 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,          sb_bp.GetDescription (sstr);          char path[PATH_MAX];          sb_file_spec->GetPath (path, sizeof(path)); -        log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s",  -                     target_sp.get(),  -                     path, -                     line,  -                     sb_bp.get(), -                     sstr.GetData()); +        log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s", +                     static_cast<void*>(target_sp.get()), path, line, +                     static_cast<void*>(sb_bp.get()), sstr.GetData());      }      return sb_bp; @@ -1294,7 +1313,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,      if (target_sp.get())      {          Mutex::Locker api_locker (target_sp->GetAPIMutex()); -         +          const bool internal = false;          const bool hardware = false;          const LazyBool skip_prologue = eLazyBoolCalculate; @@ -1309,12 +1328,11 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,              *sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, skip_prologue, internal, hardware);          }      } -     +      if (log) -    { -        log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)",  -                     target_sp.get(), symbol_name, module_name, sb_bp.get()); -    } +        log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()), symbol_name, +                     module_name, static_cast<void*>(sb_bp.get()));      return sb_bp;  } @@ -1352,12 +1370,11 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,                                                internal,                                                hardware);      } -     +      if (log) -    { -        log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)",  -                     target_sp.get(), symbol_name, name_type_mask, sb_bp.get()); -    } +        log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()), symbol_name, +                     name_type_mask, static_cast<void*>(sb_bp.get()));      return sb_bp;  } @@ -1388,10 +1405,11 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],                                                  internal,                                                  hardware);      } -     +      if (log)      { -        log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbols={", target_sp.get()); +        log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbols={", +                     static_cast<void*>(target_sp.get()));          for (uint32_t i = 0 ; i < num_names; i++)          {              char sep; @@ -1403,9 +1421,9 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],                  log->Printf ("\"%s\"%c ", symbol_names[i], sep);              else                  log->Printf ("\"<NULL>\"%c ", sep); -                      } -        log->Printf ("name_type: %d) => SBBreakpoint(%p)", name_type_mask, sb_bp.get()); +        log->Printf ("name_type: %d) => SBBreakpoint(%p)", name_type_mask, +                     static_cast<void*>(sb_bp.get()));      }      return sb_bp; @@ -1426,12 +1444,12 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,          const bool internal = false;          const bool hardware = false;          const LazyBool skip_prologue = eLazyBoolCalculate; -         +          if (module_name && module_name[0])          {              FileSpecList module_spec_list;              module_spec_list.Append (FileSpec (module_name, false)); -             +              *sb_bp = target_sp->CreateFuncRegexBreakpoint (&module_spec_list, NULL, regexp, skip_prologue, internal, hardware);          }          else @@ -1441,10 +1459,9 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,      }      if (log) -    { -        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",  -                     target_sp.get(), symbol_name_regex, module_name, sb_bp.get()); -    } +        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()), symbol_name_regex, +                     module_name, static_cast<void*>(sb_bp.get()));      return sb_bp;  } @@ -1465,15 +1482,14 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,          const bool internal = false;          const bool hardware = false;          const LazyBool skip_prologue = eLazyBoolCalculate; -         +          *sb_bp = target_sp->CreateFuncRegexBreakpoint (module_list.get(), comp_unit_list.get(), regexp, skip_prologue, internal, hardware);      }      if (log) -    { -        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") => SBBreakpoint(%p)",  -                     target_sp.get(), symbol_name_regex, sb_bp.get()); -    } +        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()), symbol_name_regex, +                     static_cast<void*>(sb_bp.get()));      return sb_bp;  } @@ -1491,11 +1507,12 @@ SBTarget::BreakpointCreateByAddress (addr_t address)          const bool hardware = false;          *sb_bp = target_sp->CreateBreakpoint (address, false, hardware);      } -     +      if (log) -    { -        log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)", target_sp.get(), (uint64_t) address, sb_bp.get()); -    } +        log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()), +                     static_cast<uint64_t>(address), +                     static_cast<void*>(sb_bp.get()));      return sb_bp;  } @@ -1516,12 +1533,12 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,          FileSpecList source_file_spec_list;          const bool hardware = false;          source_file_spec_list.Append (source_file.ref()); -         +          if (module_name && module_name[0])          {              FileSpecList module_spec_list;              module_spec_list.Append (FileSpec (module_name, false)); -             +              *sb_bp = target_sp->CreateSourceRegexBreakpoint (&module_spec_list, &source_file_spec_list, regexp, false, hardware);          }          else @@ -1534,8 +1551,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,      {          char path[PATH_MAX];          source_file->GetPath (path, sizeof(path)); -        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",  -                     target_sp.get(), source_regex, path, module_name, sb_bp.get()); +        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()), source_regex, path, +                     module_name, static_cast<void*>(sb_bp.get()));      }      return sb_bp; @@ -1559,10 +1577,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,      }      if (log) -    { -        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") => SBBreakpoint(%p)",  -                     target_sp.get(), source_regex, sb_bp.get()); -    } +        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()), source_regex, +                     static_cast<void*>(sb_bp.get()));      return sb_bp;  } @@ -1584,14 +1601,11 @@ SBTarget::BreakpointCreateForException  (lldb::LanguageType language,      }      if (log) -    { -        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)",  -                     target_sp.get(), +        log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()),                       LanguageRuntime::GetNameForLanguageType(language), -                     catch_bp ? "on" : "off", -                     throw_bp ? "on" : "off", -                     sb_bp.get()); -    } +                     catch_bp ? "on" : "off", throw_bp ? "on" : "off", +                     static_cast<void*>(sb_bp.get()));      return sb_bp;  } @@ -1635,9 +1649,9 @@ SBTarget::BreakpointDelete (break_id_t bp_id)      }      if (log) -    { -        log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", target_sp.get(), (uint32_t) bp_id, result); -    } +        log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", +                     static_cast<void*>(target_sp.get()), +                     static_cast<uint32_t>(bp_id), result);      return result;  } @@ -1656,10 +1670,10 @@ SBTarget::FindBreakpointByID (break_id_t bp_id)      }      if (log) -    { -        log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)",  -                     target_sp.get(), (uint32_t) bp_id, sb_breakpoint.get()); -    } +        log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)", +                     static_cast<void*>(target_sp.get()), +                     static_cast<uint32_t>(bp_id), +                     static_cast<void*>(sb_breakpoint.get()));      return sb_breakpoint;  } @@ -1744,9 +1758,9 @@ SBTarget::DeleteWatchpoint (watch_id_t wp_id)      }      if (log) -    { -        log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i", target_sp.get(), (uint32_t) wp_id, result); -    } +        log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i", +                     static_cast<void*>(target_sp.get()), +                     static_cast<uint32_t>(wp_id), result);      return result;  } @@ -1769,10 +1783,10 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id)      }      if (log) -    { -        log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)",  -                     target_sp.get(), (uint32_t) wp_id, watchpoint_sp.get()); -    } +        log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)", +                     static_cast<void*>(target_sp.get()), +                     static_cast<uint32_t>(wp_id), +                     static_cast<void*>(watchpoint_sp.get()));      return sb_watchpoint;  } @@ -1781,7 +1795,7 @@ lldb::SBWatchpoint  SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, SBError &error)  {      Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); -     +      SBWatchpoint sb_watchpoint;      lldb::WatchpointSP watchpoint_sp;      TargetSP target_sp(GetSP()); @@ -1798,7 +1812,7 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S              error.SetErrorString("Can't create a watchpoint that is neither read nor write.");              return sb_watchpoint;          } -         +          // Target::CreateWatchpoint() is thread safe.          Error cw_error;          // This API doesn't take in a type, so we can't figure out what it is. @@ -1807,13 +1821,13 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S          error.SetError(cw_error);          sb_watchpoint.SetSP (watchpoint_sp);      } -     +      if (log) -    {          log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%" PRIx64 ", 0x%u) => SBWatchpoint(%p)", -                     target_sp.get(), addr, (uint32_t) size, watchpoint_sp.get()); -    } -     +                     static_cast<void*>(target_sp.get()), addr, +                     static_cast<uint32_t>(size), +                     static_cast<void*>(watchpoint_sp.get())); +      return sb_watchpoint;  } @@ -1860,7 +1874,7 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)          if (pointer_ast_type)          {              lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t))); -             +              ExecutionContext exe_ctx (ExecutionContextRef(ExecutionContext(m_opaque_sp.get(),false)));              ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),                                                                                 pointer_ast_type, @@ -1868,7 +1882,7 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)                                                                                 buffer,                                                                                 exe_ctx.GetByteOrder(),                                                                                 exe_ctx.GetAddressByteSize())); -             +              if (ptr_result_valobj_sp)              {                  ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress); @@ -1884,9 +1898,12 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)      if (log)      {          if (new_value_sp) -            log->Printf ("SBTarget(%p)::CreateValueFromAddress => \"%s\"", m_opaque_sp.get(), new_value_sp->GetName().AsCString()); +            log->Printf ("SBTarget(%p)::CreateValueFromAddress => \"%s\"", +                         static_cast<void*>(m_opaque_sp.get()), +                         new_value_sp->GetName().AsCString());          else -            log->Printf ("SBTarget(%p)::CreateValueFromAddress => NULL", m_opaque_sp.get()); +            log->Printf ("SBTarget(%p)::CreateValueFromAddress => NULL", +                         static_cast<void*>(m_opaque_sp.get()));      }      return sb_value;  } @@ -1981,7 +1998,8 @@ SBTarget::GetNumModules () const      }      if (log) -        log->Printf ("SBTarget(%p)::GetNumModules () => %d", target_sp.get(), num); +        log->Printf ("SBTarget(%p)::GetNumModules () => %d", +                     static_cast<void*>(target_sp.get()), num);      return num;  } @@ -1992,7 +2010,8 @@ SBTarget::Clear ()      Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));      if (log) -        log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get()); +        log->Printf ("SBTarget(%p)::Clear ()", +                     static_cast<void*>(m_opaque_sp.get()));      m_opaque_sp.reset();  } @@ -2063,10 +2082,9 @@ SBTarget::GetModuleAtIndex (uint32_t idx)      }      if (log) -    { -        log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)",  -                     target_sp.get(), idx, module_sp.get()); -    } +        log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)", +                     static_cast<void*>(target_sp.get()), idx, +                     static_cast<void*>(module_sp.get()));      return sb_module;  } @@ -2088,10 +2106,11 @@ SBTarget::GetBroadcaster () const      TargetSP target_sp(GetSP());      SBBroadcaster broadcaster(target_sp.get(), false); -     +      if (log) -        log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)",  -                     target_sp.get(), broadcaster.get()); +        log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)", +                     static_cast<void*>(target_sp.get()), +                     static_cast<void*>(broadcaster.get()));      return broadcaster;  } @@ -2432,10 +2451,6 @@ SBTarget::SetSectionLoadAddress (lldb::SBSection section,                  else                  {                      ProcessSP process_sp (target_sp->GetProcessSP()); -                    uint32_t stop_id = 0; -                    if (process_sp) -                        stop_id = process_sp->GetStopID(); -                      if (target_sp->SetSectionLoadAddress (section_sp, section_base_addr))                      {                          // Flush info in the process (stack frames, etc) @@ -2468,10 +2483,6 @@ SBTarget::ClearSectionLoadAddress (lldb::SBSection section)          else          {              ProcessSP process_sp (target_sp->GetProcessSP()); -            uint32_t stop_id = 0; -            if (process_sp) -                stop_id = process_sp->GetStopID(); -              if (target_sp->SetSectionUnloaded (section.GetSP()))              {                  // Flush info in the process (stack frames, etc) @@ -2547,9 +2558,6 @@ SBTarget::ClearModuleLoadAddress (lldb::SBModule module)                  if (section_list)                  {                      ProcessSP process_sp (target_sp->GetProcessSP()); -                    uint32_t stop_id = 0; -                    if (process_sp) -                        stop_id = process_sp->GetStopID();                      bool changed = false;                      const size_t num_sections = section_list->GetSize(); @@ -2557,7 +2565,7 @@ SBTarget::ClearModuleLoadAddress (lldb::SBModule module)                      {                          SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));                          if (section_sp) -                            changed |= target_sp->SetSectionUnloaded (section_sp) > 0; +                            changed |= target_sp->SetSectionUnloaded (section_sp);                      }                      if (changed)                      { @@ -2619,7 +2627,7 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio      Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));      Log * expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));      SBValue expr_result; -    ExecutionResults exe_results = eExecutionSetupError; +    ExpressionResults exe_results = eExpressionSetupError;      ValueObjectSP expr_value_sp;      TargetSP target_sp(GetSP());      StackFrame *frame = NULL; @@ -2631,16 +2639,16 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio                  log->Printf ("SBTarget::EvaluateExpression called with an empty expression");              return expr_result;          } -         +          Mutex::Locker api_locker (target_sp->GetAPIMutex());          ExecutionContext exe_ctx (m_opaque_sp.get()); -         +          if (log)              log->Printf ("SBTarget()::EvaluateExpression (expr=\"%s\")...", expr); -         +          frame = exe_ctx.GetFramePtr();          Target *target = exe_ctx.GetTargetPtr(); -         +          if (target)          {  #ifdef LLDB_CONFIGURATION_DEBUG @@ -2669,17 +2677,14 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio  #ifndef LLDB_DISABLE_PYTHON      if (expr_log)          expr_log->Printf("** [SBTarget::EvaluateExpression] Expression result is %s, summary %s **", -                         expr_result.GetValue(), -                         expr_result.GetSummary()); -     +                         expr_result.GetValue(), expr_result.GetSummary()); +      if (log)          log->Printf ("SBTarget(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)", -                     frame, -                     expr, -                     expr_value_sp.get(), -                     exe_results); +                     static_cast<void*>(frame), expr, +                     static_cast<void*>(expr_value_sp.get()), exe_results);  #endif -     +      return expr_result;  }  | 
