@@ -5520,9 +5520,27 @@ namespace BinaryNinja {
55205520 */
55215521 std::vector<ReferenceSource> GetCodeReferences(uint64_t addr, uint64_t len);
55225522
5523+ /*! Get a list of references made from code (instructions) to a virtual address
5524+
5525+ \param addr Address to check
5526+ \param maxItems Optional maximum number of items to fetch
5527+ \return vector of ReferenceSources referencing the virtual address
5528+ */
5529+ std::vector<ReferenceSource> GetCodeReferencesWithLimit(uint64_t addr, std::optional<size_t> maxItems = std::nullopt);
5530+
5531+ /*! Get a list of references from code (instructions) to a range of addresses
5532+
5533+ \param addr Address to check
5534+ \param len Length of query
5535+ \param maxItems Optional maximum number of items to fetch
5536+ \return vector of ReferenceSources referencing the virtual address range
5537+ */
5538+ std::vector<ReferenceSource> GetCodeReferencesInRangeWithLimit(
5539+ uint64_t addr, uint64_t len, std::optional<size_t> maxItems = std::nullopt);
5540+
55235541 /*! Get code references made by a particular "ReferenceSource"
55245542
5525- A ReferenceSource contains a given function, architecture of that function, and an address within it.
5543+ A ReferenceSource contains a given function, architecture of that function, and an address within it.
55265544
55275545 \param src reference source
55285546 \return List of virtual addresses referenced by this source
@@ -5556,6 +5574,24 @@ namespace BinaryNinja {
55565574 */
55575575 std::vector<uint64_t> GetDataReferences(uint64_t addr, uint64_t len);
55585576
5577+ /*! Get references made by data ('DataVariables') to a virtual address
5578+
5579+ \param addr Address to check
5580+ \param maxItems Optional maximum number of items to fetch
5581+ \return vector of virtual addresses referencing the virtual address
5582+ */
5583+ std::vector<uint64_t> GetDataReferencesWithLimit(uint64_t addr, std::optional<size_t> maxItems = std::nullopt);
5584+
5585+ /*! Get references made by data ('DataVariables') in a given range, to a virtual address
5586+
5587+ \param addr Address to check
5588+ \param len Length of query
5589+ \param maxItems Optional maximum number of items to fetch
5590+ \return vector of virtual addresses referencing the virtual address range
5591+ */
5592+ std::vector<uint64_t> GetDataReferencesInRangeWithLimit(
5593+ uint64_t addr, uint64_t len, std::optional<size_t> maxItems = std::nullopt);
5594+
55595595 /*! Get references made by data ('DataVariables') located at a virtual address.
55605596
55615597 \param src reference source
@@ -5605,76 +5641,94 @@ namespace BinaryNinja {
56055641 /*! Get code references to a Type
56065642
56075643 \param type QualifiedName for a Type
5644+ \param maxItems Optional maximum number of items to fetch
56085645 \return vector of ReferenceSources
56095646 */
5610- std::vector<ReferenceSource> GetCodeReferencesForType(const QualifiedName& type);
5647+ std::vector<ReferenceSource> GetCodeReferencesForType(
5648+ const QualifiedName& type, std::optional<size_t> maxItems = std::nullopt);
56115649
56125650 /*! Get data references to a Type
56135651
56145652 \param type QualifiedName for a Type
5653+ \param maxItems Optional maximum number of items to fetch
56155654 \return vector of virtual addresses referencing this Type
56165655 */
5617- std::vector<uint64_t> GetDataReferencesForType(const QualifiedName& type);
5656+ std::vector<uint64_t> GetDataReferencesForType(
5657+ const QualifiedName& type, std::optional<size_t> maxItems = std::nullopt);
56185658
56195659 /*! Get Type references to a Type
56205660
56215661 \param type QualifiedName for a Type
5662+ \param maxItems Optional maximum number of items to fetch
56225663 \return vector of TypeReferenceSources to this Type
56235664 */
5624- std::vector<TypeReferenceSource> GetTypeReferencesForType(const QualifiedName& type);
5665+ std::vector<TypeReferenceSource> GetTypeReferencesForType(
5666+ const QualifiedName& type, std::optional<size_t> maxItems = std::nullopt);
56255667
56265668 /*! Returns a list of references to a specific type field
56275669
5628- \param type QualifiedName of the type
5629- \param offset Offset of the field, relative to the start of the type
5630- \return vector of TypeFieldReferences
5670+ \param type QualifiedName of the type
5671+ \param offset Offset of the field, relative to the start of the type
5672+ \param maxItems Optional maximum number of items to fetch
5673+ \return vector of TypeFieldReferences
56315674 */
5632- std::vector<TypeFieldReference> GetCodeReferencesForTypeField(const QualifiedName& type, uint64_t offset);
5675+ std::vector<TypeFieldReference> GetCodeReferencesForTypeField(
5676+ const QualifiedName& type, uint64_t offset, std::optional<size_t> maxItems = std::nullopt);
56335677
56345678 /*! Returns a list of virtual addresses of data which references the type \c type .
56355679
5636- Note, the returned addresses are the actual start of the queried type field. For example, suppose there is a
5637- DataVariable at \c 0x1000 that has type \c A , and type \c A contains type \c B at offset \c 0x10 .
5638- Then <tt>GetDataReferencesForTypeField(bQualifiedName, 0x8)</tt> will return \c 0x1018 for it.
5680+ Note, the returned addresses are the actual start of the queried type field. For example, suppose there is a
5681+ DataVariable at \c 0x1000 that has type \c A , and type \c A contains type \c B at offset \c 0x10 .
5682+ Then <tt>GetDataReferencesForTypeField(bQualifiedName, 0x8)</tt> will return \c 0x1018 for it.
56395683
5640- \param type QualifiedName of the type
5641- \param offset Offset of the field, relative to the start of the type
5642- \return List of DataVariable start addresses containing references to the type field
5684+ \param type QualifiedName of the type
5685+ \param offset Offset of the field, relative to the start of the type
5686+ \param maxItems Optional maximum number of items to fetch
5687+ \return List of DataVariable start addresses containing references to the type field
56435688 */
5644- std::vector<uint64_t> GetDataReferencesForTypeField(const QualifiedName& type, uint64_t offset);
5689+ std::vector<uint64_t> GetDataReferencesForTypeField(
5690+ const QualifiedName& type, uint64_t offset, std::optional<size_t> maxItems = std::nullopt);
56455691
56465692 /*! Returns a list of virtual addresses of data which are referenced from the type \c type .
56475693
56485694 Only data referenced by structures with the \c __data_var_refs attribute are included.
56495695
56505696 \param type QualifiedName of the type
56515697 \param offset Offset of the field, relative to the start of the type
5698+ \param maxItems Optional maximum number of items to fetch
56525699 \return List of addresses referenced from the type field
56535700 */
5654- std::vector<uint64_t> GetDataReferencesFromForTypeField(const QualifiedName& type, uint64_t offset);
5701+ std::vector<uint64_t> GetDataReferencesFromForTypeField(
5702+ const QualifiedName& type, uint64_t offset, std::optional<size_t> maxItems = std::nullopt);
56555703
56565704 /*! Returns a list of type references to a specific type field
56575705
5658- \param type QualifiedName of the type
5659- \param offset Offset of the field, relative to the start of the type
5660- \return vector of TypeReferenceSources
5706+ \param type QualifiedName of the type
5707+ \param offset Offset of the field, relative to the start of the type
5708+ \param maxItems Optional maximum number of items to fetch
5709+ \return vector of TypeReferenceSources
56615710 */
5662- std::vector<TypeReferenceSource> GetTypeReferencesForTypeField(const QualifiedName& type, uint64_t offset);
5711+ std::vector<TypeReferenceSource> GetTypeReferencesForTypeField(
5712+ const QualifiedName& type, uint64_t offset, std::optional<size_t> maxItems = std::nullopt);
56635713
56645714 /*! Returns a all references to a specific type. This includes code, data, and type references.
56655715
56665716 \param type QualifiedName of the type
5717+ \param maxItems Optional maximum number of items to fetch
56675718 \return AllTypeReferences structure with all references
56685719 */
5669- AllTypeReferences GetAllReferencesForType(const QualifiedName& type);
5720+ AllTypeReferences GetAllReferencesForType(
5721+ const QualifiedName& type, std::optional<size_t> maxItems = std::nullopt);
56705722
56715723 /*! Returns a all references to a specific type field. This includes code, data, and type references.
56725724
56735725 \param type QualifiedName of the type
56745726 \param offset Offset of the field, relative to the start of the type
5727+ \param maxItems Optional maximum number of items to fetch
56755728 \return AllTypeFieldReferences structure with all references
56765729 */
5677- AllTypeFieldReferences GetAllReferencesForTypeField(const QualifiedName& type, uint64_t offset);
5730+ AllTypeFieldReferences GetAllReferencesForTypeField(
5731+ const QualifiedName& type, uint64_t offset, std::optional<size_t> maxItems = std::nullopt);
56785732
56795733 /*! Returns a list of types referenced by code at ReferenceSource \c src
56805734
0 commit comments