SBTarget.h revision 296417
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/SBDefines.h" 18254721Semaste#include "lldb/API/SBAddress.h" 19288943Sdim#include "lldb/API/SBAttachInfo.h" 20254721Semaste#include "lldb/API/SBBroadcaster.h" 21254721Semaste#include "lldb/API/SBFileSpec.h" 22254721Semaste#include "lldb/API/SBFileSpecList.h" 23288943Sdim#include "lldb/API/SBLaunchInfo.h" 24254721Semaste#include "lldb/API/SBSymbolContextList.h" 25254721Semaste#include "lldb/API/SBType.h" 26254721Semaste#include "lldb/API/SBValue.h" 27254721Semaste#include "lldb/API/SBWatchpoint.h" 28254721Semaste 29254721Semastenamespace lldb { 30254721Semaste 31280031Sdimclass SBPlatform; 32280031Sdim 33288943Sdimclass LLDB_API SBTarget 34254721Semaste{ 35254721Semastepublic: 36254721Semaste //------------------------------------------------------------------ 37254721Semaste // Broadcaster bits. 38254721Semaste //------------------------------------------------------------------ 39254721Semaste enum 40254721Semaste { 41254721Semaste eBroadcastBitBreakpointChanged = (1 << 0), 42254721Semaste eBroadcastBitModulesLoaded = (1 << 1), 43254721Semaste eBroadcastBitModulesUnloaded = (1 << 2), 44254721Semaste eBroadcastBitWatchpointChanged = (1 << 3), 45254721Semaste eBroadcastBitSymbolsLoaded = (1 << 4) 46254721Semaste }; 47254721Semaste 48254721Semaste //------------------------------------------------------------------ 49254721Semaste // Constructors 50254721Semaste //------------------------------------------------------------------ 51254721Semaste SBTarget (); 52254721Semaste 53254721Semaste SBTarget (const lldb::SBTarget& rhs); 54254721Semaste 55254721Semaste SBTarget (const lldb::TargetSP& target_sp); 56254721Semaste 57254721Semaste //------------------------------------------------------------------ 58254721Semaste // Destructor 59254721Semaste //------------------------------------------------------------------ 60254721Semaste ~SBTarget(); 61254721Semaste 62296417Sdim const lldb::SBTarget& 63296417Sdim operator = (const lldb::SBTarget& rhs); 64296417Sdim 65254721Semaste bool 66254721Semaste IsValid() const; 67288943Sdim 68288943Sdim static bool 69288943Sdim EventIsTargetEvent (const lldb::SBEvent &event); 70288943Sdim 71288943Sdim static lldb::SBTarget 72288943Sdim GetTargetFromEvent (const lldb::SBEvent &event); 73254721Semaste 74288943Sdim static uint32_t 75288943Sdim GetNumModulesFromEvent (const lldb::SBEvent &event); 76288943Sdim 77288943Sdim static lldb::SBModule 78288943Sdim GetModuleAtIndexFromEvent (const uint32_t idx, const lldb::SBEvent &event); 79288943Sdim 80254721Semaste static const char * 81254721Semaste GetBroadcasterClassName (); 82254721Semaste 83254721Semaste lldb::SBProcess 84254721Semaste GetProcess (); 85254721Semaste 86254721Semaste //------------------------------------------------------------------ 87280031Sdim /// Return the platform object associated with the target. 88280031Sdim /// 89280031Sdim /// After return, the platform object should be checked for 90280031Sdim /// validity. 91280031Sdim /// 92280031Sdim /// @return 93280031Sdim /// A platform object. 94280031Sdim //------------------------------------------------------------------ 95280031Sdim lldb::SBPlatform 96280031Sdim GetPlatform (); 97280031Sdim 98280031Sdim //------------------------------------------------------------------ 99258884Semaste /// Install any binaries that need to be installed. 100258884Semaste /// 101258884Semaste /// This function does nothing when debugging on the host system. 102258884Semaste /// When connected to remote platforms, the target's main executable 103258884Semaste /// and any modules that have their remote install path set will be 104258884Semaste /// installed on the remote platform. If the main executable doesn't 105258884Semaste /// have an install location set, it will be installed in the remote 106258884Semaste /// platform's working directory. 107258884Semaste /// 108258884Semaste /// @return 109258884Semaste /// An error describing anything that went wrong during 110258884Semaste /// installation. 111258884Semaste //------------------------------------------------------------------ 112258884Semaste SBError 113258884Semaste Install(); 114258884Semaste 115258884Semaste //------------------------------------------------------------------ 116254721Semaste /// Launch a new process. 117254721Semaste /// 118254721Semaste /// Launch a new process by spawning a new process using the 119254721Semaste /// target object's executable module's file as the file to launch. 120254721Semaste /// Arguments are given in \a argv, and the environment variables 121254721Semaste /// are in \a envp. Standard input and output files can be 122254721Semaste /// optionally re-directed to \a stdin_path, \a stdout_path, and 123254721Semaste /// \a stderr_path. 124254721Semaste /// 125254721Semaste /// @param[in] listener 126254721Semaste /// An optional listener that will receive all process events. 127254721Semaste /// If \a listener is valid then \a listener will listen to all 128254721Semaste /// process events. If not valid, then this target's debugger 129254721Semaste /// (SBTarget::GetDebugger()) will listen to all process events. 130254721Semaste /// 131254721Semaste /// @param[in] argv 132254721Semaste /// The argument array. 133254721Semaste /// 134254721Semaste /// @param[in] envp 135254721Semaste /// The environment array. 136254721Semaste /// 137254721Semaste /// @param[in] launch_flags 138254721Semaste /// Flags to modify the launch (@see lldb::LaunchFlags) 139254721Semaste /// 140254721Semaste /// @param[in] stdin_path 141254721Semaste /// The path to use when re-directing the STDIN of the new 142296417Sdim /// process. If all stdXX_path arguments are nullptr, a pseudo 143254721Semaste /// terminal will be used. 144254721Semaste /// 145254721Semaste /// @param[in] stdout_path 146254721Semaste /// The path to use when re-directing the STDOUT of the new 147296417Sdim /// process. If all stdXX_path arguments are nullptr, a pseudo 148254721Semaste /// terminal will be used. 149254721Semaste /// 150254721Semaste /// @param[in] stderr_path 151254721Semaste /// The path to use when re-directing the STDERR of the new 152296417Sdim /// process. If all stdXX_path arguments are nullptr, a pseudo 153254721Semaste /// terminal will be used. 154254721Semaste /// 155254721Semaste /// @param[in] working_directory 156254721Semaste /// The working directory to have the child process run in 157254721Semaste /// 158254721Semaste /// @param[in] launch_flags 159254721Semaste /// Some launch options specified by logical OR'ing 160254721Semaste /// lldb::LaunchFlags enumeration values together. 161254721Semaste /// 162276479Sdim /// @param[in] stop_at_entry 163254721Semaste /// If false do not stop the inferior at the entry point. 164254721Semaste /// 165288943Sdim /// @param[out] error 166254721Semaste /// An error object. Contains the reason if there is some failure. 167254721Semaste /// 168254721Semaste /// @return 169254721Semaste /// A process object for the newly created process. 170254721Semaste //------------------------------------------------------------------ 171254721Semaste lldb::SBProcess 172254721Semaste Launch (SBListener &listener, 173254721Semaste char const **argv, 174254721Semaste char const **envp, 175254721Semaste const char *stdin_path, 176254721Semaste const char *stdout_path, 177254721Semaste const char *stderr_path, 178254721Semaste const char *working_directory, 179254721Semaste uint32_t launch_flags, // See LaunchFlags 180254721Semaste bool stop_at_entry, 181254721Semaste lldb::SBError& error); 182296417Sdim 183296417Sdim SBProcess 184296417Sdim LoadCore (const char *core_file); 185296417Sdim 186254721Semaste //------------------------------------------------------------------ 187254721Semaste /// Launch a new process with sensible defaults. 188254721Semaste /// 189254721Semaste /// @param[in] argv 190254721Semaste /// The argument array. 191254721Semaste /// 192254721Semaste /// @param[in] envp 193254721Semaste /// The environment array. 194254721Semaste /// 195254721Semaste /// @param[in] working_directory 196254721Semaste /// The working directory to have the child process run in 197254721Semaste /// 198254721Semaste /// Default: listener 199254721Semaste /// Set to the target's debugger (SBTarget::GetDebugger()) 200254721Semaste /// 201254721Semaste /// Default: launch_flags 202254721Semaste /// Empty launch flags 203254721Semaste /// 204254721Semaste /// Default: stdin_path 205254721Semaste /// Default: stdout_path 206254721Semaste /// Default: stderr_path 207254721Semaste /// A pseudo terminal will be used. 208254721Semaste /// 209254721Semaste /// @return 210254721Semaste /// A process object for the newly created process. 211254721Semaste //------------------------------------------------------------------ 212254721Semaste SBProcess 213254721Semaste LaunchSimple (const char **argv, 214254721Semaste const char **envp, 215254721Semaste const char *working_directory); 216254721Semaste 217254721Semaste SBProcess 218254721Semaste Launch (SBLaunchInfo &launch_info, SBError& error); 219254721Semaste 220254721Semaste SBProcess 221254721Semaste Attach (SBAttachInfo &attach_info, SBError& error); 222254721Semaste 223254721Semaste //------------------------------------------------------------------ 224254721Semaste /// Attach to process with pid. 225254721Semaste /// 226254721Semaste /// @param[in] listener 227254721Semaste /// An optional listener that will receive all process events. 228254721Semaste /// If \a listener is valid then \a listener will listen to all 229254721Semaste /// process events. If not valid, then this target's debugger 230254721Semaste /// (SBTarget::GetDebugger()) will listen to all process events. 231254721Semaste /// 232254721Semaste /// @param[in] pid 233254721Semaste /// The process ID to attach to. 234254721Semaste /// 235288943Sdim /// @param[out] error 236254721Semaste /// An error explaining what went wrong if attach fails. 237254721Semaste /// 238254721Semaste /// @return 239254721Semaste /// A process object for the attached process. 240254721Semaste //------------------------------------------------------------------ 241254721Semaste lldb::SBProcess 242254721Semaste AttachToProcessWithID (SBListener &listener, 243254721Semaste lldb::pid_t pid, 244254721Semaste lldb::SBError& error); 245254721Semaste 246254721Semaste#if defined(__APPLE__) 247254721Semaste // We need to keep this around for a build or two since Xcode links 248254721Semaste // to the 32 bit version of this function. We will take it out soon. 249254721Semaste lldb::SBProcess 250254721Semaste AttachToProcessWithID (SBListener &listener, 251254721Semaste ::pid_t pid, // 32 bit int process ID 252254721Semaste lldb::SBError& error); // DEPRECATED 253254721Semaste#endif 254296417Sdim 255254721Semaste //------------------------------------------------------------------ 256254721Semaste /// Attach to process with name. 257254721Semaste /// 258254721Semaste /// @param[in] listener 259254721Semaste /// An optional listener that will receive all process events. 260254721Semaste /// If \a listener is valid then \a listener will listen to all 261254721Semaste /// process events. If not valid, then this target's debugger 262254721Semaste /// (SBTarget::GetDebugger()) will listen to all process events. 263254721Semaste /// 264254721Semaste /// @param[in] name 265254721Semaste /// Basename of process to attach to. 266254721Semaste /// 267254721Semaste /// @param[in] wait_for 268254721Semaste /// If true wait for a new instance of 'name' to be launched. 269254721Semaste /// 270288943Sdim /// @param[out] error 271254721Semaste /// An error explaining what went wrong if attach fails. 272254721Semaste /// 273254721Semaste /// @return 274254721Semaste /// A process object for the attached process. 275254721Semaste //------------------------------------------------------------------ 276254721Semaste lldb::SBProcess 277254721Semaste AttachToProcessWithName (SBListener &listener, 278254721Semaste const char *name, 279254721Semaste bool wait_for, 280254721Semaste lldb::SBError& error); 281254721Semaste 282254721Semaste //------------------------------------------------------------------ 283254721Semaste /// Connect to a remote debug server with url. 284254721Semaste /// 285254721Semaste /// @param[in] listener 286254721Semaste /// An optional listener that will receive all process events. 287254721Semaste /// If \a listener is valid then \a listener will listen to all 288254721Semaste /// process events. If not valid, then this target's debugger 289254721Semaste /// (SBTarget::GetDebugger()) will listen to all process events. 290254721Semaste /// 291254721Semaste /// @param[in] url 292254721Semaste /// The url to connect to, e.g., 'connect://localhost:12345'. 293254721Semaste /// 294254721Semaste /// @param[in] plugin_name 295296417Sdim /// The plugin name to be used; can be nullptr. 296254721Semaste /// 297288943Sdim /// @param[out] error 298254721Semaste /// An error explaining what went wrong if the connect fails. 299254721Semaste /// 300254721Semaste /// @return 301254721Semaste /// A process object for the connected process. 302254721Semaste //------------------------------------------------------------------ 303254721Semaste lldb::SBProcess 304254721Semaste ConnectRemote (SBListener &listener, 305254721Semaste const char *url, 306254721Semaste const char *plugin_name, 307254721Semaste SBError& error); 308254721Semaste 309254721Semaste lldb::SBFileSpec 310254721Semaste GetExecutable (); 311254721Semaste 312254721Semaste bool 313254721Semaste AddModule (lldb::SBModule &module); 314254721Semaste 315254721Semaste lldb::SBModule 316254721Semaste AddModule (const char *path, 317254721Semaste const char *triple, 318254721Semaste const char *uuid); 319254721Semaste 320254721Semaste lldb::SBModule 321254721Semaste AddModule (const char *path, 322254721Semaste const char *triple, 323254721Semaste const char *uuid_cstr, 324254721Semaste const char *symfile); 325254721Semaste 326254721Semaste lldb::SBModule 327254721Semaste AddModule (const SBModuleSpec &module_spec); 328254721Semaste 329254721Semaste uint32_t 330254721Semaste GetNumModules () const; 331254721Semaste 332254721Semaste lldb::SBModule 333254721Semaste GetModuleAtIndex (uint32_t idx); 334254721Semaste 335254721Semaste bool 336254721Semaste RemoveModule (lldb::SBModule module); 337254721Semaste 338254721Semaste lldb::SBDebugger 339254721Semaste GetDebugger() const; 340254721Semaste 341254721Semaste lldb::SBModule 342254721Semaste FindModule (const lldb::SBFileSpec &file_spec); 343254721Semaste 344254721Semaste lldb::ByteOrder 345254721Semaste GetByteOrder (); 346254721Semaste 347254721Semaste uint32_t 348254721Semaste GetAddressByteSize(); 349254721Semaste 350254721Semaste const char * 351254721Semaste GetTriple (); 352254721Semaste 353254721Semaste //------------------------------------------------------------------ 354280031Sdim /// Architecture data byte width accessor 355280031Sdim /// 356280031Sdim /// @return 357280031Sdim /// The size in 8-bit (host) bytes of a minimum addressable 358280031Sdim /// unit from the Architecture's data bus 359280031Sdim //------------------------------------------------------------------ 360280031Sdim uint32_t 361280031Sdim GetDataByteSize (); 362280031Sdim 363280031Sdim //------------------------------------------------------------------ 364280031Sdim /// Architecture code byte width accessor 365280031Sdim /// 366280031Sdim /// @return 367280031Sdim /// The size in 8-bit (host) bytes of a minimum addressable 368280031Sdim /// unit from the Architecture's code bus 369280031Sdim //------------------------------------------------------------------ 370280031Sdim uint32_t 371280031Sdim GetCodeByteSize (); 372280031Sdim 373280031Sdim //------------------------------------------------------------------ 374254721Semaste /// Set the base load address for a module section. 375254721Semaste /// 376254721Semaste /// @param[in] section 377254721Semaste /// The section whose base load address will be set within this 378254721Semaste /// target. 379254721Semaste /// 380254721Semaste /// @param[in] section_base_addr 381254721Semaste /// The base address for the section. 382254721Semaste /// 383254721Semaste /// @return 384254721Semaste /// An error to indicate success, fail, and any reason for 385254721Semaste /// failure. 386254721Semaste //------------------------------------------------------------------ 387254721Semaste lldb::SBError 388254721Semaste SetSectionLoadAddress (lldb::SBSection section, 389254721Semaste lldb::addr_t section_base_addr); 390254721Semaste 391254721Semaste //------------------------------------------------------------------ 392254721Semaste /// Clear the base load address for a module section. 393254721Semaste /// 394254721Semaste /// @param[in] section 395254721Semaste /// The section whose base load address will be cleared within 396254721Semaste /// this target. 397254721Semaste /// 398254721Semaste /// @return 399254721Semaste /// An error to indicate success, fail, and any reason for 400254721Semaste /// failure. 401254721Semaste //------------------------------------------------------------------ 402254721Semaste lldb::SBError 403254721Semaste ClearSectionLoadAddress (lldb::SBSection section); 404254721Semaste 405254721Semaste //------------------------------------------------------------------ 406254721Semaste /// Slide all file addresses for all module sections so that \a module 407254721Semaste /// appears to loaded at these slide addresses. 408254721Semaste /// 409254721Semaste /// When you need all sections within a module to be loaded at a 410254721Semaste /// rigid slide from the addresses found in the module object file, 411254721Semaste /// this function will allow you to easily and quickly slide all 412254721Semaste /// module sections. 413254721Semaste /// 414254721Semaste /// @param[in] module 415254721Semaste /// The module to load. 416254721Semaste /// 417254721Semaste /// @param[in] sections_offset 418254721Semaste /// An offset that will be applied to all section file addresses 419254721Semaste /// (the virtual addresses found in the object file itself). 420254721Semaste /// 421254721Semaste /// @return 422254721Semaste /// An error to indicate success, fail, and any reason for 423254721Semaste /// failure. 424254721Semaste //------------------------------------------------------------------ 425254721Semaste lldb::SBError 426254721Semaste SetModuleLoadAddress (lldb::SBModule module, 427254721Semaste int64_t sections_offset); 428254721Semaste 429254721Semaste //------------------------------------------------------------------ 430276479Sdim /// Clear the section base load addresses for all sections in a module. 431254721Semaste /// 432254721Semaste /// @param[in] module 433254721Semaste /// The module to unload. 434254721Semaste /// 435254721Semaste /// @return 436254721Semaste /// An error to indicate success, fail, and any reason for 437254721Semaste /// failure. 438254721Semaste //------------------------------------------------------------------ 439254721Semaste lldb::SBError 440254721Semaste ClearModuleLoadAddress (lldb::SBModule module); 441254721Semaste 442254721Semaste //------------------------------------------------------------------ 443254721Semaste /// Find functions by name. 444254721Semaste /// 445254721Semaste /// @param[in] name 446254721Semaste /// The name of the function we are looking for. 447254721Semaste /// 448254721Semaste /// @param[in] name_type_mask 449254721Semaste /// A logical OR of one or more FunctionNameType enum bits that 450254721Semaste /// indicate what kind of names should be used when doing the 451254721Semaste /// lookup. Bits include fully qualified names, base names, 452254721Semaste /// C++ methods, or ObjC selectors. 453254721Semaste /// See FunctionNameType for more details. 454254721Semaste /// 455254721Semaste /// @return 456254721Semaste /// A lldb::SBSymbolContextList that gets filled in with all of 457254721Semaste /// the symbol contexts for all the matches. 458254721Semaste //------------------------------------------------------------------ 459254721Semaste lldb::SBSymbolContextList 460254721Semaste FindFunctions (const char *name, 461254721Semaste uint32_t name_type_mask = lldb::eFunctionNameTypeAny); 462254721Semaste 463254721Semaste //------------------------------------------------------------------ 464254721Semaste /// Find global and static variables by name. 465254721Semaste /// 466254721Semaste /// @param[in] name 467254721Semaste /// The name of the global or static variable we are looking 468254721Semaste /// for. 469254721Semaste /// 470254721Semaste /// @param[in] max_matches 471254721Semaste /// Allow the number of matches to be limited to \a max_matches. 472254721Semaste /// 473254721Semaste /// @return 474254721Semaste /// A list of matched variables in an SBValueList. 475254721Semaste //------------------------------------------------------------------ 476254721Semaste lldb::SBValueList 477254721Semaste FindGlobalVariables (const char *name, 478254721Semaste uint32_t max_matches); 479254721Semaste 480254721Semaste //------------------------------------------------------------------ 481254721Semaste /// Find the first global (or static) variable by name. 482254721Semaste /// 483254721Semaste /// @param[in] name 484254721Semaste /// The name of the global or static variable we are looking 485254721Semaste /// for. 486254721Semaste /// 487254721Semaste /// @return 488254721Semaste /// An SBValue that gets filled in with the found variable (if any). 489254721Semaste //------------------------------------------------------------------ 490254721Semaste lldb::SBValue 491254721Semaste FindFirstGlobalVariable (const char* name); 492280031Sdim 493280031Sdim //------------------------------------------------------------------ 494280031Sdim /// Find global and static variables by pattern. 495280031Sdim /// 496280031Sdim /// @param[in] name 497280031Sdim /// The pattern to search for global or static variables 498280031Sdim /// 499280031Sdim /// @param[in] max_matches 500280031Sdim /// Allow the number of matches to be limited to \a max_matches. 501280031Sdim /// 502280031Sdim /// @param[in] matchtype 503280031Sdim /// The match type to use. 504280031Sdim /// 505280031Sdim /// @return 506280031Sdim /// A list of matched variables in an SBValueList. 507280031Sdim //------------------------------------------------------------------ 508280031Sdim lldb::SBValueList 509280031Sdim FindGlobalVariables(const char *name, 510280031Sdim uint32_t max_matches, 511280031Sdim MatchType matchtype); 512254721Semaste 513280031Sdim //------------------------------------------------------------------ 514280031Sdim /// Find global functions by their name with pattern matching. 515280031Sdim /// 516280031Sdim /// @param[in] name 517280031Sdim /// The pattern to search for global or static variables 518280031Sdim /// 519280031Sdim /// @param[in] max_matches 520280031Sdim /// Allow the number of matches to be limited to \a max_matches. 521280031Sdim /// 522280031Sdim /// @param[in] matchtype 523280031Sdim /// The match type to use. 524280031Sdim /// 525280031Sdim /// @return 526280031Sdim /// A list of matched variables in an SBValueList. 527280031Sdim //------------------------------------------------------------------ 528280031Sdim lldb::SBSymbolContextList 529280031Sdim FindGlobalFunctions(const char *name, 530280031Sdim uint32_t max_matches, 531280031Sdim MatchType matchtype); 532280031Sdim 533254721Semaste void 534254721Semaste Clear (); 535254721Semaste 536262528Semaste //------------------------------------------------------------------ 537280031Sdim /// Resolve a current file address into a section offset address. 538280031Sdim /// 539280031Sdim /// @param[in] file_addr 540280031Sdim /// 541280031Sdim /// @return 542280031Sdim /// An SBAddress which will be valid if... 543280031Sdim //------------------------------------------------------------------ 544280031Sdim lldb::SBAddress 545280031Sdim ResolveFileAddress (lldb::addr_t file_addr); 546280031Sdim 547280031Sdim //------------------------------------------------------------------ 548262528Semaste /// Resolve a current load address into a section offset address. 549262528Semaste /// 550262528Semaste /// @param[in] vm_addr 551262528Semaste /// A virtual address from the current process state that is to 552262528Semaste /// be translated into a section offset address. 553262528Semaste /// 554262528Semaste /// @return 555262528Semaste /// An SBAddress which will be valid if \a vm_addr was 556262528Semaste /// successfully resolved into a section offset address, or an 557262528Semaste /// invalid SBAddress if \a vm_addr doesn't resolve to a section 558262528Semaste /// in a module. 559262528Semaste //------------------------------------------------------------------ 560254721Semaste lldb::SBAddress 561254721Semaste ResolveLoadAddress (lldb::addr_t vm_addr); 562254721Semaste 563262528Semaste //------------------------------------------------------------------ 564262528Semaste /// Resolve a current load address into a section offset address 565262528Semaste /// using the process stop ID to identify a time in the past. 566262528Semaste /// 567262528Semaste /// @param[in] stop_id 568262528Semaste /// Each time a process stops, the process stop ID integer gets 569262528Semaste /// incremented. These stop IDs are used to identify past times 570262528Semaste /// and can be used in history objects as a cheap way to store 571262528Semaste /// the time at which the sample was taken. Specifying 572262528Semaste /// UINT32_MAX will always resolve the address using the 573262528Semaste /// currently loaded sections. 574262528Semaste /// 575262528Semaste /// @param[in] vm_addr 576262528Semaste /// A virtual address from the current process state that is to 577262528Semaste /// be translated into a section offset address. 578262528Semaste /// 579262528Semaste /// @return 580262528Semaste /// An SBAddress which will be valid if \a vm_addr was 581262528Semaste /// successfully resolved into a section offset address, or an 582262528Semaste /// invalid SBAddress if \a vm_addr doesn't resolve to a section 583262528Semaste /// in a module. 584262528Semaste //------------------------------------------------------------------ 585262528Semaste lldb::SBAddress 586262528Semaste ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr); 587262528Semaste 588254721Semaste SBSymbolContext 589254721Semaste ResolveSymbolContextForAddress (const SBAddress& addr, 590254721Semaste uint32_t resolve_scope); 591254721Semaste 592280031Sdim //------------------------------------------------------------------ 593280031Sdim /// Read target memory. If a target process is running then memory 594280031Sdim /// is read from here. Otherwise the memory is read from the object 595280031Sdim /// files. For a target whose bytes are sized as a multiple of host 596280031Sdim /// bytes, the data read back will preserve the target's byte order. 597280031Sdim /// 598280031Sdim /// @param[in] addr 599280031Sdim /// A target address to read from. 600280031Sdim /// 601280031Sdim /// @param[out] buf 602280031Sdim /// The buffer to read memory into. 603280031Sdim /// 604280031Sdim /// @param[in] size 605280031Sdim /// The maximum number of host bytes to read in the buffer passed 606280031Sdim /// into this call 607280031Sdim /// 608280031Sdim /// @param[out] error 609280031Sdim /// Error information is written here if the memory read fails. 610280031Sdim /// 611280031Sdim /// @return 612280031Sdim /// The amount of data read in host bytes. 613280031Sdim //------------------------------------------------------------------ 614280031Sdim size_t 615280031Sdim ReadMemory (const SBAddress addr, void *buf, size_t size, lldb::SBError &error); 616280031Sdim 617254721Semaste lldb::SBBreakpoint 618254721Semaste BreakpointCreateByLocation (const char *file, uint32_t line); 619254721Semaste 620254721Semaste lldb::SBBreakpoint 621254721Semaste BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line); 622254721Semaste 623254721Semaste lldb::SBBreakpoint 624296417Sdim BreakpointCreateByName(const char *symbol_name, const char *module_name = nullptr); 625254721Semaste 626254721Semaste // This version uses name_type_mask = eFunctionNameTypeAuto 627254721Semaste lldb::SBBreakpoint 628254721Semaste BreakpointCreateByName (const char *symbol_name, 629254721Semaste const SBFileSpecList &module_list, 630254721Semaste const SBFileSpecList &comp_unit_list); 631254721Semaste 632254721Semaste lldb::SBBreakpoint 633254721Semaste BreakpointCreateByName (const char *symbol_name, 634254721Semaste uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits 635254721Semaste const SBFileSpecList &module_list, 636254721Semaste const SBFileSpecList &comp_unit_list); 637254721Semaste 638254721Semaste lldb::SBBreakpoint 639296417Sdim BreakpointCreateByName (const char *symbol_name, 640296417Sdim uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits 641296417Sdim lldb::LanguageType symbol_language, 642296417Sdim const SBFileSpecList &module_list, 643296417Sdim const SBFileSpecList &comp_unit_list); 644296417Sdim 645296417Sdim lldb::SBBreakpoint 646254721Semaste BreakpointCreateByNames (const char *symbol_name[], 647254721Semaste uint32_t num_names, 648254721Semaste uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits 649254721Semaste const SBFileSpecList &module_list, 650254721Semaste const SBFileSpecList &comp_unit_list); 651254721Semaste 652254721Semaste lldb::SBBreakpoint 653296417Sdim BreakpointCreateByNames (const char *symbol_name[], 654296417Sdim uint32_t num_names, 655296417Sdim uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits 656296417Sdim lldb::LanguageType symbol_language, 657296417Sdim const SBFileSpecList &module_list, 658296417Sdim const SBFileSpecList &comp_unit_list); 659296417Sdim 660296417Sdim lldb::SBBreakpoint 661296417Sdim BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = nullptr); 662254721Semaste 663254721Semaste lldb::SBBreakpoint 664254721Semaste BreakpointCreateByRegex (const char *symbol_name_regex, 665254721Semaste const SBFileSpecList &module_list, 666254721Semaste const SBFileSpecList &comp_unit_list); 667254721Semaste 668254721Semaste lldb::SBBreakpoint 669296417Sdim BreakpointCreateByRegex (const char *symbol_name_regex, 670296417Sdim lldb::LanguageType symbol_language, 671296417Sdim const SBFileSpecList &module_list, 672296417Sdim const SBFileSpecList &comp_unit_list); 673296417Sdim 674296417Sdim lldb::SBBreakpoint 675296417Sdim BreakpointCreateBySourceRegex(const char *source_regex, 676296417Sdim const SBFileSpec &source_file, 677296417Sdim const char *module_name = nullptr); 678254721Semaste 679254721Semaste lldb::SBBreakpoint 680288943Sdim BreakpointCreateBySourceRegex (const char *source_regex, 681288943Sdim const SBFileSpecList &module_list, 682288943Sdim const SBFileSpecList &source_file); 683254721Semaste 684254721Semaste lldb::SBBreakpoint 685254721Semaste BreakpointCreateForException (lldb::LanguageType language, 686254721Semaste bool catch_bp, 687254721Semaste bool throw_bp); 688254721Semaste 689254721Semaste lldb::SBBreakpoint 690254721Semaste BreakpointCreateByAddress (addr_t address); 691254721Semaste 692296417Sdim lldb::SBBreakpoint 693296417Sdim BreakpointCreateBySBAddress (SBAddress &address); 694296417Sdim 695254721Semaste uint32_t 696254721Semaste GetNumBreakpoints () const; 697254721Semaste 698254721Semaste lldb::SBBreakpoint 699254721Semaste GetBreakpointAtIndex (uint32_t idx) const; 700254721Semaste 701254721Semaste bool 702254721Semaste BreakpointDelete (break_id_t break_id); 703254721Semaste 704254721Semaste lldb::SBBreakpoint 705254721Semaste FindBreakpointByID (break_id_t break_id); 706254721Semaste 707254721Semaste bool 708254721Semaste EnableAllBreakpoints (); 709254721Semaste 710254721Semaste bool 711254721Semaste DisableAllBreakpoints (); 712254721Semaste 713254721Semaste bool 714254721Semaste DeleteAllBreakpoints (); 715254721Semaste 716254721Semaste uint32_t 717254721Semaste GetNumWatchpoints () const; 718254721Semaste 719254721Semaste lldb::SBWatchpoint 720254721Semaste GetWatchpointAtIndex (uint32_t idx) const; 721254721Semaste 722254721Semaste bool 723254721Semaste DeleteWatchpoint (lldb::watch_id_t watch_id); 724254721Semaste 725254721Semaste lldb::SBWatchpoint 726254721Semaste FindWatchpointByID (lldb::watch_id_t watch_id); 727254721Semaste 728254721Semaste lldb::SBWatchpoint 729254721Semaste WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, SBError& error); 730254721Semaste 731254721Semaste bool 732254721Semaste EnableAllWatchpoints (); 733254721Semaste 734254721Semaste bool 735254721Semaste DisableAllWatchpoints (); 736254721Semaste 737254721Semaste bool 738254721Semaste DeleteAllWatchpoints (); 739254721Semaste 740254721Semaste lldb::SBBroadcaster 741254721Semaste GetBroadcaster () const; 742254721Semaste 743254721Semaste lldb::SBType 744254721Semaste FindFirstType (const char* type); 745254721Semaste 746254721Semaste lldb::SBTypeList 747254721Semaste FindTypes (const char* type); 748254721Semaste 749254721Semaste lldb::SBType 750254721Semaste GetBasicType(lldb::BasicType type); 751254721Semaste 752258054Semaste lldb::SBValue 753258054Semaste CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type); 754280031Sdim 755280031Sdim lldb::SBValue 756280031Sdim CreateValueFromData (const char *name, lldb::SBData data, lldb::SBType type); 757280031Sdim 758280031Sdim lldb::SBValue 759280031Sdim CreateValueFromExpression (const char *name, const char* expr); 760258054Semaste 761254721Semaste SBSourceManager 762254721Semaste GetSourceManager(); 763254721Semaste 764254721Semaste lldb::SBInstructionList 765254721Semaste ReadInstructions (lldb::SBAddress base_addr, uint32_t count); 766254721Semaste 767254721Semaste lldb::SBInstructionList 768254721Semaste ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string); 769254721Semaste 770254721Semaste lldb::SBInstructionList 771254721Semaste GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size); 772254721Semaste 773254721Semaste // The "WithFlavor" is necessary to keep SWIG from getting confused about overloaded arguments when 774254721Semaste // using the buf + size -> Python Object magic. 775254721Semaste 776254721Semaste lldb::SBInstructionList 777254721Semaste GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size); 778254721Semaste 779254721Semaste lldb::SBInstructionList 780254721Semaste GetInstructions (lldb::addr_t base_addr, const void *buf, size_t size); 781254721Semaste 782254721Semaste lldb::SBInstructionList 783254721Semaste GetInstructionsWithFlavor (lldb::addr_t base_addr, const char *flavor_string, const void *buf, size_t size); 784254721Semaste 785254721Semaste lldb::SBSymbolContextList 786254721Semaste FindSymbols (const char *name, 787254721Semaste lldb::SymbolType type = eSymbolTypeAny); 788254721Semaste 789254721Semaste bool 790254721Semaste operator == (const lldb::SBTarget &rhs) const; 791254721Semaste 792254721Semaste bool 793254721Semaste operator != (const lldb::SBTarget &rhs) const; 794254721Semaste 795254721Semaste bool 796254721Semaste GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level); 797254721Semaste 798254721Semaste lldb::SBValue 799288943Sdim EvaluateExpression (const char *expr); 800288943Sdim 801288943Sdim lldb::SBValue 802254721Semaste EvaluateExpression (const char *expr, const SBExpressionOptions &options); 803254721Semaste 804254721Semaste lldb::addr_t 805254721Semaste GetStackRedZoneSize(); 806288943Sdim 807288943Sdim lldb::SBLaunchInfo 808288943Sdim GetLaunchInfo () const; 809288943Sdim 810288943Sdim void 811288943Sdim SetLaunchInfo (const lldb::SBLaunchInfo &launch_info); 812254721Semaste 813254721Semasteprotected: 814254721Semaste friend class SBAddress; 815254721Semaste friend class SBBlock; 816254721Semaste friend class SBDebugger; 817280031Sdim friend class SBExecutionContext; 818254721Semaste friend class SBFunction; 819254721Semaste friend class SBInstruction; 820254721Semaste friend class SBModule; 821254721Semaste friend class SBProcess; 822254721Semaste friend class SBSection; 823254721Semaste friend class SBSourceManager; 824254721Semaste friend class SBSymbol; 825254721Semaste friend class SBValue; 826254721Semaste 827254721Semaste //------------------------------------------------------------------ 828254721Semaste // Constructors are private, use static Target::Create function to 829254721Semaste // create an instance of this class. 830254721Semaste //------------------------------------------------------------------ 831254721Semaste 832254721Semaste lldb::TargetSP 833254721Semaste GetSP () const; 834254721Semaste 835254721Semaste void 836254721Semaste SetSP (const lldb::TargetSP& target_sp); 837254721Semaste 838254721Semasteprivate: 839254721Semaste lldb::TargetSP m_opaque_sp; 840254721Semaste}; 841254721Semaste 842254721Semaste} // namespace lldb 843254721Semaste 844296417Sdim#endif // LLDB_SBTarget_h_ 845