SBTarget.h revision d5b0b447221ab6e1fe5c5223c6bf7604d4377e8b
19a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//===-- SBTarget.h ----------------------------------------------*- C++ -*-===//
29a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//
39a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//                     The LLVM Compiler Infrastructure
49a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//
59a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// This file is distributed under the University of Illinois Open Source
69a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// License. See LICENSE.TXT for details.
79a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//
89a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//===----------------------------------------------------------------------===//
99a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
109a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#ifndef LLDB_SBTarget_h_
119a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#define LLDB_SBTarget_h_
129a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
139a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "lldb/API/SBDefines.h"
149a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "lldb/API/SBAddress.h"
159a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "lldb/API/SBBroadcaster.h"
169a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "lldb/API/SBFileSpec.h"
179a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "lldb/API/SBFileSpecList.h"
189a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "lldb/API/SBType.h"
199a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include "lldb/API/SBWatchpoint.h"
209a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
219a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgnamespace lldb {
229a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
239a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass SBBreakpoint;
249a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
259a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass SBTarget
269a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org{
279a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgpublic:
289a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
299a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    // Broadcaster bits.
309a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
31e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org    enum
329a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    {
339a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org        eBroadcastBitBreakpointChanged  = (1 << 0),
349a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org        eBroadcastBitModulesLoaded      = (1 << 1),
359a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org        eBroadcastBitModulesUnloaded    = (1 << 2)
369a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    };
379a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
389a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
399a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    // Constructors
409a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
419a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    SBTarget ();
429a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
439a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    SBTarget (const lldb::SBTarget& rhs);
449a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
459a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#ifndef SWIG
469a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    const lldb::SBTarget&
479a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    operator = (const lldb::SBTarget& rhs);
489a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#endif
499a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
509a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
519a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    // Destructor
529a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
539a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ~SBTarget();
549a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
559a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    bool
569a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    IsValid() const;
579a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
589a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    lldb::SBProcess
599a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    GetProcess ();
609a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
619a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
629a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Launch a new process.
639a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
649a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Launch a new process by spawning a new process using the
659a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// target object's executable module's file as the file to launch.
669a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Arguments are given in \a argv, and the environment variables
679a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// are in \a envp. Standard input and output files can be
689a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// optionally re-directed to \a stdin_path, \a stdout_path, and
699a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// \a stderr_path.
709a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
719a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] listener
729a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     An optional listener that will receive all process events.
739a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     If \a listener is valid then \a listener will listen to all
749a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     process events. If not valid, then this target's debugger
759a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     (SBTarget::GetDebugger()) will listen to all process events.
769a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
779a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] argv
789a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The argument array.
799a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
809a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] envp
819a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The environment array.
829a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
839a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] launch_flags
849a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     Flags to modify the launch (@see lldb::LaunchFlags)
859a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
869a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] stdin_path
879a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The path to use when re-directing the STDIN of the new
889a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     process. If all stdXX_path arguments are NULL, a pseudo
899a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     terminal will be used.
909a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
919a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] stdout_path
929a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The path to use when re-directing the STDOUT of the new
939a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     process. If all stdXX_path arguments are NULL, a pseudo
949a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     terminal will be used.
959a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
969a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] stderr_path
979a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The path to use when re-directing the STDERR of the new
989a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     process. If all stdXX_path arguments are NULL, a pseudo
999a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     terminal will be used.
1009a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1019a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] working_directory
1029a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The working directory to have the child process run in
1039a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1049a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] launch_flags
1059a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     Some launch options specified by logical OR'ing
1069a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     lldb::LaunchFlags enumeration values together.
1079a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1089a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] stop_at_endtry
1099a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     If false do not stop the inferior at the entry point.
1109a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1119a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[out]
1129a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     An error object. Contains the reason if there is some failure.
1139a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1149a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @return
1159a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///      A process object for the newly created process.
1169a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
1179a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    lldb::SBProcess
1189a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    Launch (SBListener &listener,
1199a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            char const **argv,
1209a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            char const **envp,
1219a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            const char *stdin_path,
1229a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            const char *stdout_path,
1239a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            const char *stderr_path,
1249a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            const char *working_directory,
1259a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            uint32_t launch_flags,   // See LaunchFlags
1269a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            bool stop_at_entry,
1279a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org            lldb::SBError& error);
1289a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
1299a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
1309a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
1319a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Launch a new process with sensible defaults.
1329a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1339a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] argv
1349a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The argument array.
1359a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1369a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] envp
1379a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The environment array.
1389a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1399a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] working_directory
1409a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The working directory to have the child process run in
1419a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1429a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Default: listener
1439a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     Set to the target's debugger (SBTarget::GetDebugger())
1449a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1459a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Default: launch_flags
1469a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     Empty launch flags
1479a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1489a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Default: stdin_path
1499a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Default: stdout_path
1509a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Default: stderr_path
1519a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     A pseudo terminal will be used.
1529a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1530e9c399746f45ceaf46f12b11ba93c09cca0c2bbhenrik.lundin@webrtc.org    /// @return
1549a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///      A process object for the newly created process.
1559a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
1569a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    lldb::SBProcess
1579a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    LaunchSimple (const char **argv,
1589a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                  const char **envp,
1599a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                  const char *working_directory);
1609a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
1619a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
1629a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// Attach to process with pid.
1639a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1649a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] listener
1659a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     An optional listener that will receive all process events.
1669a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     If \a listener is valid then \a listener will listen to all
1679a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     process events. If not valid, then this target's debugger
1689a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     (SBTarget::GetDebugger()) will listen to all process events.
1699a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1709a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[in] pid
1719a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     The process ID to attach to.
1729a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1739a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @param[out]
1749a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///     An error explaining what went wrong if attach fails.
1759a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///
1769a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    /// @return
1779a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    ///      A process object for the attached process.
1789a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
1799a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    lldb::SBProcess
1809a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    AttachToProcessWithID (SBListener &listener,
1819a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                           lldb::pid_t pid,
1829a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                           lldb::SBError& error);
1839a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
184d4fa81febd85b072fea77822c07958bffca13b8ahenrik.lundin@webrtc.org#if defined(__APPLE__)
185d4fa81febd85b072fea77822c07958bffca13b8ahenrik.lundin@webrtc.org    // We need to keep this around for a build or two since Xcode links
186d4fa81febd85b072fea77822c07958bffca13b8ahenrik.lundin@webrtc.org    // to the 32 bit version of this function. We will take it out soon.
187d4fa81febd85b072fea77822c07958bffca13b8ahenrik.lundin@webrtc.org    lldb::SBProcess
1889a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    AttachToProcessWithID (SBListener &listener,
1899a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                           ::pid_t pid,           // 32 bit int process ID
1909a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org                           lldb::SBError& error); // DEPRECATED
1919a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#endif
1929a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org    //------------------------------------------------------------------
193    /// Attach to process with name.
194    ///
195    /// @param[in] listener
196    ///     An optional listener that will receive all process events.
197    ///     If \a listener is valid then \a listener will listen to all
198    ///     process events. If not valid, then this target's debugger
199    ///     (SBTarget::GetDebugger()) will listen to all process events.
200    ///
201    /// @param[in] name
202    ///     Basename of process to attach to.
203    ///
204    /// @param[in] wait_for
205    ///     If true wait for a new instance of 'name' to be launched.
206    ///
207    /// @param[out]
208    ///     An error explaining what went wrong if attach fails.
209    ///
210    /// @return
211    ///      A process object for the attached process.
212    //------------------------------------------------------------------
213    lldb::SBProcess
214    AttachToProcessWithName (SBListener &listener,
215                             const char *name,
216                             bool wait_for,
217                             lldb::SBError& error);
218
219    //------------------------------------------------------------------
220    /// Connect to a remote debug server with url.
221    ///
222    /// @param[in] listener
223    ///     An optional listener that will receive all process events.
224    ///     If \a listener is valid then \a listener will listen to all
225    ///     process events. If not valid, then this target's debugger
226    ///     (SBTarget::GetDebugger()) will listen to all process events.
227    ///
228    /// @param[in] url
229    ///     The url to connect to, e.g., 'connect://localhost:12345'.
230    ///
231    /// @param[in] plugin_name
232    ///     The plugin name to be used; can be NULL.
233    ///
234    /// @param[out]
235    ///     An error explaining what went wrong if the connect fails.
236    ///
237    /// @return
238    ///      A process object for the connected process.
239    //------------------------------------------------------------------
240    lldb::SBProcess
241    ConnectRemote (SBListener &listener,
242                   const char *url,
243                   const char *plugin_name,
244                   SBError& error);
245
246    lldb::SBFileSpec
247    GetExecutable ();
248
249    bool
250    AddModule (lldb::SBModule &module);
251
252    lldb::SBModule
253    AddModule (const char *path,
254               const char *triple,
255               const char *uuid);
256
257    uint32_t
258    GetNumModules () const;
259
260    lldb::SBModule
261    GetModuleAtIndex (uint32_t idx);
262
263    bool
264    RemoveModule (lldb::SBModule module);
265
266    lldb::SBDebugger
267    GetDebugger() const;
268
269    lldb::SBModule
270    FindModule (const lldb::SBFileSpec &file_spec);
271
272    //------------------------------------------------------------------
273    /// Set the base load address for a module section.
274    ///
275    /// @param[in] section
276    ///     The section whose base load address will be set within this
277    ///     target.
278    ///
279    /// @param[in] section_base_addr
280    ///     The base address for the section.
281    ///
282    /// @return
283    ///      An error to indicate success, fail, and any reason for
284    ///     failure.
285    //------------------------------------------------------------------
286    lldb::SBError
287    SetSectionLoadAddress (lldb::SBSection section,
288                           lldb::addr_t section_base_addr);
289
290    //------------------------------------------------------------------
291    /// Clear the base load address for a module section.
292    ///
293    /// @param[in] section
294    ///     The section whose base load address will be cleared within
295    ///     this target.
296    ///
297    /// @return
298    ///      An error to indicate success, fail, and any reason for
299    ///     failure.
300    //------------------------------------------------------------------
301    lldb::SBError
302    ClearSectionLoadAddress (lldb::SBSection section);
303
304    //------------------------------------------------------------------
305    /// Slide all file addresses for all module sections so that \a module
306    /// appears to loaded at these slide addresses.
307    ///
308    /// When you need all sections within a module to be loaded at a
309    /// rigid slide from the addresses found in the module object file,
310    /// this function will allow you to easily and quickly slide all
311    /// module sections.
312    ///
313    /// @param[in] module
314    ///     The module to load.
315    ///
316    /// @param[in] sections_offset
317    ///     An offset that will be applied to all section file addresses
318    ///     (the virtual addresses found in the object file itself).
319    ///
320    /// @return
321    ///     An error to indicate success, fail, and any reason for
322    ///     failure.
323    //------------------------------------------------------------------
324    lldb::SBError
325    SetModuleLoadAddress (lldb::SBModule module,
326                          int64_t sections_offset);
327
328
329    //------------------------------------------------------------------
330    /// The the section base load addresses for all sections in a module.
331    ///
332    /// @param[in] module
333    ///     The module to unload.
334    ///
335    /// @return
336    ///     An error to indicate success, fail, and any reason for
337    ///     failure.
338    //------------------------------------------------------------------
339    lldb::SBError
340    ClearModuleLoadAddress (lldb::SBModule module);
341
342    //------------------------------------------------------------------
343    /// Find functions by name.
344    ///
345    /// @param[in] name
346    ///     The name of the function we are looking for.
347    ///
348    /// @param[in] name_type_mask
349    ///     A logical OR of one or more FunctionNameType enum bits that
350    ///     indicate what kind of names should be used when doing the
351    ///     lookup. Bits include fully qualified names, base names,
352    ///     C++ methods, or ObjC selectors.
353    ///     See FunctionNameType for more details.
354    ///
355    /// @param[in] append
356    ///     If true, any matches will be appended to \a sc_list, else
357    ///     matches replace the contents of \a sc_list.
358    ///
359    /// @param[out] sc_list
360    ///     A symbol context list that gets filled in with all of the
361    ///     matches.
362    ///
363    /// @return
364    ///     The number of matches added to \a sc_list.
365    //------------------------------------------------------------------
366    uint32_t
367    FindFunctions (const char *name,
368                   uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
369                   bool append,
370                   lldb::SBSymbolContextList& sc_list);
371
372    //------------------------------------------------------------------
373    /// Find global and static variables by name.
374    ///
375    /// @param[in] name
376    ///     The name of the global or static variable we are looking
377    ///     for.
378    ///
379    /// @param[in] max_matches
380    ///     Allow the number of matches to be limited to \a max_matches.
381    ///
382    /// @return
383    ///     A list of matched variables in an SBValueList.
384    //------------------------------------------------------------------
385    lldb::SBValueList
386    FindGlobalVariables (const char *name,
387                         uint32_t max_matches);
388
389    void
390    Clear ();
391
392    lldb::SBAddress
393    ResolveLoadAddress (lldb::addr_t vm_addr);
394
395    SBSymbolContext
396    ResolveSymbolContextForAddress (const SBAddress& addr,
397                                    uint32_t resolve_scope);
398
399    lldb::SBBreakpoint
400    BreakpointCreateByLocation (const char *file, uint32_t line);
401
402    lldb::SBBreakpoint
403    BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
404
405    lldb::SBBreakpoint
406    BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
407
408    // This version uses name_type_mask = eFunctionNameTypeAuto
409    lldb::SBBreakpoint
410    BreakpointCreateByName (const char *symbol_name,
411                            const SBFileSpecList &module_list,
412                            const SBFileSpecList &comp_unit_list);
413
414    lldb::SBBreakpoint
415    BreakpointCreateByName (const char *symbol_name,
416                            uint32_t name_type_mask,           // Logical OR one or more FunctionNameType enum bits
417                            const SBFileSpecList &module_list,
418                            const SBFileSpecList &comp_unit_list);
419
420    lldb::SBBreakpoint
421    BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
422
423    lldb::SBBreakpoint
424    BreakpointCreateByRegex (const char *symbol_name_regex,
425                             const SBFileSpecList &module_list,
426                             const SBFileSpecList &comp_unit_list);
427
428    lldb::SBBreakpoint
429    BreakpointCreateBySourceRegex (const char *source_regex,
430                                   const lldb::SBFileSpec &source_file,
431                                   const char *module_name = NULL);
432
433    lldb::SBBreakpoint
434    BreakpointCreateBySourceRegex (const char *source_regex,
435                                   const SBFileSpecList &module_list,
436                                   const lldb::SBFileSpecList &source_file);
437
438    lldb::SBBreakpoint
439    BreakpointCreateByAddress (addr_t address);
440
441    uint32_t
442    GetNumBreakpoints () const;
443
444    lldb::SBBreakpoint
445    GetBreakpointAtIndex (uint32_t idx) const;
446
447    bool
448    BreakpointDelete (break_id_t break_id);
449
450    lldb::SBBreakpoint
451    FindBreakpointByID (break_id_t break_id);
452
453    bool
454    EnableAllBreakpoints ();
455
456    bool
457    DisableAllBreakpoints ();
458
459    bool
460    DeleteAllBreakpoints ();
461
462    uint32_t
463    GetNumWatchpoints () const;
464
465    lldb::SBWatchpoint
466    GetWatchpointAtIndex (uint32_t idx) const;
467
468    bool
469    DeleteWatchpoint (lldb::watch_id_t watch_id);
470
471    lldb::SBWatchpoint
472    FindWatchpointByID (lldb::watch_id_t watch_id);
473
474    lldb::SBWatchpoint
475    WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write);
476
477    bool
478    EnableAllWatchpoints ();
479
480    bool
481    DisableAllWatchpoints ();
482
483    bool
484    DeleteAllWatchpoints ();
485
486    lldb::SBBroadcaster
487    GetBroadcaster () const;
488
489    lldb::SBType
490    FindFirstType (const char* type);
491
492    lldb::SBTypeList
493    FindTypes (const char* type);
494
495    SBSourceManager
496    GetSourceManager();
497
498#ifndef SWIG
499    bool
500    operator == (const lldb::SBTarget &rhs) const;
501
502    bool
503    operator != (const lldb::SBTarget &rhs) const;
504
505#endif
506
507    bool
508    GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
509
510protected:
511    friend class SBAddress;
512    friend class SBDebugger;
513    friend class SBFunction;
514    friend class SBInstruction;
515    friend class SBModule;
516    friend class SBProcess;
517    friend class SBSourceManager;
518    friend class SBSymbol;
519    friend class SBValue;
520
521    //------------------------------------------------------------------
522    // Constructors are private, use static Target::Create function to
523    // create an instance of this class.
524    //------------------------------------------------------------------
525
526    SBTarget (const lldb::TargetSP& target_sp);
527
528    void
529    reset (const lldb::TargetSP& target_sp);
530
531    lldb_private::Target *
532    operator ->() const;
533
534    lldb_private::Target *
535    get() const;
536
537    const lldb::TargetSP &
538    get_sp () const;
539
540private:
541    //------------------------------------------------------------------
542    // For Target only
543    //------------------------------------------------------------------
544
545    lldb::TargetSP m_opaque_sp;
546};
547
548} // namespace lldb
549
550#endif  // LLDB_SBTarget_h_
551