Symbols & Objective-C¶
Symbol¶
hilda.symbol ¶
SymbolFormatField ¶
Bases: FormatField
A Symbol wrapper for construct
Source code in hilda/symbol.py
Symbol ¶
Bases: int
Hilda's class representing a symbol (not necessarily an LLDB symbol).
Source code in hilda/symbol.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
file_address
cached
property
¶
Get symbol file address (address without ASLR)
Returns:
| Type | Description |
|---|---|
int
|
File address |
objc_class
property
¶
objc_symbol
property
¶
Get an ObjectiveC symbol of the same address
Returns:
| Type | Description |
|---|---|
|
Object representing the ObjectiveC symbol |
cf_description
property
¶
Get output from CFCopyDescription()
Returns:
| Type | Description |
|---|---|
str
|
CFCopyDescription()'s output as a string |
create
classmethod
¶
create(value: int, client, lldb_symbol: Optional[SBSymbol] = None, lldb_address: Optional[SBAddress] = None, lldb_type: Optional[int] = None) -> None
Create a Symbol object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
Symbol address. |
required |
client
|
HildaClient
|
Hilda client. |
required |
lldb_symbol
|
SBSymbol
|
LLDB symbol. |
None
|
Returns:
| Type | Description |
|---|---|
Symbol
|
Symbol object. |
Source code in hilda/symbol.py
change_item_size ¶
Temporarily change item size
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_item_size
|
int
|
Temporary item size |
required |
Source code in hilda/symbol.py
close ¶
seek ¶
Construct compliance.
Source code in hilda/symbol.py
read ¶
write ¶
Symbols container¶
hilda.symbols ¶
SymbolIdentifier
dataclass
¶
SymbolList ¶
Manager for Symbol objects, each one representing a symbol.
Symbols are either regular (i.e., named) symbols or anonymous symbols.
Only regular symbols are managed by this class, though anonymous
symbols can be created by this class (using the function add).
Source code in hilda/symbols.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | |
get ¶
get(address_or_name_or_id_or_symbol: Union[int, str, HildaSymbolId, SBSymbol, Symbol]) -> Optional[Symbol]
Get a symbol by address or name or ID (or the symbol itself, though it usually makes little sense)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address_or_name_or_id_or_symbol
|
Union[int, str, HildaSymbolId, SBSymbol, Symbol]
|
Address or name or ID (or the symbol itself) |
required |
Returns:
| Type | Description |
|---|---|
Optional[Symbol]
|
|
Source code in hilda/symbols.py
force_refresh ¶
Force a refresh of symbols
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_range
|
index range for images to load in the form of [start, end] |
None
|
|
module_filename_filter
|
filter only images containing given expression |
''
|
Source code in hilda/symbols.py
add ¶
add(value: Union[int, Symbol], symbol_name: Optional[str] = None, symbol_type: Optional[str] = None, symbol_size: Optional[int] = None) -> Symbol
Add a symbol. Returns existing symbol if a matching regular (i.e., non-anonymous) symbol exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Union[int, Symbol]
|
The address of the symbol (in memory) or and existing |
required |
symbol_name
|
Optional[str]
|
The name of the symbol. |
None
|
symbol_type
|
Optional[str]
|
The type of the symbol (either 'code' of 'data', defaults to 'code'). |
None
|
symbol_size
|
Optional[int]
|
The size of the symbol (defaults to 8 bytes). |
None
|
Returns:
| Type | Description |
|---|---|
Symbol
|
The symbol |
Source code in hilda/symbols.py
add_multiple_file_symbols ¶
add_multiple_file_symbols(symbol_identifiers: list[SymbolIdentifier], symbol_type: Optional[str] = None, module_name: Optional[str] = None) -> list[Symbol]
Add multiple symbols by file address. Expects SymbolIdentifier entries (tuple inputs are accepted for compatibility).
Source code in hilda/symbols.py
remove ¶
Remove a symbol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address_or_name_or_id_or_symbol
|
Union[int, str, HildaSymbolId, SBSymbol, Symbol]
|
Address or name or ID (or the symbol itself) |
required |
Source code in hilda/symbols.py
items ¶
keys ¶
values ¶
bp ¶
Place a breakpoint on all symbols in current list. Look for the bp command for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback
|
callback function to be executed upon an hit |
None
|
|
args
|
optional args for the bp command |
{}
|
Source code in hilda/symbols.py
monitor ¶
Perform monitor for all symbols in current list. See monitor command for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
given arguments for monitor command |
{}
|
Source code in hilda/symbols.py
filter_by_module ¶
Filter symbols whose module name contains the provided substring.
Returns:
| Type | Description |
|---|---|
SymbolList
|
reduced symbol list |
Source code in hilda/symbols.py
filter_symbol_type ¶
Filter by LLDB symbol types (for example: lldb.eSymbolTypeCode, lldb.eSymbolTypeData, ...)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lldb_type
|
symbol type from LLDB consts |
required |
Returns:
| Type | Description |
|---|---|
SymbolList
|
symbols matching the type filter |
Source code in hilda/symbols.py
filter_code_symbols ¶
Filter only code symbols
Returns:
| Type | Description |
|---|---|
SymbolList
|
symbols with type lldb.eSymbolTypeCode |
filter_data_symbols ¶
Filter only data symbols
Returns:
| Type | Description |
|---|---|
SymbolList
|
symbols with type lldb.eSymbolTypeData |
filter_objc_classes ¶
Filter only objc meta classes
Returns:
| Type | Description |
|---|---|
SymbolList
|
symbols with type lldb.eSymbolTypeObjCMetaClass |
filter_startswith ¶
Filter only symbols with given prefix
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp
|
str
|
prefix |
required |
case_sensitive
|
bool
|
is case sensitive |
True
|
Returns:
| Type | Description |
|---|---|
SymbolList
|
reduced symbol list |
Source code in hilda/symbols.py
filter_endswith ¶
Filter only symbols with given prefix
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp
|
str
|
prefix |
required |
case_sensitive
|
bool
|
is case sensitive |
True
|
Returns:
| Type | Description |
|---|---|
SymbolList
|
reduced symbol list |
Source code in hilda/symbols.py
filter_name_contains ¶
filter_name_contains(exp: str, case_sensitive: bool = True, use_bare_lldb_api: bool = False) -> SymbolList
Filter symbols containing a given expression
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp
|
str
|
given expression |
required |
case_sensitive
|
bool
|
is case sensitive |
True
|
use_bare_lldb_api
|
bool
|
Use bare lldb api (Using |
False
|
Returns:
| Type | Description |
|---|---|
SymbolList
|
reduced symbol list |
Source code in hilda/symbols.py
Objective-C classes¶
hilda.objective_c_class ¶
Method
dataclass
¶
Source code in hilda/objective_c_class.py
from_data
staticmethod
¶
Create Method object from raw data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
class_name
|
str
|
ObjC class name |
required |
data
|
dict
|
Data as loaded from get_objectivec_symbol_data.m. |
required |
client
|
HildaClient
|
Hilda client. |
required |
Source code in hilda/objective_c_class.py
monitor ¶
Perform monitor on method's IMP. See monitor command for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
given arguments for monitor command |
{}
|
bp ¶
Place a breakpoint on method's IMP. See bp command for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
given arguments for bp command |
{}
|
MethodList ¶
Bases: UserList
Source code in hilda/objective_c_class.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
get ¶
Get a specific method implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Method name. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Method]
|
Method. |
bp ¶
Place a breakpoint on all symbols in the method list. Look for the bp command for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback
|
callback function to be executed upon an hit |
None
|
|
kwargs
|
optional kwargs for the bp command |
{}
|
Source code in hilda/objective_c_class.py
monitor ¶
Perform monitor for all symbols in the method list. See monitor command for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kwargs
|
given arguments for monitor command |
{}
|
Source code in hilda/objective_c_class.py
filter_startswith ¶
Filter only methods with given prefix
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp
|
prefix |
required | |
case_sensitive
|
is case sensitive |
True
|
Returns:
| Type | Description |
|---|---|
|
reduced method list |
Source code in hilda/objective_c_class.py
filter_name_contains ¶
Filter methods containing a given expression
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp
|
given expression |
required | |
case_sensitive
|
is case sensitive |
True
|
Returns:
| Type | Description |
|---|---|
|
reduced method list |
Source code in hilda/objective_c_class.py
Class ¶
Wrapper for ObjectiveC Class object.
Source code in hilda/objective_c_class.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
from_class_name
staticmethod
¶
Create ObjectiveC Class from given class name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
HildaClient
|
Hilda client. |
required |
class_name
|
str
|
Class name. |
required |
Source code in hilda/objective_c_class.py
sanitize_name
staticmethod
¶
Sanitize python name to ObjectiveC name.
reload ¶
Reload class object data. Should be used whenever the class layout changes (for example, during method swizzling)
Source code in hilda/objective_c_class.py
show ¶
objc_call ¶
Invoke a selector on the given class object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sel
|
str
|
Selector name. |
required |
Returns:
| Type | Description |
|---|---|
|
whatever the selector returned as a symbol. |
capture_self ¶
Capture the first called self from this class.
Access using self.captured_objects
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sync
|
bool
|
Should wait until captured object is returned? |
False
|
Returns:
| Type | Description |
|---|---|
|
Captured object if sync is True, None otherwise |