Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
326 commits
Select commit Hold shift + click to select a range
6a76613
Leaks
Rot127 Dec 8, 2025
d7ffb69
Fix SEQ
Rot127 Dec 8, 2025
a6eaca4
Add warnings
Rot127 Dec 8, 2025
0ee1104
Signal interpreter that the lifting failed.
Rot127 Dec 8, 2025
6d7ad9a
Set entry point in PC
Rot127 Dec 8, 2025
6078d6b
Remove state cleanup for now. Currently one exists anyways
Rot127 Dec 8, 2025
29bc789
Fix argument order
Rot127 Dec 8, 2025
810616e
Init bitvector for globals.
Rot127 Dec 9, 2025
5680954
Add assert
Rot127 Dec 9, 2025
2254eb4
Fix truthy check function
Rot127 Dec 9, 2025
64f28ce
Fix BRANCH
Rot127 Dec 9, 2025
506b340
Read with rz_io_read_at_mapped() because it can read over map boundar…
Rot127 Dec 9, 2025
2bf9f1f
Enhance logs
Rot127 Dec 9, 2025
d17eae0
Map not lifted instructions to NOP
Rot127 Dec 9, 2025
045845c
Spelling
Rot127 Dec 9, 2025
af12754
Fix NOP
Rot127 Dec 9, 2025
8cbb98a
Fix arguemnt order
Rot127 Dec 9, 2025
bc8e4a5
Fix termination condition in interpreter
Rot127 Dec 9, 2025
154cb72
Remove state cache for simplicity
Rot127 Dec 9, 2025
0bfea28
Fix NOP
Rot127 Dec 9, 2025
a16b958
Fix leaks in NOP
Rot127 Dec 9, 2025
6a6e896
Read IO loads into stack buffer not heap ones.
Rot127 Dec 9, 2025
77e77f6
Fix return values and show more errors.
Rot127 Dec 9, 2025
0c8d6b5
Make all globals concrete by default to reach more states.
Rot127 Dec 9, 2025
b4ae7df
Improve hash function a little.
Rot127 Dec 9, 2025
a1758cd
Report xrefs of LOAD/STORE/JMP.
Rot127 Dec 10, 2025
7d6ba5a
Move different roles the inquiry function plays into threads.
Rot127 Dec 10, 2025
f0939a4
Add xrefs to RzAnalysis
Rot127 Dec 11, 2025
cfd4e62
Make analysis abortable with ctrl+c and don't allocate xrefs shared o…
Rot127 Dec 13, 2025
604ac42
Logs and docs
Rot127 Dec 13, 2025
e07f057
Set PC on new effect selection
Rot127 Dec 13, 2025
cf75fd0
Fix storing of memory.
Rot127 Dec 13, 2025
143884e
Abort on failed memory read.
Rot127 Dec 13, 2025
b28fe21
Log failed reads in more detail.
Rot127 Dec 13, 2025
8b8c4da
Fix incorrect handling of PC increment of effects without jumps.
Rot127 Dec 13, 2025
e3d2298
Always assume the read succeeded.
Rot127 Dec 15, 2025
9f6ded0
Terminate interpreter if it couldn't find successors.
Rot127 Dec 15, 2025
e529a10
Warn if PC is set to an abstract value
Rot127 Dec 15, 2025
d271fb3
Print packet address of instruction with too few ops.
Rot127 Dec 15, 2025
751dc55
Move and log set pc actions
Rot127 Dec 15, 2025
1386de8
Fix MSB/LSB/IS_ZERO
Rot127 Dec 15, 2025
f1a546b
Init PC as concrete values
Rot127 Dec 15, 2025
e899e44
Implement MUL
Rot127 Dec 15, 2025
530c7c3
Hexagon: Allow to set instruction packet size in RzAnalysisOp
Rot127 Dec 15, 2025
a82f6a9
Refactor to make IL basic block a vector of instruction packets.
Rot127 Dec 15, 2025
53bbd23
Use printf for debug printing to make it usable with grep
Rot127 Dec 15, 2025
9e28684
Keep the IL config in the state
Rot127 Dec 16, 2025
30b1760
Fix detection of basic block boundaries
Rot127 Dec 16, 2025
d67807d
Check if set PC is concrete
Rot127 Dec 16, 2025
95e77fc
Use RZ_LOG_DEBUG instead of printf
Rot127 Dec 16, 2025
0eb27d4
Add xref test
Rot127 Dec 16, 2025
2965879
Use latest queue modernizations.
Rot127 Dec 17, 2025
1b539c6
Update test with return xrefs from functions.
Rot127 Dec 17, 2025
636817e
Use rz_io_nread_at() to allow reading at map boundaries without failure.
Rot127 Dec 17, 2025
7de3a57
Rename rzil_analysis -> inquiry
Rot127 Dec 17, 2025
9aa228f
Add work-around for Hexagon, so 'next packet' jumps are not reported …
Rot127 Dec 17, 2025
2c14513
Revert to only blocking variant of queue_pop
Rot127 Dec 18, 2025
1aac8ad
Fix another edge case of Hexagon IL lifting.
Rot127 Dec 18, 2025
03a3987
Several fixes for interpretation.
Rot127 Dec 18, 2025
71e80dd
Terminate interpretation at obviously wrong address.
Rot127 Dec 19, 2025
25224ff
Add a il memory load function which reads into a given output bit vec…
Rot127 Dec 20, 2025
49d8ead
Refactor to use RzILMem for IO and RzAnalysisILVM for setup.
Rot127 Dec 20, 2025
f5d1bd9
Init state with default values.
Rot127 Jan 6, 2026
09963bc
Implement DIV and MOD
Rot127 Jan 6, 2026
cef43b0
Fix Sparc BB generation
Rot127 Jan 7, 2026
668ecc1
Map not concrete shift results to bottom.
Rot127 Jan 7, 2026
cf44494
Add callback to print current state.
Rot127 Jan 9, 2026
0bacfed
Add test for Sparc indirect call discovery.
Rot127 Jan 12, 2026
e8cb7ce
Fix build for less smart CI build chains.
Rot127 Jan 12, 2026
e7f9230
Move entry-points init to command handler
Rot127 Jan 12, 2026
2091580
Move io.cache toggle to before iset for loop preparation.
Rot127 Jan 12, 2026
55fbe27
Add two more reference types.
Rot127 Jan 12, 2026
d2b6a34
Start implementing BB tracking.
Rot127 Jan 12, 2026
4f3b73e
Move all the queue init code into a static function.
Rot127 Jan 14, 2026
1b75a49
Second part implementing BB and coverage tracking.
Rot127 Jan 14, 2026
e7b8b9c
Continue interpretation after an invalid basic block
Rot127 Jan 15, 2026
61d4f1e
Scan sections for next targets.
Rot127 Jan 15, 2026
a407e23
Change order of arguments after rebase
Rot127 Jan 16, 2026
c016fcb
Fix queue open
Rot127 Jan 16, 2026
3971157
Bug fixes
Rot127 Jan 16, 2026
42cd88f
More bugs fixes
Rot127 Jan 16, 2026
884e732
Move 'choose successor' logic into own function.
Rot127 Jan 18, 2026
3d3f5a8
RzBinSymbol: Add role attribute to the layout.
Rot127 Jan 19, 2026
0c89e22
Allow to declare address intervals which should never be executed.
Rot127 Jan 20, 2026
951e770
Actualy Cache IL ops
Rot127 Jan 20, 2026
4ffa956
Move ownership of sent queue objects to RzInquiry.
Rot127 Jan 21, 2026
5765069
Track invocation of BBs and quit if they were executed more than 3 ti…
Rot127 Jan 21, 2026
fb88e59
Print some status update.
Rot127 Jan 23, 2026
46fa97c
Add NULL check to not fail with -n flag
Rot127 Jan 23, 2026
4fc7749
Basic start for new yield types for function detection
Rot127 Jan 25, 2026
41938fd
Fix test
Rot127 Jan 27, 2026
4fb546c
CLean up code
Rot127 Jan 27, 2026
2073d1c
Report yields: PC store and possible return points.
Rot127 Jan 27, 2026
9dc47ce
Move yield handling into own function.
Rot127 Jan 27, 2026
34df093
Move the whole plugin setupt into rz_inquiry_new() and free()
Rot127 Jan 27, 2026
7845ec6
Rewrite the whole call candidate detection.
Rot127 Jan 29, 2026
6cdb5b3
Some clean ups
Rot127 Feb 3, 2026
86a1c16
Add basic block CFG as wrapper around RzGraph.
Rot127 Feb 5, 2026
2ff723e
Unfinished function detection algorithm.
Rot127 Feb 5, 2026
e1f8fb1
Finish function detection.
Rot127 Feb 7, 2026
55b8b31
Perform function detection in aaaaIp
Rot127 Feb 7, 2026
7ea8d7f
Renames, sharing settting og bb_cfg edge and more
Rot127 Feb 8, 2026
d3d60e2
Fix incorrect bb edges
Rot127 Feb 9, 2026
319566d
Enable formatted inquiry function printing.
Rot127 Feb 9, 2026
6c49b39
Fix bb assignment to functions
Rot127 Feb 9, 2026
ddd86fa
Fix adding of basic blocks following calls
Rot127 Feb 9, 2026
bf3ab44
Move function detection into own function
Rot127 Feb 9, 2026
0083650
Remove the whole tail call logic for simplicity.
Rot127 Feb 10, 2026
7a40cef
Move il_bb lifting into own function.
Rot127 Feb 10, 2026
2d6ce30
Add entry point always as cfep
Rot127 Feb 10, 2026
838dd4d
Add edges to analysis basic blocks
Rot127 Feb 10, 2026
de667d3
Fix iq_fcn name
Rot127 Feb 10, 2026
8bde73d
Extend initial set of addresses to interpret.
Rot127 Feb 10, 2026
e935cc6
Add edges between calls and their (guessed) return point.
Rot127 Feb 12, 2026
ef910f2
Don't add duplicate edges to the bb cfg.
Rot127 Feb 12, 2026
b778240
Log more warnings
Rot127 Feb 12, 2026
916a81a
Fix possible endless loop if interpreter fails early.
Rot127 Feb 12, 2026
9c1671f
Don't overwrite existing symbol names.
Rot127 Feb 12, 2026
e421abe
Rename call targets -> branch targets
Rot127 Feb 12, 2026
f0b48d1
Fix function naming of existing symbols
Rot127 Feb 14, 2026
3e6aad3
Update tests with latest results.
Rot127 Feb 14, 2026
2775934
Add ARM test
Rot127 Feb 14, 2026
5d6205c
Add broken test for Mips.
Rot127 Feb 14, 2026
c4d8025
Add overview of basic function detection algo
Rot127 Feb 14, 2026
8c92dcd
Also add op.fail to branch targets
Rot127 Feb 21, 2026
b943617
clang-format
Rot127 Feb 21, 2026
482e85d
Add statically known to the bb_cfg
Rot127 Feb 22, 2026
2ed5c17
Some code clean up and separation
Rot127 Feb 23, 2026
d90669c
Remove duplicate basic blocks and ensure each of them has exactly one…
Rot127 Feb 23, 2026
921f677
Demode super common logged errors
Rot127 Feb 23, 2026
ee67365
Don't add call return points to branch target list.
Rot127 Feb 23, 2026
5ea9cba
Fix tests with latest changes
Rot127 Feb 23, 2026
e1cd62c
Update docs and logs
Rot127 Feb 23, 2026
c40ea23
Speed up post processing of bb cfg
Rot127 Feb 25, 2026
29d3616
Fix random exits due to unset signal flag.
Rot127 Feb 25, 2026
430f253
Fix call candidate detection by resetting candidate info each bb
Rot127 Feb 25, 2026
1270319
Fix wrong logic error
Rot127 Feb 25, 2026
07b0a22
Speed up the whole bb_cfg complementation somewhat.
Rot127 Feb 25, 2026
a7a12ec
Add now also the addresses after calls to the branch target list.
Rot127 Feb 25, 2026
6f02ca5
Add non-exectuable maps to ignore list.
Rot127 Feb 25, 2026
6a48272
Fix jumps to unmapped symbols
Rot127 Feb 25, 2026
0a86505
Add test case to cover latest function detection fixes.
Rot127 Feb 25, 2026
787f1f9
Fix user send siganls
Rot127 Feb 25, 2026
ed86c67
Better logging.
Rot127 Feb 25, 2026
850ba6d
Add all function symbol addresses to the branch targets.
Rot127 Mar 7, 2026
03d7d56
Fix bug of too many function detections.
Rot127 Mar 11, 2026
725432b
Get rid of wrong assumptions that branch targets must be aligned.
Rot127 Mar 11, 2026
4e3fd65
Remove unnecessary logging
Rot127 Mar 18, 2026
5eb4bad
Move validation of IL ops code into function and deactivate it.
Rot127 Mar 18, 2026
47c1e36
Don't add jumps to invalid addresses to functions.
Rot127 Mar 18, 2026
de7f53e
Move warnings where they occur.
Rot127 Mar 19, 2026
23dfd99
Don't hard fail on errors in the function detection.
Rot127 Mar 19, 2026
944348c
Fix leaks
Rot127 Mar 21, 2026
6367616
Push the same object over the queue to prepare for multi-threaded int…
Rot127 Mar 21, 2026
3174049
Fix invalid addition of size
Rot127 Mar 26, 2026
431fcef
Move the queue initialization into the rz_interpreter_set_new()
Rot127 Mar 26, 2026
42828db
Reduce number of arguments passed.
Rot127 Mar 28, 2026
d3f50fb
Revert "Push the same object over the queue to prepare for multi-thre…
Rot127 Mar 28, 2026
27d06ac
Add incomplete refactor to ring buffers.
Rot127 Mar 29, 2026
18261ab
Move initialization code into own function.
Rot127 Mar 30, 2026
9cd6dfe
Refactor to single running interpreter, instead of spawning mutliple …
Rot127 Mar 30, 2026
a1991e4
Rename state to astate (for abstract).
Rot127 Apr 1, 2026
7e76dea
Add state flag for the interpreter skeleton.
Rot127 Apr 1, 2026
ef58f63
Unfinished refactor to properly defined states of the interpreter.
Rot127 Apr 1, 2026
3a8eb1f
Finish refactor to run-state based interpreters.
Rot127 Apr 2, 2026
17998bb
Reset abstract state instead of freeing and allocating it.
Rot127 Apr 2, 2026
9b20668
Added wrong file.
Rot127 Apr 3, 2026
baacb5d
Add unsafe function to check for state.
Rot127 Apr 3, 2026
6e7e3c8
Convert yield_rbufs to an array to safe HT lookup time.
Rot127 Apr 3, 2026
60c770e
Limit number of checks on rz_cons_breaked.
Rot127 Apr 3, 2026
853094d
Fix rebase issues
Rot127 Apr 7, 2026
01a86d2
Improve performance by casting before setting.
Rot127 Apr 7, 2026
fe5c74b
Speed up rz_bv_set_from functions.
Rot127 Apr 7, 2026
6415514
Add multiple threads
Rot127 Apr 7, 2026
52afd12
Remove one hash table lookup.
Rot127 Apr 7, 2026
5a3d113
Refactor to new graph.
Rot127 Apr 13, 2026
55f57ee
Remove outdated comments
Rot127 Apr 13, 2026
0688712
Don't add nodes of length 1 if an edge points to it.
Rot127 Apr 13, 2026
0cf1c83
Fix incorrect types
Rot127 Apr 14, 2026
b9a2f5e
Rename getter for neighboring nodes for clarity
Rot127 Apr 15, 2026
2278ebb
Add missing negation from refactor
Rot127 Apr 15, 2026
b870f72
Use list based graph.
Rot127 Apr 17, 2026
8eab955
Start refactor to CFGs with edge types.
Rot127 Apr 20, 2026
aed94e8
Refactor Inquiry graph stuff (sorry forgot what exactly, I only rebas…
Rot127 May 30, 2026
410056e
For each requested branch, add control flow edges.
Rot127 Apr 22, 2026
eedad8e
Fix conversion of RzInquiry to RzAnalysis xrefs
Rot127 Apr 22, 2026
680618c
Add API to get dotgraph of cfg.
Rot127 Apr 22, 2026
37143f5
Let the Interpreter fill out the whole branch object for request. Not…
Rot127 Apr 27, 2026
c96b266
IL Cache implementation.
Rot127 Apr 29, 2026
057aeda
Fix NULL derefence
Rot127 May 6, 2026
d073630
Fix filter of xrefs to check for permissions.
Rot127 May 7, 2026
7011143
Rename
Rot127 May 7, 2026
cb93ea8
Stop cache early
Rot127 May 7, 2026
2d7ae36
Speedup reduce function
Rot127 May 7, 2026
53adada
Clean up reduce function for bb cfgs.
Rot127 May 11, 2026
c2c57f6
Rename BB to block, since they are no BBs.
Rot127 May 11, 2026
1c45499
Add prefixes to log messages.
Rot127 May 11, 2026
ab107ba
Rename Basic Block CFG -> Block CFG, Interpreter -> Interp, add -f co…
Rot127 May 29, 2026
7cf28e8
Add missing NULL check
Rot127 May 29, 2026
38cded7
Reduce log level for common error cases.
Rot127 May 29, 2026
3a9feed
Fix tests
Rot127 May 29, 2026
2b591b5
Remvoe unused file
Rot127 May 29, 2026
ae1f1fd
Add new headers to install
Rot127 May 29, 2026
28e8654
Rename branch_targets -> control flow targets
Rot127 May 29, 2026
7aceba8
Disassemble instructions for each BB added to RzAnalysis
Rot127 May 30, 2026
bcaa38a
Reduce BV_STACK_MAX_SIZE to avoid stack overflows
thestr4ng3r Jun 1, 2026
8352455
Fix some nomenclature
thestr4ng3r Jun 1, 2026
2f644ed
Fix underflow
Rot127 Jun 13, 2026
263b617
Fix comparison of ut64 (compared ptrs.
Rot127 Jun 13, 2026
1ee3569
Remove duplicate fini() call
Rot127 Jun 13, 2026
bae6954
Fix NULL check
Rot127 Jun 13, 2026
bafa0b0
Update change_cf flag if instruction si unlifted.
Rot127 Jun 13, 2026
44c2caf
Fix leaks
Rot127 Jun 13, 2026
419673d
Fix tests
Rot127 Jun 13, 2026
70e2355
Reformat
thestr4ng3r Jun 15, 2026
08c9c02
Add clone and join operations
thestr4ng3r Jun 15, 2026
3094dd2
Abstract interpretation with fixpoint iteration
thestr4ng3r Jun 15, 2026
09375f5
Add comments for block entry/exit
thestr4ng3r Jun 23, 2026
dba7fcc
Fix handling calls
thestr4ng3r Jun 23, 2026
b00c127
Unify all interpreter abbrevs to interp
thestr4ng3r Jun 25, 2026
eeb8ddc
Simplify IL cache requests
thestr4ng3r Jun 27, 2026
8ff9347
Adapt to RzAnalysisILContext
thestr4ng3r Jun 28, 2026
13ac3a1
Remove io writes from interpreter
thestr4ng3r Jun 29, 2026
831a734
Split RzInterpSet into RzInterpInstance and RzInterpRunContext
thestr4ng3r Jun 30, 2026
c1b10e9
Remove now unused RzInterpPlugin members
thestr4ng3r Jun 30, 2026
89df2d6
Merge some files and prepare for finer value abstraction
thestr4ng3r Jun 30, 2026
b272106
Remove some features before reafactoring
thestr4ng3r Jun 30, 2026
244d519
Move plugin data out of plugin
thestr4ng3r Jun 30, 2026
2961bfd
Move effect evaluation out of plugin and leave pure
thestr4ng3r Jul 1, 2026
ff5053c
Make interp plugin only handle actual abstract value evaluation
thestr4ng3r Jul 3, 2026
bb0f4bf
Minor interp loop refactor
thestr4ng3r Jul 3, 2026
1588d67
Adjust to RzIL refinements
thestr4ng3r Jul 6, 2026
c0f067e
Move non-state out of abstract state and other minor changes
thestr4ng3r Jul 8, 2026
8938b7b
Introduce RzInterpBlock
thestr4ng3r Jul 8, 2026
3f4423c
Reorder interpreter.c
thestr4ng3r Jul 8, 2026
d1a5e07
Store blocks in rbtree
thestr4ng3r Jul 9, 2026
acdbd27
Apply interpreter blocks to analysis
thestr4ng3r Jul 10, 2026
3bb65cd
Merge consecutive blocks if possible
thestr4ng3r Jul 11, 2026
1a7516f
Begin testing of cfg results
thestr4ng3r Jul 11, 2026
abf2a56
Split blocks
thestr4ng3r Jul 12, 2026
7de8893
Simplify interp_block_with_op_at_cmp
thestr4ng3r Jul 13, 2026
8da0073
Reset data after calls and test
thestr4ng3r Jul 13, 2026
79c414a
Add xrefs to result
thestr4ng3r Jul 14, 2026
b602d53
Fix xrefs from addr
thestr4ng3r Jul 15, 2026
1a618dc
Fix runaway block mutations
thestr4ng3r Jul 15, 2026
0f0a2de
Add result dimensions and move comments out
thestr4ng3r Jul 16, 2026
4027dc1
wip commands
thestr4ng3r Jul 16, 2026
94dbb39
Isolate interpreter driver and restructure commands
thestr4ng3r Jul 17, 2026
937905d
Remove now-unused code from interpreter
thestr4ng3r Jul 17, 2026
f36b114
Begin moving ipc to driver
thestr4ng3r Jul 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ RzSocket:
- any-glob-to-any-file:
- librz/socket/**/*

RzInquiry:
- changed-files:
- any-glob-to-any-file:
- librz/inquiry/**/*

RzSyscall:
- changed-files:
- any-glob-to-any-file:
Expand Down
261 changes: 261 additions & 0 deletions doc/abstract_interpreter/state_diagrams.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions librz/arch/analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,77 @@ RZ_API bool rz_analysis_op_is_call(RZ_NONNULL const RzAnalysisOp *op) {
return false;
}

/**
* \brief Checks if \p op changes the control flow.
* It checks op->type, op->eob for it. So any jump, call, trap, or illegal
* instruction.
* It also returns true for conditional instructions.
*
* \return True if \p op changes the control flow. False otherwise.
*/
RZ_API bool rz_analysis_op_changes_control_flow(RZ_NONNULL const RzAnalysisOp *op) {
rz_return_val_if_fail(op, false);
switch (op->type & RZ_ANALYSIS_OP_TYPE_MASK) {
case RZ_ANALYSIS_OP_TYPE_JMP:
case RZ_ANALYSIS_OP_TYPE_UJMP:
case RZ_ANALYSIS_OP_TYPE_RJMP:
case RZ_ANALYSIS_OP_TYPE_IJMP:
case RZ_ANALYSIS_OP_TYPE_IRJMP:
case RZ_ANALYSIS_OP_TYPE_CJMP:
case RZ_ANALYSIS_OP_TYPE_RCJMP:
case RZ_ANALYSIS_OP_TYPE_MJMP:
case RZ_ANALYSIS_OP_TYPE_MCJMP:
case RZ_ANALYSIS_OP_TYPE_UCJMP:
case RZ_ANALYSIS_OP_TYPE_CALL:
case RZ_ANALYSIS_OP_TYPE_UCALL:
case RZ_ANALYSIS_OP_TYPE_RCALL:
case RZ_ANALYSIS_OP_TYPE_ICALL:
case RZ_ANALYSIS_OP_TYPE_IRCALL:
case RZ_ANALYSIS_OP_TYPE_CCALL:
case RZ_ANALYSIS_OP_TYPE_UCCALL:
case RZ_ANALYSIS_OP_TYPE_RET:
case RZ_ANALYSIS_OP_TYPE_CRET:
case RZ_ANALYSIS_OP_TYPE_ILL:
case RZ_ANALYSIS_OP_TYPE_UNK:
case RZ_ANALYSIS_OP_TYPE_TRAP:
case RZ_ANALYSIS_OP_TYPE_SWI:
case RZ_ANALYSIS_OP_TYPE_CSWI:
case RZ_ANALYSIS_OP_TYPE_LEAVE:
case RZ_ANALYSIS_OP_TYPE_SWITCH:
return true;
default:
return false;
}
}

/**
* \brief Returns true if the \p op is a direct call.
*/
RZ_API bool rz_analysis_op_is_direct_call(RZ_NONNULL const RzAnalysisOp *op) {
rz_return_val_if_fail(op, false);
switch (op->type & RZ_ANALYSIS_OP_TYPE_MASK) {
case RZ_ANALYSIS_OP_TYPE_CALL:
case RZ_ANALYSIS_OP_TYPE_CCALL:
return true;
default:
return false;
}
}

/**
* \brief Returns true if the \p op is a direct call.
*/
RZ_API bool rz_analysis_op_is_direct_jump(RZ_NONNULL const RzAnalysisOp *op) {
rz_return_val_if_fail(op, false);
switch (op->type & RZ_ANALYSIS_OP_TYPE_MASK) {
case RZ_ANALYSIS_OP_TYPE_JMP:
case RZ_ANALYSIS_OP_TYPE_CJMP:
return true;
default:
return false;
}
}

RZ_API void rz_analysis_purge(RzAnalysis *analysis) {
rz_analysis_hint_clear(analysis);
rz_interval_tree_fini(&analysis->meta);
Expand Down
24 changes: 24 additions & 0 deletions librz/arch/fcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,30 @@ RZ_API RzAnalysisFunction *rz_analysis_get_function_byname(RzAnalysis *a, const
return NULL;
}

/**
* \brief Adds a basic block to the RzAnalysis.
* It disassembles it to determine the instructions and their offset.
*/
RZ_API bool rz_analysis_add_bb(RzAnalysis *a, ut64 addr, ut64 size) {
rz_return_val_if_fail(a && size > 0, false);
if (size > a->opt.bb_max_size) {
RZ_LOG_ERROR("Cannot allocate such big bb of %" PFMT64d " bytes at 0x%08" PFMT64x "\n", (st64)size, addr);
rz_warn_if_reached();
return false;
}
RzAnalysisBlock *block = rz_analysis_get_block_at(a, addr);
if (block) {
rz_analysis_delete_block(block);
}

block = rz_analysis_create_block(a, addr, size);
if (!block) {
return false;
}
rz_analysis_block_analyze_ops(block);
return true;
}

/* rename RzAnalysisFunctionBB.add() */
RZ_API bool rz_analysis_fcn_add_bb(RzAnalysis *a, RzAnalysisFunction *fcn, ut64 addr, ut64 size, ut64 jump, ut64 fail) {
if (size == 0) {
Expand Down
2 changes: 1 addition & 1 deletion librz/arch/isa/hexagon/hexagon_il.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static RZ_OWN RzILOpEffect *hex_pkt_to_il_seq(HexPkt *pkt) {
rz_pvector_clear(pkt->il_ops);
// We need at least the instruction op and the packet commit.
// So if there aren't at least two ops something went wrong.
RZ_LOG_WARN("Invalid il ops sequence! There should be at least two il ops per packet.\n");
RZ_LOG_WARN("Invalid il ops sequence! There should be at least two il ops per packet. pkt_addr = 0x%" PFMT32x "\n", pkt->pkt_addr);
return NULL;
}
RzILOpEffect *complete_seq = EMPTY();
Expand Down
Loading
Loading