IDA C++ SDK 9.2
Loading...
Searching...
No Matches
dscu.h
Go to the documentation of this file.
1#pragma once
2
3#include <string_view>
4
5#include <pro.h>
6#include <range.hpp>
7#include <loader.hpp>
8
73
74
75//-------------------------------------------------------------------------
76struct dscu_svc_t;
77struct dscu_ctx_t;
78
79//-------------------------------------------------------------------------
81{
82 friend dscu_ctx_t;
83
84protected:
85 enum code_t
86 {
90
91#ifdef TESTABLE_BUILD
93#endif
94 };
95
96private:
98
99protected:
101 : code(_code) {}
102
103 bool _perform()
104 {
105 return load_and_run_plugin("dscu", size_t(this));
106 }
107};
108
109//-------------------------------------------------------------------------
111{
112 friend dscu_ctx_t;
113
114 bytevec_t uuid;
115 qstring path;
116 int image_index = -1;
117
118public:
120 const bytevec_t &_uuid,
121 const qstring &_path,
122 int _image_index)
124 {
125 uuid = _uuid;
126 path = _path;
127 image_index = _image_index;
128 }
129
130 bool perform()
131 {
132 return _perform();
133 }
134};
135
136//-------------------------------------------------------------------------
138{
139 friend dscu_ctx_t;
140
141 dscu_svc_t *ds = nullptr;
142
143public:
146
148 {
149 _perform();
150 return ds;
151 }
152};
153
154//-------------------------------------------------------------------------
167{
168 return dscu_svc_req_t().perform();
169};
170
171//-------------------------------------------------------------------------
184
185//-------------------------------------------------------------------------
188{
191
192 bool operator==(const mapping_coords_t &r) const
193 {
194 return file_index == r.file_index
196 }
197 bool operator!=(const mapping_coords_t &r) const
198 {
199 return !(*this == r);
200 }
201
202 inline bool valid() const { return file_index >= 0 && mapping_index >= 0; }
203
205 {
207 c.file_index = int16(-1);
208 c.mapping_index = int16(-1);
209 return c;
210 }
211};
212CASSERT(sizeof(mapping_coords_t) == sizeof(int));
215
216//-----------------------------------------------------------------------------
234{
235 ea_t start = BADADDR;
237
239
241 union
242 {
243 int image_index = -1;
245 };
246
247 char name[40] = { 0 };
248
249
251 {
252 qswap(start, r.start);
253 qswap(size, r.size);
254 qswap(type, r.type);
256 qswap(name, r.name);
257 }
258
259 range_t get_range() const { return range_t(start, start+size); }
260
261 bool operator==(const region_info_t &r) const
262 {
263 return start == r.start
264 && size == r.size
265 && type == r.type
267 && streq(name, r.name);
268 }
269 bool operator!=(const region_info_t &r) const { return !(*this == r); }
270};
271CASSERT(sizeof(region_info_t) == 64);
274
275//-------------------------------------------------------------------------
288
289//-------------------------------------------------------------------------
290typedef std::set<int> dyldlib_set_t;
291
292//-------------------------------------------------------------------------
297{
304
305#define DLRF_UNDO_ON_FAILURE 0x1
306#define DLRF_CREATE_UNDO_POINT (0x2 | DLRF_UNDO_ON_FAILURE)
307#define DLRF_SILENT 0x4
308#define DLRF_ASK_CONFIRMATION 0x8
309#define DLRF_DEFAULT (DLRF_CREATE_UNDO_POINT)
310
312
313 dscu_load_request_t(uint32 _flags=DLRF_DEFAULT) : flags(_flags) {}
314
315 void add_region(const region_info_t &ri)
316 {
317 switch ( ri.type )
318 {
319 case rt_image_entity:
320 // Regions belonging to images, need to cause a full image load
321 images.add_unique(ri.image_index);
322 break;
323
324 case rt_island:
325 islands.add_unique(ri.branch_island_number);
326 break;
327
328 case rt_mapping:
329 mappings.add_unique(ri.start);
330 break;
331
332 case rt_header:
333 // ?
334 break;
335
336 case rt_got:
337 gots.add_unique(ri.start);
338 break;
339
340 case rt_unknown:
341 unknown_regions.add_unique(ri.start);
342 break;
343
344 case rt_cache_data:
345 cache_data.add_unique(ri.start);
346 break;
347
348 default:
349 TB_INTERR_OR_RETURN(0);
350 }
351 }
352
354 {
355 for ( const auto &ri : ris )
356 add_region(ri);
357 }
358
359 void clear()
360 {
361 images.clear();
362 islands.clear();
363 mappings.clear();
364 gots.clear();
365 unknown_regions.clear();
366 cache_data.clear();
367 flags = DLRF_DEFAULT;
368 }
369
370 bool empty() const
371 {
372 return images.empty()
373 && islands.empty()
374 && mappings.empty()
375 && gots.empty()
376 && unknown_regions.empty()
377 && cache_data.empty();
378 }
379};
380
381//-------------------------------------------------------------------------
384{
385 std::string_view symbol;
386 ea_t ea = BADADDR;
387 int image_index = -1;
388
389 bool operator==(const symbol_match_t &r) const
390 {
391 return ea == r.ea && image_index == r.image_index && symbol == r.symbol;
392 }
393 bool operator!=(const symbol_match_t &r) const { return !(*this == r); }
394};
397
398//-------------------------------------------------------------------------
401{
402 ea_t ea = BADADDR;
403 int image_index = -1;
406 size_t file_index = 0;
410
411 bool operator==(const string_match_t &r) const
412 {
413 return ea == r.ea
415 && file_index == r.file_index
417 && context == r.context;
418 }
419 bool operator!=(const string_match_t &r) const { return !(*this == r); }
420};
423
424//-------------------------------------------------------------------------
425class shared_cache_toplevel_file_t;
426
427//-------------------------------------------------------------------------
430{
432 int image_index = -1;
434
436 {
437 return image_name == r.image_name
440 }
441 bool operator!=(const dependency_match_entry_t &r) const { return !(*this == r); }
442};
445
446//-------------------------------------------------------------------------
451
452//-------------------------------------------------------------------------
457{
458 virtual ~dscu_svc_t() {}
459
461 virtual std::shared_ptr<shared_cache_toplevel_file_t> get_toplevel() const = 0;
462
466 virtual bool get_input_file_path(qstring *out) const = 0;
467
469 virtual adiff_t get_dyld_slide() const = 0;
470
473 virtual void update_dyld_slide(adiff_t delta) = 0;
474
476
477
480 virtual void get_files_names(qstrvec_t *out) const = 0;
481
486 virtual bool get_file_name(qstring *out, size_t file_index) const = 0;
487
491 virtual size_t get_file_index(const char *file_name) const = 0;
492
497 virtual bool get_file_mappings(mapping_coords_vec_t *out, const char *file_name) const = 0;
498
500
502
503
508 virtual bool get_mapping_range(range_t *out, mapping_coords_t mapping) const = 0;
509
516 virtual address_info_t locate_address(ea_t ea) const = 0;
517
519
521
522
529 virtual bool get_region(region_info_t *ri, size_t region_index, bool full=true) const = 0;
530
537 virtual bool get_region_by_ea(
538 region_info_t *ri,
539 ea_t ea,
540 size_t *out_region_index=nullptr,
541 bool full=true) const = 0;
542
548 virtual void get_regions(
549 region_info_vec_t *vout,
550 const sizevec_t *region_indexes=nullptr,
551 bool full=true) const = 0;
552
554
561
562
564 virtual int get_images_count() const = 0;
565
568 virtual void get_images_names(qstrvec_t *out) const = 0;
569
573 virtual int get_image_index(const char *image_name) const = 0;
574
579 virtual bool get_image_name(qstring *out, int image_index) const = 0;
580
586 bool get_image_filename(qstring *out, int image_index) const
587 {
588 bool ok = get_image_name(out, image_index);
589 if ( ok )
590 {
591 const size_t pos = out->rfind('/');
592 ok = pos != qstring::npos;
593 if ( ok )
594 {
595 qstring tmp(out->c_str() + pos + 1, out->length() - pos - 1);
596 out->swap(tmp);
597 }
598 }
599 return ok;
600 }
601
605 virtual mapping_coords_t get_image_mapping(int image_index) const = 0;
606 inline mapping_coords_t get_image_mapping(const char *image_name) const { return get_image_mapping(get_image_index(image_name)); }
607
610 virtual bool is_image_loaded(int image_index) const = 0;
611 inline bool is_image_loaded(const char *image_name) const { return is_image_loaded(get_image_index(image_name)); }
612
617 virtual bool get_image_file_name(qstring *out, int image_index) const = 0;
618 inline bool get_image_file_name(qstring *out, const char *image_name) const { return get_image_file_name(out, get_image_index(image_name)); }
619
625 virtual bool get_image_regions(region_info_vec_t *out, int image_index, bool full=true) const = 0;
626 inline bool get_image_regions(region_info_vec_t *out, const char *image_name, bool full=true) const { return get_image_regions(out, get_image_index(image_name), full); }
627
632 virtual bool get_image_regions_indexes(sizevec_t *out, int image_index) const = 0;
633 inline bool get_image_regions_indexes(sizevec_t *out, const char *image_name) const { return get_image_regions_indexes(out, get_image_index(image_name)); }
634
641 virtual bool get_image_dependencies(intvec_t *out, int image_index, int depth=1) const = 0;
642 inline bool get_image_dependencies(intvec_t *out, const char *image_name, int depth=1) const { return get_image_dependencies(out, get_image_index(image_name), depth); }
643
647 virtual ea_t get_image_address(int image_index) const = 0;
648
652 virtual uint64 get_image_total_size(int image_index) const = 0;
653 inline uint64 get_image_total_size(const char *image_name) const { return get_image_total_size(get_image_index(image_name)); }
654
658 virtual size_t get_image_file_index(int image_index) const = 0;
659 inline size_t get_image_file_index(const char *image_name) const { return get_image_file_index(get_image_index(image_name)); }
660
666 virtual bool get_images_dependencies(intvec_t *out, const intvec_t &images_indexes, int depth=1) const = 0;
667
669
671
672
675 virtual bool is_island_loaded(int island_index) const = 0;
676
678
680
681
688 virtual bool load_image(int image_index, uint32 flags=DLRF_DEFAULT) = 0;
689
694 virtual bool load_island(int island_index, uint32 flags=DLRF_DEFAULT) = 0;
695
700 virtual bool load_branch_mapping(ea_t ea, uint32 flags=DLRF_DEFAULT) = 0;
701
704 virtual bool is_mapping_loaded(ea_t mapping_addr) const = 0;
705
712 virtual bool load_got(ea_t ea, uint32 flags=DLRF_DEFAULT) = 0;
713
716 virtual bool is_got_loaded(ea_t got_addr) const = 0;
717
724 virtual bool load_unknown_region(ea_t ea, uint32 flags=DLRF_DEFAULT) = 0;
725
728 virtual bool is_unknown_region_loaded(ea_t ea) const = 0;
729
736 virtual bool load_cache_data(ea_t ea, uint32 flags=DLRF_DEFAULT) = 0;
737
740 virtual bool is_cache_data_loaded(ea_t cache_data_addr) const = 0;
741
746 virtual bool load_regions(const dscu_load_request_t &regions) = 0;
747
750 virtual int get_load_regions_requests_count() const = 0;
751
753
755
756
760 virtual region_type_t get_region_type(size_t region_index) const = 0;
761
769 virtual bool query_symbols(
771 const range_t &range) const = 0;
772
777 virtual std::string_view query_symbol(ea_t ea) const = 0;
778
784 virtual std::string_view query_exported_symbol(ea_t ea) const = 0;
785
789#define FSF_LOADED_IMAGES_ONLY 0x1
790#define FSF_CASE_INSENSITIVE 0x2
792
805 virtual bool find_symbol(
807 const char *needle,
808 uint32 flags=0,
809 size_t max_count=size_t(-1)) const = 0;
810
814#define FSSF_SCOPE_IMAGES 0x00
815#define FSSF_SCOPE_FILES 0x01
816#define FSSF_SCOPE_MASK 0x01
817
818#define FSSF_IMAGES_SCOPE_DATA_SECTIONS 0x00
819#define FSSF_IMAGES_SCOPE_ALL 0x02
820#define FSSF_IMAGES_SCOPE_MASK 0x02
821
822#define FSSF_FILES_INCLUDE_SYMBOLS 0x04
823#define FSSF_FILES_INCLUDE_BRANCH_MAPPINGS 0x08
824#define FSSF_FILES_INCLUDE_OTHER 0x10
825
826#define FSSF_CASE_INSENSITIVE 0x20
828
837 virtual bool find_string(
839 const char *needle,
840 uint32 flags=0,
841 size_t max_count=size_t(-1)) const = 0;
842
844 virtual bool has_local_symbols() const = 0;
845
854
858#define MDF_ALLOW_CPU_MISMATCH 0x1
859#define MDF_ALLOW_PLATFORM_MISMATCH 0x2
861
871 const char *path,
872 uint32 flags=0) const = 0;
873
877#define DLF_VALIDATE (1 << 0)
878#define DLF_VALIDATE_HARD (DLF_VALIDATE | (1 << 1))
879#define DLF_TOPLEVEL_INPUT_PATH (1 << 2)
880#define DLF_TOPLEVEL_DETAILS (1 << 3)
881#define DLF_TOPLEVEL (DLF_TOPLEVEL_INPUT_PATH | DLF_TOPLEVEL_DETAILS)
882#define DLF_FILES (1 << 4)
883#define DLF_MAPPINGS (1 << 5)
884#define DLF_IMAGES (1 << 6)
885#define DLF_IMAGES_DEPENDENCIES (DLF_IMAGES | (1 << 7))
886#define DLF_IMAGES_REGIONS (DLF_IMAGES | (1 << 8))
887#define DLF_ISLANDS (1 << 9)
888#define DLF_ISLANDS_REGIONS (DLF_ISLANDS | (1 << 10))
889#define DLF_GOTS (1 << 11)
890#define DLF_UNKNOWN_REGIONS (1 << 12)
891#define DLF_CACHE_DATA (1 << 13)
892
893#define DLF_ALL 0xFFFFFFFF
895
900 virtual void dump_layout(uint32 flags=DLF_ALL) const = 0;
901
902};
903
void swap(_qstring< qchar > &r)
Swap contents of two qstrings. see qvector::swap()
Definition pro.h:3198
size_t rfind(qchar c, size_t pos=0) const
Search backwards for a character in the qstring.
Definition pro.h:3459
static constexpr size_t npos
Definition pro.h:3769
size_t length(void) const
Get number of chars in this qstring (not including terminating zero)
Definition pro.h:3199
const qchar * c_str(void) const
Convert the qstring to a char *.
Definition pro.h:3246
Vector of bytes (use for dynamic memory)
Definition pro.h:3850
dscu_create_layout_req_t(const bytevec_t &_uuid, const qstring &_path, int _image_index)
Definition dscu.h:119
bool perform()
Definition dscu.h:130
dscu_req_t(code_t _code)
Definition dscu.h:100
code_t
Definition dscu.h:86
@ drc_create_layout
Definition dscu.h:88
@ drc_load_cancellation_req
Definition dscu.h:92
@ drc_unknown
Definition dscu.h:87
@ drc_get_dscu_svc
Definition dscu.h:89
bool _perform()
Definition dscu.h:103
Definition dscu.h:138
dscu_svc_req_t()
Definition dscu.h:144
dscu_svc_t * perform()
Definition dscu.h:147
Reimplementation of vector class from STL.
Definition pro.h:2262
CASSERT(sizeof(mapping_coords_t)==sizeof(int))
qvector< symbol_match_t > symbol_match_vec_t
Definition dscu.h:396
qvector< string_match_t > string_match_vec_t
Definition dscu.h:422
qvector< region_info_t > region_info_vec_t
Definition dscu.h:273
dscu_svc_t * get_dscu_svc()
Retrieve the "shared cache services".
Definition dscu.h:166
region_type_t
Available region types. See the region_info_t documentation for more info.
Definition dscu.h:174
@ rt_unknown
A covered cache region whose content we don't (yet) identify.
Definition dscu.h:180
@ rt_invalid
Invalid.
Definition dscu.h:175
@ rt_mapping
A subcache branch mapping.
Definition dscu.h:179
@ rt_cache_data
Cache-wide named data (e.g. a linkedit subcache mapping)
Definition dscu.h:182
@ rt_header
The dyld header.
Definition dscu.h:178
@ rt_got
A Global Offset Table.
Definition dscu.h:181
@ rt_image_entity
A subset of an image (segment, section, ...)
Definition dscu.h:176
@ rt_island
A branch island.
Definition dscu.h:177
DECLARE_TYPE_AS_MOVABLE(mapping_coords_t)
qvector< mapping_coords_t > mapping_coords_vec_t
Definition dscu.h:214
std::set< int > dyldlib_set_t
Definition dscu.h:290
qvector< dependency_match_entry_t > dependency_match_entry_vec_t
Definition dscu.h:444
virtual region_type_t get_region_type(size_t region_index) const =0
Return the type of the region at region_index.
virtual bool find_symbol(symbol_match_vec_t *out, const char *needle, uint32 flags=0, size_t max_count=size_t(-1)) const =0
Find all symbols whose name contains needle, searching the cache's local symbol table and each image'...
virtual void dump_layout(uint32 flags=DLF_ALL) const =0
Dump the full cache layout to the output window.
virtual bool find_string(string_match_vec_t *out, const char *needle, uint32 flags=0, size_t max_count=size_t(-1)) const =0
Find all occurrences of needle in the cache's byte content.
virtual bool query_symbols(symbol_match_vec_t *out, const range_t &range) const =0
Find symbols from the cache's local symbol table that fall within range.
virtual depmatch_code_t match_dependencies(dependency_match_result_t *out, const char *path, uint32 flags=0) const =0
Parse the Mach-O file's load commands, and match the image dependencies to this DSC.
depmatch_code_t
Definition dscu.h:847
virtual std::string_view query_symbol(ea_t ea) const =0
Look up a single address in the local symbol table.
virtual std::string_view query_exported_symbol(ea_t ea) const =0
Look up an address in the per-image export tables.
virtual bool has_local_symbols() const =0
Whether this cache has a .symbols sidecar file.
@ dmc_cpu_mismatch
CPU architecture doesn't match the shared cache's (see MDF_ALLOW_CPU_MISMATCH)
Definition dscu.h:850
@ dmc_platform_mismatch
Platform doesn't match the shared cache's (see MDF_ALLOW_PLATFORM_MISMATCH)
Definition dscu.h:851
@ dmc_failed
Failed to satisfy the request, for misc. reasons.
Definition dscu.h:852
@ dmc_ok
Match succeeded.
Definition dscu.h:848
@ dmc_bad_file
File either not present or not a Mach-O file.
Definition dscu.h:849
int code
Definition fpro.h:88
bool ok
Definition kernwin.hpp:7410
idaman int64 pos
Definition kernwin.hpp:1398
unsigned __int64 uint64
Definition llong.hpp:13
Definitions of IDP, LDR, PLUGIN module interfaces.
bool idaapi load_and_run_plugin(const char *name, size_t arg)
Load & run a plugin.
Definition loader.hpp:805
qvector< qstring > qstrvec_t
Definition lumina.hpp:831
This is the first header included in the IDA project.
unsigned int uint32
unsigned 32 bit value
Definition pro.h:352
qvector< int > intvec_t
vector of integers
Definition pro.h:2839
uint64 asize_t
Definition pro.h:427
qvector< size_t > sizevec_t
vector of sizes
Definition pro.h:2841
short int16
signed 16 bit value
Definition pro.h:349
int64 adiff_t
Definition pro.h:428
uint64 ea_t
Definition pro.h:425
THREAD_SAFE void qswap(T &a, T &b)
Swap 2 objects of the same type using memory copies.
Definition pro.h:1728
qvector< ea_t > eavec_t
vector of addresses
Definition pro.h:2838
_qstring< char > qstring
regular string
Definition pro.h:3771
Contains the definition of range_t.
Resolution of a single address into the cache layout: the region it lives in, the mapping that backs ...
Definition dscu.h:280
uint64 file_offset
Offset within the on-disk file backing mapping.
Definition dscu.h:283
region_info_t region
Region containing the address (type=rt_invalid if not found)
Definition dscu.h:281
mapping_coords_t mapping
Mapping that backs the address.
Definition dscu.h:282
bool valid() const
Definition dscu.h:285
Report on one "load command" entry found in an external file.
Definition dscu.h:430
bool operator!=(const dependency_match_entry_t &r) const
Definition dscu.h:441
bool operator==(const dependency_match_entry_t &r) const
Definition dscu.h:435
int image_index
The image index in this DSC (-1 if not found)
Definition dscu.h:432
qstring image_name
The image name.
Definition dscu.h:431
uint32 load_command_type
Load command type. One of ACH_LC_*.
Definition dscu.h:433
The result of a dscu_svc_t::match_dependencies operation.
Definition dscu.h:449
A load request, offering the ability to be populated from previously-retrieved region_info_t,...
Definition dscu.h:297
eavec_t gots
global offset table ranges
Definition dscu.h:301
dscu_load_request_t(uint32 _flags=DLRF_DEFAULT)
Definition dscu.h:313
void add_regions(const region_info_vec_t &ris)
Definition dscu.h:353
eavec_t mappings
branch mappings
Definition dscu.h:300
uint32 flags
Definition dscu.h:311
eavec_t unknown_regions
unknown-region ranges (covered, but unidentified)
Definition dscu.h:302
bool empty() const
Definition dscu.h:370
intvec_t islands
branch island numbers
Definition dscu.h:299
void add_region(const region_info_t &ri)
Definition dscu.h:315
eavec_t cache_data
cache-wide data ranges (e.g. linkedit subcache mappings)
Definition dscu.h:303
void clear()
Definition dscu.h:359
intvec_t images
image indexes
Definition dscu.h:298
IDA's DSC API interface.
Definition dscu.h:457
virtual bool is_island_loaded(int island_index) const =0
Check whether a branch island has been loaded into the database.
virtual bool is_got_loaded(ea_t got_addr) const =0
Check whether a GOT region has been loaded.
virtual void get_files_names(qstrvec_t *out) const =0
Retrieve the names of all cache files (toplevel + subcaches).
virtual bool get_image_name(qstring *out, int image_index) const =0
Retrieve the full path of an image.
virtual bool load_cache_data(ea_t ea, uint32 flags=DLRF_DEFAULT)=0
Load a cache-wide data region (e.g.
bool is_image_loaded(const char *image_name) const
Definition dscu.h:611
mapping_coords_t get_image_mapping(const char *image_name) const
Definition dscu.h:606
virtual int get_image_index(const char *image_name) const =0
Look up an image index by full path.
virtual bool get_file_name(qstring *out, size_t file_index) const =0
Get the on-disk file name for the given file index.
virtual void get_images_names(qstrvec_t *out) const =0
Retrieve the full paths of all images in the cache.
virtual bool get_region_by_ea(region_info_t *ri, ea_t ea, size_t *out_region_index=nullptr, bool full=true) const =0
Find the region containing ea, optionally returning its index.
virtual bool load_image(int image_index, uint32 flags=DLRF_DEFAULT)=0
Load a Mach-O image from the shared cache into the database.
virtual bool get_image_regions(region_info_vec_t *out, int image_index, bool full=true) const =0
Retrieve all regions belonging to an image.
virtual ea_t get_image_address(int image_index) const =0
Return the start address of the image's Mach-O header in the cache.
virtual uint64 get_image_total_size(int image_index) const =0
Return the total size of all regions that compose this image.
virtual void get_regions(region_info_vec_t *vout, const sizevec_t *region_indexes=nullptr, bool full=true) const =0
Retrieve a batch of regions.
virtual int get_images_count() const =0
Return the number of images in the cache.
virtual std::shared_ptr< shared_cache_toplevel_file_t > get_toplevel() const =0
Return the parsed toplevel shared cache file.
virtual bool load_branch_mapping(ea_t ea, uint32 flags=DLRF_DEFAULT)=0
Load a branch mapping (__stubs) region into the database.
virtual bool is_cache_data_loaded(ea_t cache_data_addr) const =0
Check whether a cache-wide data region has been loaded.
virtual size_t get_file_index(const char *file_name) const =0
Look up a file index by name.
virtual size_t get_image_file_index(int image_index) const =0
Return the file index of the cache file that contains the image.
virtual address_info_t locate_address(ea_t ea) const =0
Resolve ea into the cache layout: the region it lives in, the mapping that backs it,...
virtual mapping_coords_t get_image_mapping(int image_index) const =0
Return the mapping coordinates for an image.
virtual bool load_got(ea_t ea, uint32 flags=DLRF_DEFAULT)=0
Load a GOT region into the database.
bool get_image_file_name(qstring *out, const char *image_name) const
Definition dscu.h:618
bool get_image_filename(qstring *out, int image_index) const
Like get_image_name(), but returns only the filename component (everything after the last '/').
Definition dscu.h:586
virtual void update_dyld_slide(adiff_t delta)=0
Apply an additional slide delta and reload the cache.
size_t get_image_file_index(const char *image_name) const
Definition dscu.h:659
uint64 get_image_total_size(const char *image_name) const
Definition dscu.h:653
virtual bool load_regions(const dscu_load_request_t &regions)=0
Load all regions described by the request (images, islands, mappings, GOTs, unknown_regions,...
virtual bool is_mapping_loaded(ea_t mapping_addr) const =0
Check whether a branch mapping has been loaded.
virtual bool is_image_loaded(int image_index) const =0
Check whether an image has been loaded into the database.
virtual bool get_input_file_path(qstring *out) const =0
Retrieve the path to the dyld_shared_cache file on disk.
bool get_image_dependencies(intvec_t *out, const char *image_name, int depth=1) const
Definition dscu.h:642
virtual bool get_image_dependencies(intvec_t *out, int image_index, int depth=1) const =0
Collect transitive dependencies of an image.
virtual bool get_region(region_info_t *ri, size_t region_index, bool full=true) const =0
Retrieve region info by index.
virtual bool get_file_mappings(mapping_coords_vec_t *out, const char *file_name) const =0
Return all mapping coordinates for the given cache file.
bool get_image_regions(region_info_vec_t *out, const char *image_name, bool full=true) const
Definition dscu.h:626
virtual ~dscu_svc_t()
Definition dscu.h:458
virtual bool get_image_file_name(qstring *out, int image_index) const =0
Return the on-disk cache file name that contains the image.
virtual bool is_unknown_region_loaded(ea_t ea) const =0
Check whether an unknown region has been loaded.
virtual bool get_images_dependencies(intvec_t *out, const intvec_t &images_indexes, int depth=1) const =0
Like get_image_dependencies(), but for multiple images at once.
virtual bool get_image_regions_indexes(sizevec_t *out, int image_index) const =0
Retrieve the region indexes (into the global region list) for an image.
virtual bool load_unknown_region(ea_t ea, uint32 flags=DLRF_DEFAULT)=0
Load an unknown region (a covered-but-unidentified range of a mapping) into the database.
bool get_image_regions_indexes(sizevec_t *out, const char *image_name) const
Definition dscu.h:633
virtual bool get_mapping_range(range_t *out, mapping_coords_t mapping) const =0
Return the address range covered by a mapping.
virtual adiff_t get_dyld_slide() const =0
Return the cumulative ASLR slide applied to the cache.
virtual bool load_island(int island_index, uint32 flags=DLRF_DEFAULT)=0
Load a branch island from the shared cache into the database.
virtual int get_load_regions_requests_count() const =0
Return the number of times load_regions() has been invoked successfully.
An "intermediate" partioning of file(s) participating in the DSC.
Definition dscu.h:188
int16 mapping_index
the toplevel/subcache to which mapping_index applies. 0 means toplevel file
Definition dscu.h:190
int16 file_index
Definition dscu.h:189
bool valid() const
Definition dscu.h:202
bool operator!=(const mapping_coords_t &r) const
Definition dscu.h:197
bool operator==(const mapping_coords_t &r) const
the mapping # inside that file
Definition dscu.h:192
static mapping_coords_t make_invalid()
Definition dscu.h:204
Base class for an range.
Definition range.hpp:35
Address ranges that can be loaded into the database.
Definition dscu.h:234
region_type_t type
Size in bytes.
Definition dscu.h:238
int image_index
Definition dscu.h:243
bool operator==(const region_info_t &r) const
Definition dscu.h:261
void swap(region_info_t &r)
region name (e.g., __text). Not unique
Definition dscu.h:250
int branch_island_number
for rt_image
Definition dscu.h:244
range_t get_range() const
Definition dscu.h:259
ea_t start
Definition dscu.h:235
asize_t size
Coordinates in address space.
Definition dscu.h:236
char name[40]
Definition dscu.h:247
bool operator!=(const region_info_t &r) const
Definition dscu.h:269
A string-literal match produced by dscu_svc_t::find_string().
Definition dscu.h:401
ea_t ea
Mapped address; BADADDR for non-image hits.
Definition dscu.h:402
bool operator!=(const string_match_t &r) const
Definition dscu.h:419
uint64 file_offset
Offset within that file (when image_index == -1)
Definition dscu.h:408
bool operator==(const string_match_t &r) const
Definition dscu.h:411
int image_index
Owning image index, or -1 if the hit came from a non-image blob (.symbols, branch mappings,...
Definition dscu.h:403
qstring context
Bytes around the match, for display.
Definition dscu.h:409
size_t file_index
When image_index == -1: the file the hit lives in (see get_file_name()).
Definition dscu.h:406
A symbol match produced by dscu_svc_t::find_symbol() / query_symbols().
Definition dscu.h:384
bool operator==(const symbol_match_t &r) const
Definition dscu.h:389
bool operator!=(const symbol_match_t &r) const
Definition dscu.h:393
int image_index
Owning image index, or -1 if the symbol came from the cache's local symbol table (....
Definition dscu.h:387
std::string_view symbol
Matching symbol name; the view is valid for the lifetime of the dscu_svc_t.
Definition dscu.h:385
ea_t ea
Address of the symbol.
Definition dscu.h:386