SBTarget.h revision 341825
1254721Semaste//===-- SBTarget.h ----------------------------------------------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste 10254721Semaste#ifndef LLDB_SBTarget_h_ 11254721Semaste#define LLDB_SBTarget_h_ 12254721Semaste 13296417Sdim// C Includes 14296417Sdim// C++ Includes 15296417Sdim// Other libraries and framework includes 16296417Sdim// Project includes 17254721Semaste#include "lldb/API/SBAddress.h" 18288943Sdim#include "lldb/API/SBAttachInfo.h" 19314564Sdim#include "lldb/API/SBBreakpoint.h" 20254721Semaste#include "lldb/API/SBBroadcaster.h" 21314564Sdim#include "lldb/API/SBDefines.h" 22254721Semaste#include "lldb/API/SBFileSpec.h" 23254721Semaste#include "lldb/API/SBFileSpecList.h" 24288943Sdim#include "lldb/API/SBLaunchInfo.h" 25254721Semaste#include "lldb/API/SBSymbolContextList.h" 26254721Semaste#include "lldb/API/SBType.h" 27254721Semaste#include "lldb/API/SBValue.h" 28254721Semaste#include "lldb/API/SBWatchpoint.h" 29254721Semaste 30254721Semastenamespace lldb { 31254721Semaste 32280031Sdimclass SBPlatform; 33280031Sdim 34314564Sdimclass LLDB_API SBTarget { 35254721Semastepublic: 36314564Sdim //------------------------------------------------------------------ 37314564Sdim // Broadcaster bits. 38314564Sdim //------------------------------------------------------------------ 39314564Sdim enum { 40314564Sdim eBroadcastBitBreakpointChanged = (1 << 0), 41314564Sdim eBroadcastBitModulesLoaded = (1 << 1), 42314564Sdim eBroadcastBitModulesUnloaded = (1 << 2), 43314564Sdim eBroadcastBitWatchpointChanged = (1 << 3), 44314564Sdim eBroadcastBitSymbolsLoaded = (1 << 4) 45314564Sdim }; 46254721Semaste 47314564Sdim //------------------------------------------------------------------ 48314564Sdim // Constructors 49314564Sdim //------------------------------------------------------------------ 50314564Sdim SBTarget(); 51254721Semaste 52314564Sdim SBTarget(const lldb::SBTarget &rhs); 53254721Semaste 54314564Sdim SBTarget(const lldb::TargetSP &target_sp); 55254721Semaste 56314564Sdim //------------------------------------------------------------------ 57314564Sdim // Destructor 58314564Sdim //------------------------------------------------------------------ 59314564Sdim ~SBTarget(); 60296417Sdim 61314564Sdim const lldb::SBTarget &operator=(const lldb::SBTarget &rhs); 62288943Sdim 63314564Sdim bool IsValid() const; 64288943Sdim 65314564Sdim static bool EventIsTargetEvent(const lldb::SBEvent &event); 66288943Sdim 67314564Sdim static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event); 68288943Sdim 69314564Sdim static uint32_t GetNumModulesFromEvent(const lldb::SBEvent &event); 70254721Semaste 71314564Sdim static lldb::SBModule GetModuleAtIndexFromEvent(const uint32_t idx, 72314564Sdim const lldb::SBEvent &event); 73254721Semaste 74314564Sdim static const char *GetBroadcasterClassName(); 75280031Sdim 76314564Sdim lldb::SBProcess GetProcess(); 77296417Sdim 78341825Sdim lldb::SBStructuredData GetStatistics(); 79341825Sdim 80314564Sdim //------------------------------------------------------------------ 81314564Sdim /// Return the platform object associated with the target. 82314564Sdim /// 83314564Sdim /// After return, the platform object should be checked for 84314564Sdim /// validity. 85314564Sdim /// 86314564Sdim /// @return 87314564Sdim /// A platform object. 88314564Sdim //------------------------------------------------------------------ 89314564Sdim lldb::SBPlatform GetPlatform(); 90296417Sdim 91314564Sdim //------------------------------------------------------------------ 92314564Sdim /// Install any binaries that need to be installed. 93314564Sdim /// 94314564Sdim /// This function does nothing when debugging on the host system. 95314564Sdim /// When connected to remote platforms, the target's main executable 96314564Sdim /// and any modules that have their remote install path set will be 97314564Sdim /// installed on the remote platform. If the main executable doesn't 98314564Sdim /// have an install location set, it will be installed in the remote 99314564Sdim /// platform's working directory. 100314564Sdim /// 101314564Sdim /// @return 102314564Sdim /// An error describing anything that went wrong during 103314564Sdim /// installation. 104314564Sdim //------------------------------------------------------------------ 105314564Sdim SBError Install(); 106254721Semaste 107314564Sdim //------------------------------------------------------------------ 108314564Sdim /// Launch a new process. 109314564Sdim /// 110314564Sdim /// Launch a new process by spawning a new process using the 111314564Sdim /// target object's executable module's file as the file to launch. 112314564Sdim /// Arguments are given in \a argv, and the environment variables 113314564Sdim /// are in \a envp. Standard input and output files can be 114314564Sdim /// optionally re-directed to \a stdin_path, \a stdout_path, and 115314564Sdim /// \a stderr_path. 116314564Sdim /// 117314564Sdim /// @param[in] listener 118314564Sdim /// An optional listener that will receive all process events. 119314564Sdim /// If \a listener is valid then \a listener will listen to all 120314564Sdim /// process events. If not valid, then this target's debugger 121314564Sdim /// (SBTarget::GetDebugger()) will listen to all process events. 122314564Sdim /// 123314564Sdim /// @param[in] argv 124314564Sdim /// The argument array. 125314564Sdim /// 126314564Sdim /// @param[in] envp 127314564Sdim /// The environment array. 128314564Sdim /// 129314564Sdim /// @param[in] stdin_path 130314564Sdim /// The path to use when re-directing the STDIN of the new 131314564Sdim /// process. If all stdXX_path arguments are nullptr, a pseudo 132314564Sdim /// terminal will be used. 133314564Sdim /// 134314564Sdim /// @param[in] stdout_path 135314564Sdim /// The path to use when re-directing the STDOUT of the new 136314564Sdim /// process. If all stdXX_path arguments are nullptr, a pseudo 137314564Sdim /// terminal will be used. 138314564Sdim /// 139314564Sdim /// @param[in] stderr_path 140314564Sdim /// The path to use when re-directing the STDERR of the new 141314564Sdim /// process. If all stdXX_path arguments are nullptr, a pseudo 142314564Sdim /// terminal will be used. 143314564Sdim /// 144314564Sdim /// @param[in] working_directory 145314564Sdim /// The working directory to have the child process run in 146314564Sdim /// 147314564Sdim /// @param[in] launch_flags 148314564Sdim /// Some launch options specified by logical OR'ing 149314564Sdim /// lldb::LaunchFlags enumeration values together. 150314564Sdim /// 151314564Sdim /// @param[in] stop_at_entry 152314564Sdim /// If false do not stop the inferior at the entry point. 153314564Sdim /// 154314564Sdim /// @param[out] error 155314564Sdim /// An error object. Contains the reason if there is some failure. 156314564Sdim /// 157314564Sdim /// @return 158314564Sdim /// A process object for the newly created process. 159314564Sdim //------------------------------------------------------------------ 160314564Sdim lldb::SBProcess Launch(SBListener &listener, char const **argv, 161314564Sdim char const **envp, const char *stdin_path, 162314564Sdim const char *stdout_path, const char *stderr_path, 163314564Sdim const char *working_directory, 164314564Sdim uint32_t launch_flags, // See LaunchFlags 165314564Sdim bool stop_at_entry, lldb::SBError &error); 166254721Semaste 167314564Sdim SBProcess LoadCore(const char *core_file); 168341825Sdim SBProcess LoadCore(const char *core_file, lldb::SBError &error); 169314564Sdim 170314564Sdim //------------------------------------------------------------------ 171314564Sdim /// Launch a new process with sensible defaults. 172314564Sdim /// 173314564Sdim /// @param[in] argv 174314564Sdim /// The argument array. 175314564Sdim /// 176314564Sdim /// @param[in] envp 177314564Sdim /// The environment array. 178314564Sdim /// 179314564Sdim /// @param[in] working_directory 180314564Sdim /// The working directory to have the child process run in 181314564Sdim /// 182314564Sdim /// Default: listener 183314564Sdim /// Set to the target's debugger (SBTarget::GetDebugger()) 184314564Sdim /// 185314564Sdim /// Default: launch_flags 186314564Sdim /// Empty launch flags 187314564Sdim /// 188314564Sdim /// Default: stdin_path 189314564Sdim /// Default: stdout_path 190314564Sdim /// Default: stderr_path 191314564Sdim /// A pseudo terminal will be used. 192314564Sdim /// 193314564Sdim /// @return 194314564Sdim /// A process object for the newly created process. 195314564Sdim //------------------------------------------------------------------ 196314564Sdim SBProcess LaunchSimple(const char **argv, const char **envp, 197314564Sdim const char *working_directory); 198314564Sdim 199314564Sdim SBProcess Launch(SBLaunchInfo &launch_info, SBError &error); 200314564Sdim 201314564Sdim SBProcess Attach(SBAttachInfo &attach_info, SBError &error); 202314564Sdim 203314564Sdim //------------------------------------------------------------------ 204314564Sdim /// Attach to process with pid. 205314564Sdim /// 206314564Sdim /// @param[in] listener 207314564Sdim /// An optional listener that will receive all process events. 208314564Sdim /// If \a listener is valid then \a listener will listen to all 209314564Sdim /// process events. If not valid, then this target's debugger 210314564Sdim /// (SBTarget::GetDebugger()) will listen to all process events. 211314564Sdim /// 212314564Sdim /// @param[in] pid 213314564Sdim /// The process ID to attach to. 214314564Sdim /// 215314564Sdim /// @param[out] error 216314564Sdim /// An error explaining what went wrong if attach fails. 217314564Sdim /// 218314564Sdim /// @return 219314564Sdim /// A process object for the attached process. 220314564Sdim //------------------------------------------------------------------ 221314564Sdim lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid, 222314564Sdim lldb::SBError &error); 223314564Sdim 224314564Sdim //------------------------------------------------------------------ 225314564Sdim /// Attach to process with name. 226314564Sdim /// 227314564Sdim /// @param[in] listener 228314564Sdim /// An optional listener that will receive all process events. 229314564Sdim /// If \a listener is valid then \a listener will listen to all 230314564Sdim /// process events. If not valid, then this target's debugger 231314564Sdim /// (SBTarget::GetDebugger()) will listen to all process events. 232314564Sdim /// 233314564Sdim /// @param[in] name 234314564Sdim /// Basename of process to attach to. 235314564Sdim /// 236314564Sdim /// @param[in] wait_for 237314564Sdim /// If true wait for a new instance of 'name' to be launched. 238314564Sdim /// 239314564Sdim /// @param[out] error 240314564Sdim /// An error explaining what went wrong if attach fails. 241314564Sdim /// 242314564Sdim /// @return 243314564Sdim /// A process object for the attached process. 244314564Sdim //------------------------------------------------------------------ 245314564Sdim lldb::SBProcess AttachToProcessWithName(SBListener &listener, 246314564Sdim const char *name, bool wait_for, 247314564Sdim lldb::SBError &error); 248254721Semaste 249314564Sdim //------------------------------------------------------------------ 250314564Sdim /// Connect to a remote debug server with url. 251314564Sdim /// 252314564Sdim /// @param[in] listener 253314564Sdim /// An optional listener that will receive all process events. 254314564Sdim /// If \a listener is valid then \a listener will listen to all 255314564Sdim /// process events. If not valid, then this target's debugger 256314564Sdim /// (SBTarget::GetDebugger()) will listen to all process events. 257314564Sdim /// 258314564Sdim /// @param[in] url 259314564Sdim /// The url to connect to, e.g., 'connect://localhost:12345'. 260314564Sdim /// 261314564Sdim /// @param[in] plugin_name 262314564Sdim /// The plugin name to be used; can be nullptr. 263314564Sdim /// 264314564Sdim /// @param[out] error 265314564Sdim /// An error explaining what went wrong if the connect fails. 266314564Sdim /// 267314564Sdim /// @return 268314564Sdim /// A process object for the connected process. 269314564Sdim //------------------------------------------------------------------ 270314564Sdim lldb::SBProcess ConnectRemote(SBListener &listener, const char *url, 271314564Sdim const char *plugin_name, SBError &error); 272254721Semaste 273314564Sdim lldb::SBFileSpec GetExecutable(); 274254721Semaste 275314564Sdim bool AddModule(lldb::SBModule &module); 276254721Semaste 277314564Sdim lldb::SBModule AddModule(const char *path, const char *triple, 278314564Sdim const char *uuid); 279254721Semaste 280314564Sdim lldb::SBModule AddModule(const char *path, const char *triple, 281314564Sdim const char *uuid_cstr, const char *symfile); 282254721Semaste 283314564Sdim lldb::SBModule AddModule(const SBModuleSpec &module_spec); 284254721Semaste 285314564Sdim uint32_t GetNumModules() const; 286254721Semaste 287314564Sdim lldb::SBModule GetModuleAtIndex(uint32_t idx); 288254721Semaste 289314564Sdim bool RemoveModule(lldb::SBModule module); 290254721Semaste 291314564Sdim lldb::SBDebugger GetDebugger() const; 292254721Semaste 293314564Sdim lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec); 294254721Semaste 295341825Sdim //------------------------------------------------------------------ 296341825Sdim /// Find compile units related to *this target and passed source 297341825Sdim /// file. 298341825Sdim /// 299341825Sdim /// @param[in] sb_file_spec 300341825Sdim /// A lldb::SBFileSpec object that contains source file 301341825Sdim /// specification. 302341825Sdim /// 303341825Sdim /// @return 304341825Sdim /// A lldb::SBSymbolContextList that gets filled in with all of 305341825Sdim /// the symbol contexts for all the matches. 306341825Sdim //------------------------------------------------------------------ 307341825Sdim lldb::SBSymbolContextList 308341825Sdim FindCompileUnits(const lldb::SBFileSpec &sb_file_spec); 309341825Sdim 310314564Sdim lldb::ByteOrder GetByteOrder(); 311254721Semaste 312314564Sdim uint32_t GetAddressByteSize(); 313280031Sdim 314314564Sdim const char *GetTriple(); 315280031Sdim 316314564Sdim //------------------------------------------------------------------ 317314564Sdim /// Architecture data byte width accessor 318314564Sdim /// 319314564Sdim /// @return 320314564Sdim /// The size in 8-bit (host) bytes of a minimum addressable 321314564Sdim /// unit from the Architecture's data bus 322314564Sdim //------------------------------------------------------------------ 323314564Sdim uint32_t GetDataByteSize(); 324254721Semaste 325314564Sdim //------------------------------------------------------------------ 326314564Sdim /// Architecture code byte width accessor 327314564Sdim /// 328314564Sdim /// @return 329314564Sdim /// The size in 8-bit (host) bytes of a minimum addressable 330314564Sdim /// unit from the Architecture's code bus 331314564Sdim //------------------------------------------------------------------ 332314564Sdim uint32_t GetCodeByteSize(); 333254721Semaste 334314564Sdim //------------------------------------------------------------------ 335314564Sdim /// Set the base load address for a module section. 336314564Sdim /// 337314564Sdim /// @param[in] section 338314564Sdim /// The section whose base load address will be set within this 339314564Sdim /// target. 340314564Sdim /// 341314564Sdim /// @param[in] section_base_addr 342314564Sdim /// The base address for the section. 343314564Sdim /// 344314564Sdim /// @return 345314564Sdim /// An error to indicate success, fail, and any reason for 346314564Sdim /// failure. 347314564Sdim //------------------------------------------------------------------ 348314564Sdim lldb::SBError SetSectionLoadAddress(lldb::SBSection section, 349314564Sdim lldb::addr_t section_base_addr); 350254721Semaste 351314564Sdim //------------------------------------------------------------------ 352314564Sdim /// Clear the base load address for a module section. 353314564Sdim /// 354314564Sdim /// @param[in] section 355314564Sdim /// The section whose base load address will be cleared within 356314564Sdim /// this target. 357314564Sdim /// 358314564Sdim /// @return 359314564Sdim /// An error to indicate success, fail, and any reason for 360314564Sdim /// failure. 361314564Sdim //------------------------------------------------------------------ 362314564Sdim lldb::SBError ClearSectionLoadAddress(lldb::SBSection section); 363254721Semaste 364314564Sdim //------------------------------------------------------------------ 365314564Sdim /// Slide all file addresses for all module sections so that \a module 366314564Sdim /// appears to loaded at these slide addresses. 367314564Sdim /// 368314564Sdim /// When you need all sections within a module to be loaded at a 369314564Sdim /// rigid slide from the addresses found in the module object file, 370314564Sdim /// this function will allow you to easily and quickly slide all 371314564Sdim /// module sections. 372314564Sdim /// 373314564Sdim /// @param[in] module 374314564Sdim /// The module to load. 375314564Sdim /// 376314564Sdim /// @param[in] sections_offset 377314564Sdim /// An offset that will be applied to all section file addresses 378314564Sdim /// (the virtual addresses found in the object file itself). 379314564Sdim /// 380314564Sdim /// @return 381314564Sdim /// An error to indicate success, fail, and any reason for 382314564Sdim /// failure. 383314564Sdim //------------------------------------------------------------------ 384314564Sdim lldb::SBError SetModuleLoadAddress(lldb::SBModule module, 385314564Sdim int64_t sections_offset); 386280031Sdim 387314564Sdim //------------------------------------------------------------------ 388314564Sdim /// Clear the section base load addresses for all sections in a module. 389314564Sdim /// 390314564Sdim /// @param[in] module 391314564Sdim /// The module to unload. 392314564Sdim /// 393314564Sdim /// @return 394314564Sdim /// An error to indicate success, fail, and any reason for 395314564Sdim /// failure. 396314564Sdim //------------------------------------------------------------------ 397314564Sdim lldb::SBError ClearModuleLoadAddress(lldb::SBModule module); 398280031Sdim 399314564Sdim //------------------------------------------------------------------ 400314564Sdim /// Find functions by name. 401314564Sdim /// 402314564Sdim /// @param[in] name 403314564Sdim /// The name of the function we are looking for. 404314564Sdim /// 405314564Sdim /// @param[in] name_type_mask 406314564Sdim /// A logical OR of one or more FunctionNameType enum bits that 407314564Sdim /// indicate what kind of names should be used when doing the 408314564Sdim /// lookup. Bits include fully qualified names, base names, 409314564Sdim /// C++ methods, or ObjC selectors. 410314564Sdim /// See FunctionNameType for more details. 411314564Sdim /// 412314564Sdim /// @return 413314564Sdim /// A lldb::SBSymbolContextList that gets filled in with all of 414314564Sdim /// the symbol contexts for all the matches. 415314564Sdim //------------------------------------------------------------------ 416314564Sdim lldb::SBSymbolContextList 417314564Sdim FindFunctions(const char *name, 418314564Sdim uint32_t name_type_mask = lldb::eFunctionNameTypeAny); 419254721Semaste 420314564Sdim //------------------------------------------------------------------ 421314564Sdim /// Find global and static variables by name. 422314564Sdim /// 423314564Sdim /// @param[in] name 424314564Sdim /// The name of the global or static variable we are looking 425314564Sdim /// for. 426314564Sdim /// 427314564Sdim /// @param[in] max_matches 428314564Sdim /// Allow the number of matches to be limited to \a max_matches. 429314564Sdim /// 430314564Sdim /// @return 431314564Sdim /// A list of matched variables in an SBValueList. 432314564Sdim //------------------------------------------------------------------ 433314564Sdim lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches); 434280031Sdim 435314564Sdim //------------------------------------------------------------------ 436314564Sdim /// Find the first global (or static) variable by name. 437314564Sdim /// 438314564Sdim /// @param[in] name 439314564Sdim /// The name of the global or static variable we are looking 440314564Sdim /// for. 441314564Sdim /// 442314564Sdim /// @return 443314564Sdim /// An SBValue that gets filled in with the found variable (if any). 444314564Sdim //------------------------------------------------------------------ 445314564Sdim lldb::SBValue FindFirstGlobalVariable(const char *name); 446254721Semaste 447314564Sdim //------------------------------------------------------------------ 448314564Sdim /// Find global and static variables by pattern. 449314564Sdim /// 450314564Sdim /// @param[in] name 451314564Sdim /// The pattern to search for global or static variables 452314564Sdim /// 453314564Sdim /// @param[in] max_matches 454314564Sdim /// Allow the number of matches to be limited to \a max_matches. 455314564Sdim /// 456314564Sdim /// @param[in] matchtype 457314564Sdim /// The match type to use. 458314564Sdim /// 459314564Sdim /// @return 460314564Sdim /// A list of matched variables in an SBValueList. 461314564Sdim //------------------------------------------------------------------ 462314564Sdim lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches, 463314564Sdim MatchType matchtype); 464262528Semaste 465314564Sdim //------------------------------------------------------------------ 466314564Sdim /// Find global functions by their name with pattern matching. 467314564Sdim /// 468314564Sdim /// @param[in] name 469314564Sdim /// The pattern to search for global or static variables 470314564Sdim /// 471314564Sdim /// @param[in] max_matches 472314564Sdim /// Allow the number of matches to be limited to \a max_matches. 473314564Sdim /// 474314564Sdim /// @param[in] matchtype 475314564Sdim /// The match type to use. 476314564Sdim /// 477314564Sdim /// @return 478314564Sdim /// A list of matched variables in an SBValueList. 479314564Sdim //------------------------------------------------------------------ 480314564Sdim lldb::SBSymbolContextList FindGlobalFunctions(const char *name, 481314564Sdim uint32_t max_matches, 482314564Sdim MatchType matchtype); 483254721Semaste 484314564Sdim void Clear(); 485280031Sdim 486314564Sdim //------------------------------------------------------------------ 487314564Sdim /// Resolve a current file address into a section offset address. 488314564Sdim /// 489314564Sdim /// @param[in] file_addr 490321369Sdim /// The file address to resolve. 491314564Sdim /// 492314564Sdim /// @return 493314564Sdim /// An SBAddress which will be valid if... 494314564Sdim //------------------------------------------------------------------ 495314564Sdim lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr); 496254721Semaste 497314564Sdim //------------------------------------------------------------------ 498314564Sdim /// Resolve a current load address into a section offset address. 499314564Sdim /// 500314564Sdim /// @param[in] vm_addr 501314564Sdim /// A virtual address from the current process state that is to 502314564Sdim /// be translated into a section offset address. 503314564Sdim /// 504314564Sdim /// @return 505314564Sdim /// An SBAddress which will be valid if \a vm_addr was 506314564Sdim /// successfully resolved into a section offset address, or an 507314564Sdim /// invalid SBAddress if \a vm_addr doesn't resolve to a section 508314564Sdim /// in a module. 509314564Sdim //------------------------------------------------------------------ 510314564Sdim lldb::SBAddress ResolveLoadAddress(lldb::addr_t vm_addr); 511254721Semaste 512314564Sdim //------------------------------------------------------------------ 513314564Sdim /// Resolve a current load address into a section offset address 514314564Sdim /// using the process stop ID to identify a time in the past. 515314564Sdim /// 516314564Sdim /// @param[in] stop_id 517314564Sdim /// Each time a process stops, the process stop ID integer gets 518314564Sdim /// incremented. These stop IDs are used to identify past times 519314564Sdim /// and can be used in history objects as a cheap way to store 520314564Sdim /// the time at which the sample was taken. Specifying 521314564Sdim /// UINT32_MAX will always resolve the address using the 522314564Sdim /// currently loaded sections. 523314564Sdim /// 524314564Sdim /// @param[in] vm_addr 525314564Sdim /// A virtual address from the current process state that is to 526314564Sdim /// be translated into a section offset address. 527314564Sdim /// 528314564Sdim /// @return 529314564Sdim /// An SBAddress which will be valid if \a vm_addr was 530314564Sdim /// successfully resolved into a section offset address, or an 531314564Sdim /// invalid SBAddress if \a vm_addr doesn't resolve to a section 532314564Sdim /// in a module. 533314564Sdim //------------------------------------------------------------------ 534314564Sdim lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id, 535314564Sdim lldb::addr_t vm_addr); 536309124Sdim 537314564Sdim SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr, 538314564Sdim uint32_t resolve_scope); 539254721Semaste 540314564Sdim //------------------------------------------------------------------ 541314564Sdim /// Read target memory. If a target process is running then memory 542314564Sdim /// is read from here. Otherwise the memory is read from the object 543314564Sdim /// files. For a target whose bytes are sized as a multiple of host 544314564Sdim /// bytes, the data read back will preserve the target's byte order. 545314564Sdim /// 546314564Sdim /// @param[in] addr 547314564Sdim /// A target address to read from. 548314564Sdim /// 549314564Sdim /// @param[out] buf 550314564Sdim /// The buffer to read memory into. 551314564Sdim /// 552314564Sdim /// @param[in] size 553314564Sdim /// The maximum number of host bytes to read in the buffer passed 554314564Sdim /// into this call 555314564Sdim /// 556314564Sdim /// @param[out] error 557321369Sdim /// Status information is written here if the memory read fails. 558314564Sdim /// 559314564Sdim /// @return 560314564Sdim /// The amount of data read in host bytes. 561314564Sdim //------------------------------------------------------------------ 562314564Sdim size_t ReadMemory(const SBAddress addr, void *buf, size_t size, 563314564Sdim lldb::SBError &error); 564254721Semaste 565314564Sdim lldb::SBBreakpoint BreakpointCreateByLocation(const char *file, 566314564Sdim uint32_t line); 567254721Semaste 568314564Sdim lldb::SBBreakpoint 569314564Sdim BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line); 570296417Sdim 571314564Sdim lldb::SBBreakpoint 572314564Sdim BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line, 573314564Sdim lldb::addr_t offset); 574254721Semaste 575314564Sdim lldb::SBBreakpoint 576314564Sdim BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line, 577314564Sdim lldb::addr_t offset, SBFileSpecList &module_list); 578296417Sdim 579314564Sdim lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name, 580314564Sdim const char *module_name = nullptr); 581309124Sdim 582314564Sdim // This version uses name_type_mask = eFunctionNameTypeAuto 583314564Sdim lldb::SBBreakpoint 584314564Sdim BreakpointCreateByName(const char *symbol_name, 585314564Sdim const SBFileSpecList &module_list, 586314564Sdim const SBFileSpecList &comp_unit_list); 587254721Semaste 588314564Sdim lldb::SBBreakpoint BreakpointCreateByName( 589314564Sdim const char *symbol_name, 590314564Sdim uint32_t 591314564Sdim name_type_mask, // Logical OR one or more FunctionNameType enum bits 592314564Sdim const SBFileSpecList &module_list, 593314564Sdim const SBFileSpecList &comp_unit_list); 594254721Semaste 595314564Sdim lldb::SBBreakpoint BreakpointCreateByName( 596314564Sdim const char *symbol_name, 597314564Sdim uint32_t 598314564Sdim name_type_mask, // Logical OR one or more FunctionNameType enum bits 599314564Sdim lldb::LanguageType symbol_language, 600314564Sdim const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list); 601254721Semaste 602314564Sdim lldb::SBBreakpoint BreakpointCreateByNames( 603314564Sdim const char *symbol_name[], uint32_t num_names, 604314564Sdim uint32_t 605314564Sdim name_type_mask, // Logical OR one or more FunctionNameType enum bits 606314564Sdim const SBFileSpecList &module_list, 607314564Sdim const SBFileSpecList &comp_unit_list); 608296417Sdim 609314564Sdim lldb::SBBreakpoint BreakpointCreateByNames( 610314564Sdim const char *symbol_name[], uint32_t num_names, 611314564Sdim uint32_t 612314564Sdim name_type_mask, // Logical OR one or more FunctionNameType enum bits 613314564Sdim lldb::LanguageType symbol_language, 614314564Sdim const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list); 615254721Semaste 616314564Sdim lldb::SBBreakpoint BreakpointCreateByNames( 617314564Sdim const char *symbol_name[], uint32_t num_names, 618314564Sdim uint32_t 619314564Sdim name_type_mask, // Logical OR one or more FunctionNameType enum bits 620314564Sdim lldb::LanguageType symbol_language, 621314564Sdim lldb::addr_t offset, const SBFileSpecList &module_list, 622314564Sdim const SBFileSpecList &comp_unit_list); 623254721Semaste 624314564Sdim lldb::SBBreakpoint BreakpointCreateByRegex(const char *symbol_name_regex, 625314564Sdim const char *module_name = nullptr); 626254721Semaste 627314564Sdim lldb::SBBreakpoint 628314564Sdim BreakpointCreateByRegex(const char *symbol_name_regex, 629314564Sdim const SBFileSpecList &module_list, 630314564Sdim const SBFileSpecList &comp_unit_list); 631254721Semaste 632314564Sdim lldb::SBBreakpoint BreakpointCreateByRegex( 633314564Sdim const char *symbol_name_regex, lldb::LanguageType symbol_language, 634314564Sdim const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list); 635254721Semaste 636314564Sdim lldb::SBBreakpoint 637314564Sdim BreakpointCreateBySourceRegex(const char *source_regex, 638314564Sdim const SBFileSpec &source_file, 639314564Sdim const char *module_name = nullptr); 640254721Semaste 641314564Sdim lldb::SBBreakpoint 642314564Sdim BreakpointCreateBySourceRegex(const char *source_regex, 643314564Sdim const SBFileSpecList &module_list, 644314564Sdim const SBFileSpecList &source_file); 645254721Semaste 646314564Sdim lldb::SBBreakpoint BreakpointCreateBySourceRegex( 647314564Sdim const char *source_regex, const SBFileSpecList &module_list, 648314564Sdim const SBFileSpecList &source_file, const SBStringList &func_names); 649254721Semaste 650314564Sdim lldb::SBBreakpoint BreakpointCreateForException(lldb::LanguageType language, 651314564Sdim bool catch_bp, bool throw_bp); 652254721Semaste 653314564Sdim lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address); 654254721Semaste 655314564Sdim lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address); 656254721Semaste 657314564Sdim //------------------------------------------------------------------ 658314564Sdim /// Read breakpoints from source_file and return the newly created 659314564Sdim /// breakpoints in bkpt_list. 660314564Sdim /// 661314564Sdim /// @param[in] source_file 662314564Sdim /// The file from which to read the breakpoints. 663314564Sdim /// 664321369Sdim /// @param[out] new_bps 665314564Sdim /// A list of the newly created breakpoints. 666314564Sdim /// 667314564Sdim /// @return 668314564Sdim /// An SBError detailing any errors in reading in the breakpoints. 669314564Sdim //------------------------------------------------------------------ 670314564Sdim lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file, 671314564Sdim SBBreakpointList &new_bps); 672254721Semaste 673314564Sdim //------------------------------------------------------------------ 674314564Sdim /// Read breakpoints from source_file and return the newly created 675314564Sdim /// breakpoints in bkpt_list. 676314564Sdim /// 677314564Sdim /// @param[in] source_file 678314564Sdim /// The file from which to read the breakpoints. 679314564Sdim /// 680314564Sdim /// @param[in] matching_names 681314564Sdim /// Only read in breakpoints whose names match one of the names in this 682314564Sdim /// list. 683314564Sdim /// 684321369Sdim /// @param[out] new_bps 685314564Sdim /// A list of the newly created breakpoints. 686314564Sdim /// 687314564Sdim /// @return 688314564Sdim /// An SBError detailing any errors in reading in the breakpoints. 689314564Sdim //------------------------------------------------------------------ 690314564Sdim lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file, 691314564Sdim SBStringList &matching_names, 692314564Sdim SBBreakpointList &new_bps); 693254721Semaste 694314564Sdim //------------------------------------------------------------------ 695314564Sdim /// Write breakpoints to dest_file. 696314564Sdim /// 697314564Sdim /// @param[in] dest_file 698314564Sdim /// The file to which to write the breakpoints. 699314564Sdim /// 700314564Sdim /// @return 701314564Sdim /// An SBError detailing any errors in writing in the breakpoints. 702314564Sdim //------------------------------------------------------------------ 703314564Sdim lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file); 704254721Semaste 705314564Sdim //------------------------------------------------------------------ 706314564Sdim /// Write breakpoints listed in bkpt_list to dest_file. 707314564Sdim /// 708314564Sdim /// @param[in] dest_file 709314564Sdim /// The file to which to write the breakpoints. 710314564Sdim /// 711314564Sdim /// @param[in] bkpt_list 712314564Sdim /// Only write breakpoints from this list. 713314564Sdim /// 714314564Sdim /// @param[in] append 715314564Sdim /// If \btrue, append the breakpoints in bkpt_list to the others 716314564Sdim /// serialized in dest_file. If dest_file doesn't exist, then a new 717314564Sdim /// file will be created and the breakpoints in bkpt_list written to it. 718314564Sdim /// 719314564Sdim /// @return 720314564Sdim /// An SBError detailing any errors in writing in the breakpoints. 721314564Sdim //------------------------------------------------------------------ 722314564Sdim lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file, 723314564Sdim SBBreakpointList &bkpt_list, 724314564Sdim bool append = false); 725254721Semaste 726314564Sdim uint32_t GetNumBreakpoints() const; 727280031Sdim 728314564Sdim lldb::SBBreakpoint GetBreakpointAtIndex(uint32_t idx) const; 729280031Sdim 730314564Sdim bool BreakpointDelete(break_id_t break_id); 731254721Semaste 732314564Sdim lldb::SBBreakpoint FindBreakpointByID(break_id_t break_id); 733254721Semaste 734314564Sdim // Finds all breakpoints by name, returning the list in bkpt_list. Returns 735314564Sdim // false if the name is not a valid breakpoint name, true otherwise. 736314564Sdim bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list); 737341825Sdim 738327952Sdim void GetBreakpointNames(SBStringList &names); 739341825Sdim 740327952Sdim void DeleteBreakpointName(const char *name); 741254721Semaste 742314564Sdim bool EnableAllBreakpoints(); 743254721Semaste 744314564Sdim bool DisableAllBreakpoints(); 745254721Semaste 746314564Sdim bool DeleteAllBreakpoints(); 747254721Semaste 748314564Sdim uint32_t GetNumWatchpoints() const; 749254721Semaste 750314564Sdim lldb::SBWatchpoint GetWatchpointAtIndex(uint32_t idx) const; 751254721Semaste 752314564Sdim bool DeleteWatchpoint(lldb::watch_id_t watch_id); 753288943Sdim 754314564Sdim lldb::SBWatchpoint FindWatchpointByID(lldb::watch_id_t watch_id); 755254721Semaste 756314564Sdim lldb::SBWatchpoint WatchAddress(lldb::addr_t addr, size_t size, bool read, 757314564Sdim bool write, SBError &error); 758288943Sdim 759314564Sdim bool EnableAllWatchpoints(); 760288943Sdim 761314564Sdim bool DisableAllWatchpoints(); 762314564Sdim 763314564Sdim bool DeleteAllWatchpoints(); 764314564Sdim 765314564Sdim lldb::SBBroadcaster GetBroadcaster() const; 766314564Sdim 767314564Sdim lldb::SBType FindFirstType(const char *type); 768314564Sdim 769314564Sdim lldb::SBTypeList FindTypes(const char *type); 770314564Sdim 771314564Sdim lldb::SBType GetBasicType(lldb::BasicType type); 772314564Sdim 773314564Sdim lldb::SBValue CreateValueFromAddress(const char *name, lldb::SBAddress addr, 774314564Sdim lldb::SBType type); 775314564Sdim 776314564Sdim lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data, 777314564Sdim lldb::SBType type); 778314564Sdim 779314564Sdim lldb::SBValue CreateValueFromExpression(const char *name, const char *expr); 780314564Sdim 781314564Sdim SBSourceManager GetSourceManager(); 782314564Sdim 783314564Sdim lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr, 784314564Sdim uint32_t count); 785314564Sdim 786314564Sdim lldb::SBInstructionList ReadInstructions(lldb::SBAddress base_addr, 787314564Sdim uint32_t count, 788314564Sdim const char *flavor_string); 789314564Sdim 790314564Sdim lldb::SBInstructionList GetInstructions(lldb::SBAddress base_addr, 791314564Sdim const void *buf, size_t size); 792314564Sdim 793314564Sdim // The "WithFlavor" is necessary to keep SWIG from getting confused about 794341825Sdim // overloaded arguments when using the buf + size -> Python Object magic. 795314564Sdim 796314564Sdim lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr, 797314564Sdim const char *flavor_string, 798314564Sdim const void *buf, 799314564Sdim size_t size); 800314564Sdim 801314564Sdim lldb::SBInstructionList GetInstructions(lldb::addr_t base_addr, 802314564Sdim const void *buf, size_t size); 803314564Sdim 804314564Sdim lldb::SBInstructionList GetInstructionsWithFlavor(lldb::addr_t base_addr, 805314564Sdim const char *flavor_string, 806314564Sdim const void *buf, 807314564Sdim size_t size); 808314564Sdim 809314564Sdim lldb::SBSymbolContextList FindSymbols(const char *name, 810314564Sdim lldb::SymbolType type = eSymbolTypeAny); 811314564Sdim 812314564Sdim bool operator==(const lldb::SBTarget &rhs) const; 813314564Sdim 814314564Sdim bool operator!=(const lldb::SBTarget &rhs) const; 815314564Sdim 816314564Sdim bool GetDescription(lldb::SBStream &description, 817314564Sdim lldb::DescriptionLevel description_level); 818314564Sdim 819314564Sdim lldb::SBValue EvaluateExpression(const char *expr); 820314564Sdim 821314564Sdim lldb::SBValue EvaluateExpression(const char *expr, 822314564Sdim const SBExpressionOptions &options); 823314564Sdim 824314564Sdim lldb::addr_t GetStackRedZoneSize(); 825314564Sdim 826314564Sdim lldb::SBLaunchInfo GetLaunchInfo() const; 827314564Sdim 828314564Sdim void SetLaunchInfo(const lldb::SBLaunchInfo &launch_info); 829314564Sdim 830254721Semasteprotected: 831314564Sdim friend class SBAddress; 832314564Sdim friend class SBBlock; 833314564Sdim friend class SBBreakpointList; 834327952Sdim friend class SBBreakpointNameImpl; 835314564Sdim friend class SBDebugger; 836314564Sdim friend class SBExecutionContext; 837314564Sdim friend class SBFunction; 838314564Sdim friend class SBInstruction; 839314564Sdim friend class SBModule; 840314564Sdim friend class SBProcess; 841314564Sdim friend class SBSection; 842314564Sdim friend class SBSourceManager; 843314564Sdim friend class SBSymbol; 844314564Sdim friend class SBValue; 845254721Semaste 846314564Sdim //------------------------------------------------------------------ 847341825Sdim // Constructors are private, use static Target::Create function to create an 848341825Sdim // instance of this class. 849314564Sdim //------------------------------------------------------------------ 850254721Semaste 851314564Sdim lldb::TargetSP GetSP() const; 852254721Semaste 853314564Sdim void SetSP(const lldb::TargetSP &target_sp); 854254721Semaste 855254721Semasteprivate: 856314564Sdim lldb::TargetSP m_opaque_sp; 857254721Semaste}; 858254721Semaste 859254721Semaste} // namespace lldb 860254721Semaste 861296417Sdim#endif // LLDB_SBTarget_h_ 862