mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
feat(ghidra): add function analysis and conformance
This commit is contained in:
1 parent
a45de27d9e
commit
d8321defd7
131 files changed
+4224
-301
No files matched your search
@@ -83,6 +83,49 @@ export const referenceProjection = (snapshot: FunctionSnapshot) =>
|
||||
})),
|
||||
]);
|
||||
|
||||
export const referenceKindProjection = (
|
||||
snapshot: FunctionSnapshot,
|
||||
): readonly unknown[] | null => {
|
||||
const edges = [
|
||||
...snapshot.collections.incoming_references.items.map((edge) => ({
|
||||
direction: "in",
|
||||
edge,
|
||||
})),
|
||||
...snapshot.collections.outgoing_references.items.map((edge) => ({
|
||||
direction: "out",
|
||||
edge,
|
||||
})),
|
||||
];
|
||||
if (edges.some(({ edge }) => !edge.kind.available)) return null;
|
||||
return sorted(
|
||||
edges.map(({ direction, edge }) => {
|
||||
if (!edge.kind.available)
|
||||
throw new TypeError(
|
||||
"Reference-kind availability changed during projection",
|
||||
);
|
||||
return {
|
||||
direction,
|
||||
source: edge.source_procedure?.name ?? null,
|
||||
target: edge.target_procedure?.name ?? null,
|
||||
type: edge.kind.type,
|
||||
flow: edge.kind.flow,
|
||||
call: edge.kind.call,
|
||||
jump: edge.kind.jump,
|
||||
data: edge.kind.data,
|
||||
read: edge.kind.read,
|
||||
write: edge.kind.write,
|
||||
indirect: edge.kind.indirect,
|
||||
computed: edge.kind.computed,
|
||||
conditional: edge.kind.conditional,
|
||||
terminal: edge.kind.terminal,
|
||||
primary: edge.kind.primary,
|
||||
operand_index: edge.kind.operand_index,
|
||||
external: edge.kind.external,
|
||||
};
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
export const commentProjection = (
|
||||
snapshot: FunctionSnapshot,
|
||||
): readonly unknown[] | null => {
|
||||
|
||||
Reference in new issue
Block a user