Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 1 | //===-- SWIG Interface for SBTarget -----------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | namespace lldb { |
| 11 | |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 12 | class SBLaunchInfo |
| 13 | { |
Greg Clayton | 38d1f05 | 2012-02-24 20:59:25 +0000 | [diff] [blame] | 14 | public: |
| 15 | SBLaunchInfo (const char **argv); |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 16 | |
| 17 | uint32_t |
| 18 | GetUserID(); |
| 19 | |
| 20 | uint32_t |
| 21 | GetGroupID(); |
| 22 | |
| 23 | bool |
| 24 | UserIDIsValid (); |
| 25 | |
| 26 | bool |
| 27 | GroupIDIsValid (); |
| 28 | |
| 29 | void |
| 30 | SetUserID (uint32_t uid); |
| 31 | |
| 32 | void |
| 33 | SetGroupID (uint32_t gid); |
| 34 | |
Greg Clayton | 3e32ad6 | 2014-05-07 20:16:06 +0000 | [diff] [blame] | 35 | lldb::SBFileSpec |
| 36 | GetExecutableFile (); |
| 37 | |
| 38 | void |
| 39 | SetExecutableFile (lldb::SBFileSpec exe_file, bool add_as_first_arg); |
| 40 | |
Greg Clayton | 8012cad | 2014-11-17 19:39:20 +0000 | [diff] [blame] | 41 | lldb::SBListener |
| 42 | GetListener (); |
| 43 | |
| 44 | void |
| 45 | SetListener (lldb::SBListener &listener); |
| 46 | |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 47 | uint32_t |
| 48 | GetNumArguments (); |
| 49 | |
| 50 | const char * |
| 51 | GetArgumentAtIndex (uint32_t idx); |
| 52 | |
| 53 | void |
| 54 | SetArguments (const char **argv, bool append); |
| 55 | |
| 56 | uint32_t |
| 57 | GetNumEnvironmentEntries (); |
| 58 | |
| 59 | const char * |
| 60 | GetEnvironmentEntryAtIndex (uint32_t idx); |
| 61 | |
| 62 | void |
| 63 | SetEnvironmentEntries (const char **envp, bool append); |
| 64 | |
| 65 | void |
| 66 | Clear (); |
| 67 | |
| 68 | const char * |
| 69 | GetWorkingDirectory () const; |
| 70 | |
| 71 | void |
| 72 | SetWorkingDirectory (const char *working_dir); |
| 73 | |
| 74 | uint32_t |
| 75 | GetLaunchFlags (); |
| 76 | |
| 77 | void |
| 78 | SetLaunchFlags (uint32_t flags); |
| 79 | |
| 80 | const char * |
| 81 | GetProcessPluginName (); |
| 82 | |
| 83 | void |
| 84 | SetProcessPluginName (const char *plugin_name); |
| 85 | |
| 86 | const char * |
| 87 | GetShell (); |
| 88 | |
| 89 | void |
| 90 | SetShell (const char * path); |
| 91 | |
| 92 | uint32_t |
| 93 | GetResumeCount (); |
| 94 | |
| 95 | void |
| 96 | SetResumeCount (uint32_t c); |
| 97 | |
| 98 | bool |
| 99 | AddCloseFileAction (int fd); |
| 100 | |
| 101 | bool |
| 102 | AddDuplicateFileAction (int fd, int dup_fd); |
| 103 | |
| 104 | bool |
| 105 | AddOpenFileAction (int fd, const char *path, bool read, bool write); |
| 106 | |
| 107 | bool |
| 108 | AddSuppressFileAction (int fd, bool read, bool write); |
Jason Molenda | a332978 | 2014-03-29 18:54:20 +0000 | [diff] [blame] | 109 | |
| 110 | void |
| 111 | SetLaunchEventData (const char *data); |
| 112 | |
| 113 | const char * |
| 114 | GetLaunchEventData () const; |
| 115 | |
Jim Ingham | 106d028 | 2014-06-25 02:32:56 +0000 | [diff] [blame] | 116 | bool |
| 117 | GetDetachOnError() const; |
| 118 | |
| 119 | void |
| 120 | SetDetachOnError(bool enable); |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | class SBAttachInfo |
| 124 | { |
| 125 | public: |
| 126 | SBAttachInfo (); |
| 127 | |
| 128 | SBAttachInfo (lldb::pid_t pid); |
| 129 | |
| 130 | SBAttachInfo (const char *path, bool wait_for); |
| 131 | |
| 132 | SBAttachInfo (const lldb::SBAttachInfo &rhs); |
| 133 | |
| 134 | lldb::pid_t |
| 135 | GetProcessID (); |
| 136 | |
| 137 | void |
| 138 | SetProcessID (lldb::pid_t pid); |
| 139 | |
| 140 | void |
| 141 | SetExecutable (const char *path); |
| 142 | |
| 143 | void |
| 144 | SetExecutable (lldb::SBFileSpec exe_file); |
| 145 | |
| 146 | bool |
| 147 | GetWaitForLaunch (); |
| 148 | |
| 149 | void |
| 150 | SetWaitForLaunch (bool b); |
| 151 | |
Jim Ingham | cd16df9 | 2012-07-20 21:37:13 +0000 | [diff] [blame] | 152 | bool |
| 153 | GetIgnoreExisting (); |
| 154 | |
| 155 | void |
| 156 | SetIgnoreExisting (bool b); |
| 157 | |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 158 | uint32_t |
| 159 | GetResumeCount (); |
| 160 | |
| 161 | void |
| 162 | SetResumeCount (uint32_t c); |
| 163 | |
| 164 | const char * |
| 165 | GetProcessPluginName (); |
| 166 | |
| 167 | void |
| 168 | SetProcessPluginName (const char *plugin_name); |
| 169 | |
| 170 | uint32_t |
Greg Clayton | 41bd8ac | 2012-02-24 23:56:06 +0000 | [diff] [blame] | 171 | GetUserID(); |
| 172 | |
| 173 | uint32_t |
| 174 | GetGroupID(); |
| 175 | |
| 176 | bool |
| 177 | UserIDIsValid (); |
| 178 | |
| 179 | bool |
| 180 | GroupIDIsValid (); |
| 181 | |
| 182 | void |
| 183 | SetUserID (uint32_t uid); |
| 184 | |
| 185 | void |
| 186 | SetGroupID (uint32_t gid); |
| 187 | |
| 188 | uint32_t |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 189 | GetEffectiveUserID(); |
| 190 | |
| 191 | uint32_t |
| 192 | GetEffectiveGroupID(); |
| 193 | |
| 194 | bool |
| 195 | EffectiveUserIDIsValid (); |
| 196 | |
| 197 | bool |
| 198 | EffectiveGroupIDIsValid (); |
| 199 | |
| 200 | void |
| 201 | SetEffectiveUserID (uint32_t uid); |
| 202 | |
| 203 | void |
| 204 | SetEffectiveGroupID (uint32_t gid); |
| 205 | |
| 206 | lldb::pid_t |
| 207 | GetParentProcessID (); |
| 208 | |
| 209 | void |
| 210 | SetParentProcessID (lldb::pid_t pid); |
| 211 | |
| 212 | bool |
| 213 | ParentProcessIDIsValid(); |
Greg Clayton | 8012cad | 2014-11-17 19:39:20 +0000 | [diff] [blame] | 214 | |
| 215 | lldb::SBListener |
| 216 | GetListener (); |
| 217 | |
| 218 | void |
| 219 | SetListener (lldb::SBListener &listener); |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 223 | %feature("docstring", |
| 224 | "Represents the target program running under the debugger. |
| 225 | |
Johnny Chen | 01a6786 | 2011-10-14 00:42:25 +0000 | [diff] [blame] | 226 | SBTarget supports module, breakpoint, and watchpoint iterations. For example, |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 227 | |
| 228 | for m in target.module_iter(): |
| 229 | print m |
| 230 | |
| 231 | produces: |
| 232 | |
| 233 | (x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out |
| 234 | (x86_64) /usr/lib/dyld |
| 235 | (x86_64) /usr/lib/libstdc++.6.dylib |
| 236 | (x86_64) /usr/lib/libSystem.B.dylib |
| 237 | (x86_64) /usr/lib/system/libmathCommon.A.dylib |
| 238 | (x86_64) /usr/lib/libSystem.B.dylib(__commpage) |
| 239 | |
| 240 | and, |
| 241 | |
| 242 | for b in target.breakpoint_iter(): |
| 243 | print b |
| 244 | |
| 245 | produces: |
| 246 | |
| 247 | SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1 |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 248 | SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1 |
| 249 | |
| 250 | and, |
| 251 | |
Johnny Chen | 01a6786 | 2011-10-14 00:42:25 +0000 | [diff] [blame] | 252 | for wp_loc in target.watchpoint_iter(): |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 253 | print wp_loc |
| 254 | |
| 255 | produces: |
| 256 | |
Johnny Chen | 01a6786 | 2011-10-14 00:42:25 +0000 | [diff] [blame] | 257 | Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 258 | declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12' |
Johnny Chen | 01a6786 | 2011-10-14 00:42:25 +0000 | [diff] [blame] | 259 | hw_index = 0 hit_count = 2 ignore_count = 0" |
Johnny Chen | 357033b | 2011-07-18 20:13:38 +0000 | [diff] [blame] | 260 | ) SBTarget; |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 261 | class SBTarget |
| 262 | { |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 263 | public: |
| 264 | //------------------------------------------------------------------ |
| 265 | // Broadcaster bits. |
| 266 | //------------------------------------------------------------------ |
| 267 | enum |
| 268 | { |
| 269 | eBroadcastBitBreakpointChanged = (1 << 0), |
| 270 | eBroadcastBitModulesLoaded = (1 << 1), |
Jim Ingham | 1b5792e | 2012-12-18 02:03:49 +0000 | [diff] [blame] | 271 | eBroadcastBitModulesUnloaded = (1 << 2), |
Enrico Granata | f15ee4e | 2013-04-05 18:49:06 +0000 | [diff] [blame] | 272 | eBroadcastBitWatchpointChanged = (1 << 3), |
| 273 | eBroadcastBitSymbolsLoaded = (1 << 4) |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 274 | }; |
| 275 | |
| 276 | //------------------------------------------------------------------ |
| 277 | // Constructors |
| 278 | //------------------------------------------------------------------ |
| 279 | SBTarget (); |
| 280 | |
| 281 | SBTarget (const lldb::SBTarget& rhs); |
| 282 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 283 | //------------------------------------------------------------------ |
| 284 | // Destructor |
| 285 | //------------------------------------------------------------------ |
| 286 | ~SBTarget(); |
| 287 | |
Jim Ingham | 4bddaeb | 2012-02-16 06:50:00 +0000 | [diff] [blame] | 288 | static const char * |
| 289 | GetBroadcasterClassName (); |
| 290 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 291 | bool |
| 292 | IsValid() const; |
| 293 | |
| 294 | lldb::SBProcess |
| 295 | GetProcess (); |
| 296 | |
Matthew Gardiner | c928de3 | 2014-10-22 07:22:56 +0000 | [diff] [blame] | 297 | |
| 298 | %feature("docstring", " |
| 299 | //------------------------------------------------------------------ |
| 300 | /// Return the platform object associated with the target. |
| 301 | /// |
| 302 | /// After return, the platform object should be checked for |
| 303 | /// validity. |
| 304 | /// |
| 305 | /// @return |
| 306 | /// A platform object. |
| 307 | //------------------------------------------------------------------ |
| 308 | ") GetPlatform; |
| 309 | lldb::SBPlatform |
| 310 | GetPlatform (); |
| 311 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 312 | %feature("docstring", " |
| 313 | //------------------------------------------------------------------ |
Greg Clayton | fbb7634 | 2013-11-20 21:07:01 +0000 | [diff] [blame] | 314 | /// Install any binaries that need to be installed. |
| 315 | /// |
| 316 | /// This function does nothing when debugging on the host system. |
| 317 | /// When connected to remote platforms, the target's main executable |
| 318 | /// and any modules that have their install path set will be |
| 319 | /// installed on the remote platform. If the main executable doesn't |
| 320 | /// have an install location set, it will be installed in the remote |
| 321 | /// platform's working directory. |
| 322 | /// |
| 323 | /// @return |
| 324 | /// An error describing anything that went wrong during |
| 325 | /// installation. |
| 326 | //------------------------------------------------------------------ |
| 327 | ") Install; |
| 328 | lldb::SBError |
| 329 | Install(); |
| 330 | |
| 331 | %feature("docstring", " |
| 332 | //------------------------------------------------------------------ |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 333 | /// Launch a new process. |
| 334 | /// |
| 335 | /// Launch a new process by spawning a new process using the |
| 336 | /// target object's executable module's file as the file to launch. |
| 337 | /// Arguments are given in \a argv, and the environment variables |
| 338 | /// are in \a envp. Standard input and output files can be |
| 339 | /// optionally re-directed to \a stdin_path, \a stdout_path, and |
| 340 | /// \a stderr_path. |
| 341 | /// |
| 342 | /// @param[in] listener |
| 343 | /// An optional listener that will receive all process events. |
| 344 | /// If \a listener is valid then \a listener will listen to all |
| 345 | /// process events. If not valid, then this target's debugger |
| 346 | /// (SBTarget::GetDebugger()) will listen to all process events. |
| 347 | /// |
| 348 | /// @param[in] argv |
| 349 | /// The argument array. |
| 350 | /// |
| 351 | /// @param[in] envp |
| 352 | /// The environment array. |
| 353 | /// |
| 354 | /// @param[in] launch_flags |
| 355 | /// Flags to modify the launch (@see lldb::LaunchFlags) |
| 356 | /// |
| 357 | /// @param[in] stdin_path |
| 358 | /// The path to use when re-directing the STDIN of the new |
| 359 | /// process. If all stdXX_path arguments are NULL, a pseudo |
| 360 | /// terminal will be used. |
| 361 | /// |
| 362 | /// @param[in] stdout_path |
| 363 | /// The path to use when re-directing the STDOUT of the new |
| 364 | /// process. If all stdXX_path arguments are NULL, a pseudo |
| 365 | /// terminal will be used. |
| 366 | /// |
| 367 | /// @param[in] stderr_path |
| 368 | /// The path to use when re-directing the STDERR of the new |
| 369 | /// process. If all stdXX_path arguments are NULL, a pseudo |
| 370 | /// terminal will be used. |
| 371 | /// |
| 372 | /// @param[in] working_directory |
| 373 | /// The working directory to have the child process run in |
| 374 | /// |
| 375 | /// @param[in] launch_flags |
| 376 | /// Some launch options specified by logical OR'ing |
| 377 | /// lldb::LaunchFlags enumeration values together. |
| 378 | /// |
| 379 | /// @param[in] stop_at_endtry |
| 380 | /// If false do not stop the inferior at the entry point. |
| 381 | /// |
| 382 | /// @param[out] |
| 383 | /// An error object. Contains the reason if there is some failure. |
| 384 | /// |
| 385 | /// @return |
| 386 | /// A process object for the newly created process. |
| 387 | //------------------------------------------------------------------ |
| 388 | |
| 389 | For example, |
| 390 | |
| 391 | process = target.Launch(self.dbg.GetListener(), None, None, |
| 392 | None, '/tmp/stdout.txt', None, |
| 393 | None, 0, False, error) |
| 394 | |
| 395 | launches a new process by passing nothing for both the args and the envs |
| 396 | and redirect the standard output of the inferior to the /tmp/stdout.txt |
| 397 | file. It does not specify a working directory so that the debug server |
| 398 | will use its idea of what the current working directory is for the |
| 399 | inferior. Also, we ask the debugger not to stop the inferior at the |
| 400 | entry point. If no breakpoint is specified for the inferior, it should |
| 401 | run to completion if no user interaction is required. |
| 402 | ") Launch; |
| 403 | lldb::SBProcess |
| 404 | Launch (SBListener &listener, |
| 405 | char const **argv, |
| 406 | char const **envp, |
| 407 | const char *stdin_path, |
| 408 | const char *stdout_path, |
| 409 | const char *stderr_path, |
| 410 | const char *working_directory, |
| 411 | uint32_t launch_flags, // See LaunchFlags |
| 412 | bool stop_at_entry, |
| 413 | lldb::SBError& error); |
| 414 | |
| 415 | %feature("docstring", " |
| 416 | //------------------------------------------------------------------ |
| 417 | /// Launch a new process with sensible defaults. |
| 418 | /// |
| 419 | /// @param[in] argv |
| 420 | /// The argument array. |
| 421 | /// |
| 422 | /// @param[in] envp |
| 423 | /// The environment array. |
| 424 | /// |
| 425 | /// @param[in] working_directory |
| 426 | /// The working directory to have the child process run in |
| 427 | /// |
| 428 | /// Default: listener |
| 429 | /// Set to the target's debugger (SBTarget::GetDebugger()) |
| 430 | /// |
| 431 | /// Default: launch_flags |
| 432 | /// Empty launch flags |
| 433 | /// |
| 434 | /// Default: stdin_path |
| 435 | /// Default: stdout_path |
| 436 | /// Default: stderr_path |
| 437 | /// A pseudo terminal will be used. |
| 438 | /// |
| 439 | /// @return |
| 440 | /// A process object for the newly created process. |
| 441 | //------------------------------------------------------------------ |
| 442 | |
| 443 | For example, |
| 444 | |
| 445 | process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd()) |
| 446 | |
| 447 | launches a new process by passing 'X', 'Y', 'Z' as the args to the |
| 448 | executable. |
| 449 | ") LaunchSimple; |
| 450 | lldb::SBProcess |
| 451 | LaunchSimple (const char **argv, |
| 452 | const char **envp, |
| 453 | const char *working_directory); |
| 454 | |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 455 | lldb::SBProcess |
| 456 | Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error); |
Greg Clayton | 4d8ad55 | 2013-03-25 22:40:51 +0000 | [diff] [blame] | 457 | |
| 458 | %feature("docstring", " |
| 459 | //------------------------------------------------------------------ |
| 460 | /// Load a core file |
| 461 | /// |
| 462 | /// @param[in] core_file |
| 463 | /// File path of the core dump. |
| 464 | /// |
| 465 | /// @return |
| 466 | /// A process object for the newly created core file. |
| 467 | //------------------------------------------------------------------ |
| 468 | |
| 469 | For example, |
| 470 | |
| 471 | process = target.LoadCore('./a.out.core') |
| 472 | |
| 473 | loads a new core file and returns the process object. |
| 474 | ") LoadCore; |
| 475 | lldb::SBProcess |
| 476 | LoadCore(const char *core_file); |
Greg Clayton | 0e61568 | 2012-02-24 05:03:03 +0000 | [diff] [blame] | 477 | |
| 478 | lldb::SBProcess |
| 479 | Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error); |
| 480 | |
| 481 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 482 | %feature("docstring", " |
| 483 | //------------------------------------------------------------------ |
| 484 | /// Attach to process with pid. |
| 485 | /// |
| 486 | /// @param[in] listener |
| 487 | /// An optional listener that will receive all process events. |
| 488 | /// If \a listener is valid then \a listener will listen to all |
| 489 | /// process events. If not valid, then this target's debugger |
| 490 | /// (SBTarget::GetDebugger()) will listen to all process events. |
| 491 | /// |
| 492 | /// @param[in] pid |
| 493 | /// The process ID to attach to. |
| 494 | /// |
| 495 | /// @param[out] |
| 496 | /// An error explaining what went wrong if attach fails. |
| 497 | /// |
| 498 | /// @return |
| 499 | /// A process object for the attached process. |
| 500 | //------------------------------------------------------------------ |
| 501 | ") AttachToProcessWithID; |
| 502 | lldb::SBProcess |
| 503 | AttachToProcessWithID (SBListener &listener, |
| 504 | lldb::pid_t pid, |
| 505 | lldb::SBError& error); |
| 506 | |
| 507 | %feature("docstring", " |
| 508 | //------------------------------------------------------------------ |
| 509 | /// Attach to process with name. |
| 510 | /// |
| 511 | /// @param[in] listener |
| 512 | /// An optional listener that will receive all process events. |
| 513 | /// If \a listener is valid then \a listener will listen to all |
| 514 | /// process events. If not valid, then this target's debugger |
| 515 | /// (SBTarget::GetDebugger()) will listen to all process events. |
| 516 | /// |
| 517 | /// @param[in] name |
| 518 | /// Basename of process to attach to. |
| 519 | /// |
| 520 | /// @param[in] wait_for |
| 521 | /// If true wait for a new instance of 'name' to be launched. |
| 522 | /// |
| 523 | /// @param[out] |
| 524 | /// An error explaining what went wrong if attach fails. |
| 525 | /// |
| 526 | /// @return |
| 527 | /// A process object for the attached process. |
| 528 | //------------------------------------------------------------------ |
| 529 | ") AttachToProcessWithName; |
| 530 | lldb::SBProcess |
| 531 | AttachToProcessWithName (SBListener &listener, |
| 532 | const char *name, |
| 533 | bool wait_for, |
| 534 | lldb::SBError& error); |
| 535 | |
| 536 | %feature("docstring", " |
| 537 | //------------------------------------------------------------------ |
| 538 | /// Connect to a remote debug server with url. |
| 539 | /// |
| 540 | /// @param[in] listener |
| 541 | /// An optional listener that will receive all process events. |
| 542 | /// If \a listener is valid then \a listener will listen to all |
| 543 | /// process events. If not valid, then this target's debugger |
| 544 | /// (SBTarget::GetDebugger()) will listen to all process events. |
| 545 | /// |
| 546 | /// @param[in] url |
| 547 | /// The url to connect to, e.g., 'connect://localhost:12345'. |
| 548 | /// |
| 549 | /// @param[in] plugin_name |
| 550 | /// The plugin name to be used; can be NULL. |
| 551 | /// |
| 552 | /// @param[out] |
| 553 | /// An error explaining what went wrong if the connect fails. |
| 554 | /// |
| 555 | /// @return |
| 556 | /// A process object for the connected process. |
| 557 | //------------------------------------------------------------------ |
| 558 | ") ConnectRemote; |
| 559 | lldb::SBProcess |
| 560 | ConnectRemote (SBListener &listener, |
| 561 | const char *url, |
| 562 | const char *plugin_name, |
| 563 | SBError& error); |
| 564 | |
| 565 | lldb::SBFileSpec |
| 566 | GetExecutable (); |
| 567 | |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 568 | bool |
| 569 | AddModule (lldb::SBModule &module); |
| 570 | |
| 571 | lldb::SBModule |
| 572 | AddModule (const char *path, |
| 573 | const char *triple, |
| 574 | const char *uuid); |
| 575 | |
Greg Clayton | b210aec | 2012-04-23 20:23:39 +0000 | [diff] [blame] | 576 | lldb::SBModule |
| 577 | AddModule (const char *path, |
| 578 | const char *triple, |
| 579 | const char *uuid_cstr, |
| 580 | const char *symfile); |
| 581 | |
Greg Clayton | 226cce2 | 2013-07-08 22:22:41 +0000 | [diff] [blame] | 582 | lldb::SBModule |
| 583 | AddModule (const SBModuleSpec &module_spec); |
| 584 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 585 | uint32_t |
| 586 | GetNumModules () const; |
| 587 | |
| 588 | lldb::SBModule |
| 589 | GetModuleAtIndex (uint32_t idx); |
| 590 | |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 591 | bool |
| 592 | RemoveModule (lldb::SBModule module); |
| 593 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 594 | lldb::SBDebugger |
| 595 | GetDebugger() const; |
| 596 | |
| 597 | lldb::SBModule |
| 598 | FindModule (const lldb::SBFileSpec &file_spec); |
| 599 | |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 600 | lldb::ByteOrder |
| 601 | GetByteOrder (); |
| 602 | |
| 603 | uint32_t |
| 604 | GetAddressByteSize(); |
| 605 | |
| 606 | const char * |
| 607 | GetTriple (); |
| 608 | |
Matthew Gardiner | c928de3 | 2014-10-22 07:22:56 +0000 | [diff] [blame] | 609 | %feature("docstring", " |
| 610 | //------------------------------------------------------------------ |
| 611 | /// Architecture data byte width accessor |
| 612 | /// |
| 613 | /// @return |
| 614 | /// The size in 8-bit (host) bytes of a minimum addressable |
| 615 | /// unit from the Architecture's data bus |
| 616 | //------------------------------------------------------------------ |
| 617 | ") GetDataByteSize; |
| 618 | uint32_t |
| 619 | GetDataByteSize (); |
| 620 | |
| 621 | %feature("docstring", " |
| 622 | //------------------------------------------------------------------ |
| 623 | /// Architecture code byte width accessor |
| 624 | /// |
| 625 | /// @return |
| 626 | /// The size in 8-bit (host) bytes of a minimum addressable |
| 627 | /// unit from the Architecture's code bus |
| 628 | //------------------------------------------------------------------ |
| 629 | ") GetCodeByteSize; |
| 630 | uint32_t |
| 631 | GetCodeByteSize (); |
| 632 | |
Greg Clayton | cac9c5f | 2011-09-24 00:52:29 +0000 | [diff] [blame] | 633 | lldb::SBError |
| 634 | SetSectionLoadAddress (lldb::SBSection section, |
| 635 | lldb::addr_t section_base_addr); |
| 636 | |
| 637 | lldb::SBError |
| 638 | ClearSectionLoadAddress (lldb::SBSection section); |
| 639 | |
| 640 | lldb::SBError |
| 641 | SetModuleLoadAddress (lldb::SBModule module, |
| 642 | int64_t sections_offset); |
| 643 | |
| 644 | lldb::SBError |
| 645 | ClearModuleLoadAddress (lldb::SBModule module); |
| 646 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 647 | %feature("docstring", " |
| 648 | //------------------------------------------------------------------ |
| 649 | /// Find functions by name. |
| 650 | /// |
| 651 | /// @param[in] name |
| 652 | /// The name of the function we are looking for. |
| 653 | /// |
| 654 | /// @param[in] name_type_mask |
| 655 | /// A logical OR of one or more FunctionNameType enum bits that |
| 656 | /// indicate what kind of names should be used when doing the |
| 657 | /// lookup. Bits include fully qualified names, base names, |
| 658 | /// C++ methods, or ObjC selectors. |
| 659 | /// See FunctionNameType for more details. |
| 660 | /// |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 661 | /// @return |
Greg Clayton | 5569e64 | 2012-02-06 01:44:54 +0000 | [diff] [blame] | 662 | /// A lldb::SBSymbolContextList that gets filled in with all of |
| 663 | /// the symbol contexts for all the matches. |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 664 | //------------------------------------------------------------------ |
| 665 | ") FindFunctions; |
Greg Clayton | 5569e64 | 2012-02-06 01:44:54 +0000 | [diff] [blame] | 666 | lldb::SBSymbolContextList |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 667 | FindFunctions (const char *name, |
Greg Clayton | 5569e64 | 2012-02-06 01:44:54 +0000 | [diff] [blame] | 668 | uint32_t name_type_mask = lldb::eFunctionNameTypeAny); |
Enrico Granata | 6f3533f | 2011-07-29 19:53:35 +0000 | [diff] [blame] | 669 | |
| 670 | lldb::SBType |
| 671 | FindFirstType (const char* type); |
| 672 | |
| 673 | lldb::SBTypeList |
| 674 | FindTypes (const char* type); |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 675 | |
Greg Clayton | b43165b | 2012-12-05 21:24:42 +0000 | [diff] [blame] | 676 | lldb::SBType |
| 677 | GetBasicType(lldb::BasicType type); |
| 678 | |
Jim Ingham | e37d605 | 2011-09-13 00:29:56 +0000 | [diff] [blame] | 679 | lldb::SBSourceManager |
| 680 | GetSourceManager (); |
| 681 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 682 | %feature("docstring", " |
| 683 | //------------------------------------------------------------------ |
| 684 | /// Find global and static variables by name. |
| 685 | /// |
| 686 | /// @param[in] name |
| 687 | /// The name of the global or static variable we are looking |
| 688 | /// for. |
| 689 | /// |
| 690 | /// @param[in] max_matches |
| 691 | /// Allow the number of matches to be limited to \a max_matches. |
| 692 | /// |
| 693 | /// @return |
| 694 | /// A list of matched variables in an SBValueList. |
| 695 | //------------------------------------------------------------------ |
| 696 | ") FindGlobalVariables; |
| 697 | lldb::SBValueList |
| 698 | FindGlobalVariables (const char *name, |
| 699 | uint32_t max_matches); |
| 700 | |
Enrico Granata | bcd80b4 | 2013-01-16 18:53:52 +0000 | [diff] [blame] | 701 | %feature("docstring", " |
| 702 | //------------------------------------------------------------------ |
| 703 | /// Find the first global (or static) variable by name. |
| 704 | /// |
| 705 | /// @param[in] name |
| 706 | /// The name of the global or static variable we are looking |
| 707 | /// for. |
| 708 | /// |
| 709 | /// @return |
| 710 | /// An SBValue that gets filled in with the found variable (if any). |
| 711 | //------------------------------------------------------------------ |
| 712 | ") FindFirstGlobalVariable; |
| 713 | lldb::SBValue |
| 714 | FindFirstGlobalVariable (const char* name); |
| 715 | |
Carlo Kok | b77aba7 | 2014-09-19 20:12:24 +0000 | [diff] [blame] | 716 | |
| 717 | lldb::SBValueList |
| 718 | FindGlobalVariables(const char *name, |
| 719 | uint32_t max_matches, |
| 720 | MatchType matchtype); |
| 721 | |
| 722 | lldb::SBSymbolContextList |
| 723 | FindGlobalFunctions(const char *name, |
| 724 | uint32_t max_matches, |
| 725 | MatchType matchtype); |
| 726 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 727 | void |
| 728 | Clear (); |
| 729 | |
Matthew Gardiner | c928de3 | 2014-10-22 07:22:56 +0000 | [diff] [blame] | 730 | %feature("docstring", " |
| 731 | //------------------------------------------------------------------ |
| 732 | /// Resolve a current file address into a section offset address. |
| 733 | /// |
| 734 | /// @param[in] file_addr |
| 735 | /// |
| 736 | /// @return |
| 737 | /// An SBAddress which will be valid if... |
| 738 | //------------------------------------------------------------------ |
| 739 | ") ResolveFileAddress; |
| 740 | lldb::SBAddress |
| 741 | ResolveFileAddress (lldb::addr_t file_addr); |
| 742 | |
Greg Clayton | 00e6fbf | 2011-07-22 16:46:35 +0000 | [diff] [blame] | 743 | lldb::SBAddress |
| 744 | ResolveLoadAddress (lldb::addr_t vm_addr); |
Greg Clayton | d5944cd | 2013-12-06 01:12:00 +0000 | [diff] [blame] | 745 | |
| 746 | lldb::SBAddress |
| 747 | ResolvePastLoadAddress (uint32_t stop_id, lldb::addr_t vm_addr); |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 748 | |
| 749 | SBSymbolContext |
| 750 | ResolveSymbolContextForAddress (const SBAddress& addr, |
| 751 | uint32_t resolve_scope); |
| 752 | |
Matthew Gardiner | c928de3 | 2014-10-22 07:22:56 +0000 | [diff] [blame] | 753 | %feature("docstring", " |
| 754 | //------------------------------------------------------------------ |
| 755 | /// Read target memory. If a target process is running then memory |
| 756 | /// is read from here. Otherwise the memory is read from the object |
| 757 | /// files. For a target whose bytes are sized as a multiple of host |
| 758 | /// bytes, the data read back will preserve the target's byte order. |
| 759 | /// |
| 760 | /// @param[in] addr |
| 761 | /// A target address to read from. |
| 762 | /// |
| 763 | /// @param[out] buf |
| 764 | /// The buffer to read memory into. |
| 765 | /// |
| 766 | /// @param[in] size |
| 767 | /// The maximum number of host bytes to read in the buffer passed |
| 768 | /// into this call |
| 769 | /// |
| 770 | /// @param[out] error |
| 771 | /// Error information is written here if the memory read fails. |
| 772 | /// |
| 773 | /// @return |
| 774 | /// The amount of data read in host bytes. |
| 775 | //------------------------------------------------------------------ |
| 776 | ") ReadMemory; |
| 777 | size_t |
| 778 | ReadMemory (const SBAddress addr, void *buf, size_t size, lldb::SBError &error); |
| 779 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 780 | lldb::SBBreakpoint |
| 781 | BreakpointCreateByLocation (const char *file, uint32_t line); |
| 782 | |
| 783 | lldb::SBBreakpoint |
| 784 | BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line); |
| 785 | |
| 786 | lldb::SBBreakpoint |
| 787 | BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL); |
| 788 | |
| 789 | lldb::SBBreakpoint |
Jim Ingham | 2dd7f7f | 2011-10-11 01:18:55 +0000 | [diff] [blame] | 790 | BreakpointCreateByName (const char *symbol_name, |
| 791 | uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits |
| 792 | const SBFileSpecList &module_list, |
| 793 | const SBFileSpecList &comp_unit_list); |
| 794 | |
| 795 | lldb::SBBreakpoint |
Jim Ingham | fab10e8 | 2012-03-06 00:37:27 +0000 | [diff] [blame] | 796 | BreakpointCreateByNames (const char *symbol_name[], |
| 797 | uint32_t num_names, |
| 798 | uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits |
| 799 | const SBFileSpecList &module_list, |
| 800 | const SBFileSpecList &comp_unit_list); |
| 801 | |
| 802 | lldb::SBBreakpoint |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 803 | BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL); |
| 804 | |
| 805 | lldb::SBBreakpoint |
Jim Ingham | 969795f | 2011-09-21 01:17:13 +0000 | [diff] [blame] | 806 | BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL); |
| 807 | |
| 808 | lldb::SBBreakpoint |
Jim Ingham | fab10e8 | 2012-03-06 00:37:27 +0000 | [diff] [blame] | 809 | BreakpointCreateForException (lldb::LanguageType language, |
| 810 | bool catch_bp, |
| 811 | bool throw_bp); |
| 812 | |
| 813 | lldb::SBBreakpoint |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 814 | BreakpointCreateByAddress (addr_t address); |
| 815 | |
| 816 | uint32_t |
| 817 | GetNumBreakpoints () const; |
| 818 | |
| 819 | lldb::SBBreakpoint |
| 820 | GetBreakpointAtIndex (uint32_t idx) const; |
| 821 | |
| 822 | bool |
| 823 | BreakpointDelete (break_id_t break_id); |
| 824 | |
| 825 | lldb::SBBreakpoint |
| 826 | FindBreakpointByID (break_id_t break_id); |
| 827 | |
| 828 | bool |
| 829 | EnableAllBreakpoints (); |
| 830 | |
| 831 | bool |
| 832 | DisableAllBreakpoints (); |
| 833 | |
| 834 | bool |
| 835 | DeleteAllBreakpoints (); |
| 836 | |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 837 | uint32_t |
Greg Clayton | 1b282f9 | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 838 | GetNumWatchpoints () const; |
| 839 | |
| 840 | lldb::SBWatchpoint |
| 841 | GetWatchpointAtIndex (uint32_t idx) const; |
| 842 | |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 843 | bool |
Greg Clayton | 1b282f9 | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 844 | DeleteWatchpoint (lldb::watch_id_t watch_id); |
| 845 | |
| 846 | lldb::SBWatchpoint |
| 847 | FindWatchpointByID (lldb::watch_id_t watch_id); |
| 848 | |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 849 | bool |
Greg Clayton | 1b282f9 | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 850 | EnableAllWatchpoints (); |
| 851 | |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 852 | bool |
Greg Clayton | 1b282f9 | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 853 | DisableAllWatchpoints (); |
| 854 | |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 855 | bool |
Greg Clayton | 1b282f9 | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 856 | DeleteAllWatchpoints (); |
| 857 | |
| 858 | lldb::SBWatchpoint |
| 859 | WatchAddress (lldb::addr_t addr, |
| 860 | size_t size, |
| 861 | bool read, |
Johnny Chen | b90827e | 2012-06-04 23:19:54 +0000 | [diff] [blame] | 862 | bool write, |
| 863 | SBError &error); |
Greg Clayton | 1b282f9 | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 864 | |
Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 865 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 866 | lldb::SBBroadcaster |
| 867 | GetBroadcaster () const; |
Enrico Granata | 347c2aa | 2013-10-08 21:49:02 +0000 | [diff] [blame] | 868 | |
| 869 | lldb::SBValue |
| 870 | CreateValueFromAddress (const char *name, lldb::SBAddress addr, lldb::SBType type); |
Jason Molenda | b2115cf | 2014-11-18 05:43:11 +0000 | [diff] [blame] | 871 | |
| 872 | %feature("docstring", " |
| 873 | Disassemble a specified number of instructions starting at an address. |
| 874 | Parameters: |
| 875 | base_addr -- the address to start disassembly from |
| 876 | count -- the number of instructions to disassemble |
| 877 | flavor_string -- may be 'intel' or 'att' on x86 targets to specify that style of disassembly |
| 878 | Returns an SBInstructionList.") |
| 879 | ReadInstructions; |
Sean Callanan | 50952e9 | 2011-12-14 23:49:37 +0000 | [diff] [blame] | 880 | lldb::SBInstructionList |
Greg Clayton | 9c76611 | 2012-03-06 22:24:44 +0000 | [diff] [blame] | 881 | ReadInstructions (lldb::SBAddress base_addr, uint32_t count); |
| 882 | |
| 883 | lldb::SBInstructionList |
Jim Ingham | 0f063ba | 2013-03-02 00:26:47 +0000 | [diff] [blame] | 884 | ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string); |
| 885 | |
Jason Molenda | b2115cf | 2014-11-18 05:43:11 +0000 | [diff] [blame] | 886 | %feature("docstring", " |
| 887 | Disassemble the bytes in a buffer and return them in an SBInstructionList. |
| 888 | Parameters: |
| 889 | base_addr -- used for symbolicating the offsets in the byte stream when disassembling |
| 890 | buf -- bytes to be disassembled |
| 891 | size -- (C++) size of the buffer |
| 892 | Returns an SBInstructionList.") |
| 893 | GetInstructions; |
Jim Ingham | 0f063ba | 2013-03-02 00:26:47 +0000 | [diff] [blame] | 894 | lldb::SBInstructionList |
Sean Callanan | 50952e9 | 2011-12-14 23:49:37 +0000 | [diff] [blame] | 895 | GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size); |
Jason Molenda | b2115cf | 2014-11-18 05:43:11 +0000 | [diff] [blame] | 896 | |
| 897 | %feature("docstring", " |
| 898 | Disassemble the bytes in a buffer and return them in an SBInstructionList, with a supplied flavor. |
| 899 | Parameters: |
| 900 | base_addr -- used for symbolicating the offsets in the byte stream when disassembling |
| 901 | flavor -- may be 'intel' or 'att' on x86 targets to specify that style of disassembly |
| 902 | buf -- bytes to be disassembled |
| 903 | size -- (C++) size of the buffer |
| 904 | Returns an SBInstructionList.") |
| 905 | GetInstructionsWithFlavor; |
Jim Ingham | 0f063ba | 2013-03-02 00:26:47 +0000 | [diff] [blame] | 906 | lldb::SBInstructionList |
| 907 | GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size); |
| 908 | |
Greg Clayton | e14e192 | 2012-12-04 02:22:16 +0000 | [diff] [blame] | 909 | lldb::SBSymbolContextList |
| 910 | FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny); |
| 911 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 912 | bool |
Greg Clayton | da7bc7d | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 913 | GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level); |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 914 | |
Greg Clayton | 13fbb99 | 2013-02-01 00:47:49 +0000 | [diff] [blame] | 915 | lldb::addr_t |
| 916 | GetStackRedZoneSize(); |
| 917 | |
Enrico Granata | c338733 | 2013-05-03 01:29:27 +0000 | [diff] [blame] | 918 | bool |
| 919 | operator == (const lldb::SBTarget &rhs) const; |
| 920 | |
| 921 | bool |
| 922 | operator != (const lldb::SBTarget &rhs) const; |
| 923 | |
Greg Clayton | 4b63a5c | 2013-01-04 18:10:18 +0000 | [diff] [blame] | 924 | lldb::SBValue |
| 925 | EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options); |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 926 | %pythoncode %{ |
Greg Clayton | 6b2bd93 | 2012-02-01 08:09:32 +0000 | [diff] [blame] | 927 | class modules_access(object): |
| 928 | '''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.''' |
| 929 | def __init__(self, sbtarget): |
| 930 | self.sbtarget = sbtarget |
| 931 | |
| 932 | def __len__(self): |
| 933 | if self.sbtarget: |
Filipe Cabecinhas | 1a96ef8 | 2012-05-11 20:39:42 +0000 | [diff] [blame] | 934 | return int(self.sbtarget.GetNumModules()) |
Greg Clayton | 6b2bd93 | 2012-02-01 08:09:32 +0000 | [diff] [blame] | 935 | return 0 |
| 936 | |
| 937 | def __getitem__(self, key): |
| 938 | num_modules = self.sbtarget.GetNumModules() |
| 939 | if type(key) is int: |
| 940 | if key < num_modules: |
| 941 | return self.sbtarget.GetModuleAtIndex(key) |
| 942 | elif type(key) is str: |
| 943 | if key.find('/') == -1: |
| 944 | for idx in range(num_modules): |
| 945 | module = self.sbtarget.GetModuleAtIndex(idx) |
| 946 | if module.file.basename == key: |
| 947 | return module |
| 948 | else: |
| 949 | for idx in range(num_modules): |
| 950 | module = self.sbtarget.GetModuleAtIndex(idx) |
| 951 | if module.file.fullpath == key: |
| 952 | return module |
| 953 | # See if the string is a UUID |
Greg Clayton | 1fb7c62 | 2013-03-07 02:58:47 +0000 | [diff] [blame] | 954 | try: |
| 955 | the_uuid = uuid.UUID(key) |
| 956 | if the_uuid: |
| 957 | for idx in range(num_modules): |
| 958 | module = self.sbtarget.GetModuleAtIndex(idx) |
| 959 | if module.uuid == the_uuid: |
| 960 | return module |
| 961 | except: |
| 962 | return None |
Greg Clayton | 6b2bd93 | 2012-02-01 08:09:32 +0000 | [diff] [blame] | 963 | elif type(key) is uuid.UUID: |
| 964 | for idx in range(num_modules): |
| 965 | module = self.sbtarget.GetModuleAtIndex(idx) |
| 966 | if module.uuid == key: |
| 967 | return module |
| 968 | elif type(key) is re.SRE_Pattern: |
| 969 | matching_modules = [] |
| 970 | for idx in range(num_modules): |
| 971 | module = self.sbtarget.GetModuleAtIndex(idx) |
| 972 | re_match = key.search(module.path.fullpath) |
| 973 | if re_match: |
| 974 | matching_modules.append(module) |
| 975 | return matching_modules |
| 976 | else: |
| 977 | print "error: unsupported item type: %s" % type(key) |
| 978 | return None |
| 979 | |
| 980 | def get_modules_access_object(self): |
Greg Clayton | b62bb8c | 2012-02-03 03:22:53 +0000 | [diff] [blame] | 981 | '''An accessor function that returns a modules_access() object which allows lazy module access from a lldb.SBTarget object.''' |
Greg Clayton | 6b2bd93 | 2012-02-01 08:09:32 +0000 | [diff] [blame] | 982 | return self.modules_access (self) |
| 983 | |
| 984 | def get_modules_array(self): |
Greg Clayton | b62bb8c | 2012-02-03 03:22:53 +0000 | [diff] [blame] | 985 | '''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.''' |
Greg Clayton | 6b2bd93 | 2012-02-01 08:09:32 +0000 | [diff] [blame] | 986 | modules = [] |
| 987 | for idx in range(self.GetNumModules()): |
| 988 | modules.append(self.GetModuleAtIndex(idx)) |
| 989 | return modules |
| 990 | |
| 991 | __swig_getmethods__["modules"] = get_modules_array |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 992 | if _newclass: modules = property(get_modules_array, None, doc='''A read only property that returns a list() of lldb.SBModule objects contained in this target. This list is a list all modules that the target currently is tracking (the main executable and all dependent shared libraries).''') |
Greg Clayton | 6b2bd93 | 2012-02-01 08:09:32 +0000 | [diff] [blame] | 993 | |
| 994 | __swig_getmethods__["module"] = get_modules_access_object |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 995 | if _newclass: module = property(get_modules_access_object, None, doc=r'''A read only property that returns an object that implements python operator overloading with the square brackets().\n target.module[<int>] allows array access to any modules.\n target.module[<str>] allows access to modules by basename, full path, or uuid string value.\n target.module[uuid.UUID()] allows module access by UUID.\n target.module[re] allows module access using a regular expression that matches the module full path.''') |
Greg Clayton | 6b2bd93 | 2012-02-01 08:09:32 +0000 | [diff] [blame] | 996 | |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 997 | __swig_getmethods__["process"] = GetProcess |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 998 | if _newclass: process = property(GetProcess, None, doc='''A read only property that returns an lldb object that represents the process (lldb.SBProcess) that this target owns.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 999 | |
| 1000 | __swig_getmethods__["executable"] = GetExecutable |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 1001 | if _newclass: executable = property(GetExecutable, None, doc='''A read only property that returns an lldb object that represents the main executable module (lldb.SBModule) for this target.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1002 | |
| 1003 | __swig_getmethods__["debugger"] = GetDebugger |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 1004 | if _newclass: debugger = property(GetDebugger, None, doc='''A read only property that returns an lldb object that represents the debugger (lldb.SBDebugger) that owns this target.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1005 | |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1006 | __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 1007 | if _newclass: num_breakpoints = property(GetNumBreakpoints, None, doc='''A read only property that returns the number of breakpoints that this target has as an integer.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1008 | |
| 1009 | __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 1010 | if _newclass: num_watchpoints = property(GetNumWatchpoints, None, doc='''A read only property that returns the number of watchpoints that this target has as an integer.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1011 | |
| 1012 | __swig_getmethods__["broadcaster"] = GetBroadcaster |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 1013 | if _newclass: broadcaster = property(GetBroadcaster, None, doc='''A read only property that an lldb object that represents the broadcaster (lldb.SBBroadcaster) for this target.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1014 | |
| 1015 | __swig_getmethods__["byte_order"] = GetByteOrder |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 1016 | if _newclass: byte_order = property(GetByteOrder, None, doc='''A read only property that returns an lldb enumeration value (lldb.eByteOrderLittle, lldb.eByteOrderBig, lldb.eByteOrderInvalid) that represents the byte order for this target.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1017 | |
| 1018 | __swig_getmethods__["addr_size"] = GetAddressByteSize |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 1019 | if _newclass: addr_size = property(GetAddressByteSize, None, doc='''A read only property that returns the size in bytes of an address for this target.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1020 | |
| 1021 | __swig_getmethods__["triple"] = GetTriple |
Greg Clayton | 5ef31a9 | 2012-06-29 22:00:42 +0000 | [diff] [blame] | 1022 | if _newclass: triple = property(GetTriple, None, doc='''A read only property that returns the target triple (arch-vendor-os) for this target as a string.''') |
Matthew Gardiner | c928de3 | 2014-10-22 07:22:56 +0000 | [diff] [blame] | 1023 | |
| 1024 | __swig_getmethods__["data_byte_size"] = GetDataByteSize |
Enrico Granata | d72ffc6 | 2014-11-13 01:38:38 +0000 | [diff] [blame] | 1025 | if _newclass: data_byte_size = property(GetDataByteSize, None, doc='''A read only property that returns the size in host bytes of a byte in the data address space for this target.''') |
Matthew Gardiner | c928de3 | 2014-10-22 07:22:56 +0000 | [diff] [blame] | 1026 | |
| 1027 | __swig_getmethods__["code_byte_size"] = GetCodeByteSize |
Enrico Granata | d72ffc6 | 2014-11-13 01:38:38 +0000 | [diff] [blame] | 1028 | if _newclass: code_byte_size = property(GetCodeByteSize, None, doc='''A read only property that returns the size in host bytes of a byte in the code address space for this target.''') |
Matthew Gardiner | c928de3 | 2014-10-22 07:22:56 +0000 | [diff] [blame] | 1029 | |
| 1030 | __swig_getmethods__["platform"] = GetPlatform |
| 1031 | if _newclass: platform = property(GetPlatform, None, doc='''A read only property that returns the platform associated with with this target.''') |
Greg Clayton | 13d1950 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 1032 | %} |
| 1033 | |
Johnny Chen | dc7d3c1 | 2011-07-16 21:15:39 +0000 | [diff] [blame] | 1034 | }; |
| 1035 | |
| 1036 | } // namespace lldb |