Skip to content

Update disassembly and analysis plugin implementation files - #165

Open
Jagath-P wants to merge 4 commits into
rizinorg:masterfrom
Jagath-P:disassembly_update
Open

Jagath-P wants to merge 4 commits into
rizinorg:masterfrom
Jagath-P:disassembly_update

Conversation

@Jagath-P

@Jagath-P Jagath-P commented Apr 13, 2026 •

Copy link
Copy Markdown

Your checklist for this pull request

  • I've used AI tools to generate these changes, fully or partially.
  • I've manually tested all commands and examples in these changes.

Comment on lines -33 to -58
**Makefile**

```makefile
NAME=analysis_mycpu
RZ_PLUGIN_PATH=$(shell rizin -H RZ_USER_PLUGINS)
LIBEXT=$(shell rizin -H LIBEXT)
CFLAGS=-g -fPIC $(shell pkg-config --cflags rz_analysis)
LDFLAGS=-shared $(shell pkg-config --libs rz_analysis)
OBJS=$(NAME).o
LIB=$(NAME).$(LIBEXT)

all: $(LIB)

clean:
rm -f $(LIB) $(OBJS)

$(LIB): $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(LIB)

install:
cp -f analysis_mycpu.$(SO_EXT) $(RZ_PLUGIN_PATH)

uninstall:
rm -f $(RZ_PLUGIN_PATH)/analysis_mycpu.$(SO_EXT)
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs a meson equivalent.

Comment thread src/plugins/dev-analysis.md Resolved
Comment thread src/plugins/dev-asm.md Resolved
@Jagath-P
Jagath-P requested review from notxvilka and wargio May 11, 2026 14:39
@Jagath-P

Jagath-P commented Jun 16, 2026 •

Copy link
Copy Markdown
Author

@wargio @notxvilka @Rot127 can any of you review this again pls

Comment thread src/plugins/dev-analysis.md Outdated
#endif
```

After creating this plugin, include this plugin file in corresponding `librz/arch/p/arch_mycpu.c`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"After creating the plugin include this file..."

Comment thread src/plugins/dev-analysis.md Outdated
two modules - RzAsm and RzAnalysis. Thus, we need to write an analysis plugin too.
The principle is very similar - you just need to create a C file and
corresponding Makefile.
The principle is very similar - you just need to create a C file in `librz/arch/p/analysis/` and declare it in corresponding architecture plugin file `librz/arch/p/arch_mycpu.c`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and add in Meson)

@Rot127 Rot127 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good additions!

Comment thread src/plugins/dev-asm.md
Rizin has modular architecture, thus adding support for a new architecture is very easy, if you
are fluent in C. For various reasons it might be easier to implement it out of the tree. For this we
will need to create single C file, called `asm_mycpu.c` and a meson file for it.
will need two C files mainly, called `asm_mycpu.c` in `librz/arch/p/asm/` , `arch_mycpu.c` in `librz/arch/p/` and declare the asm plugin in architecture plugin file .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing file name and path of the architecture file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file name and path is mentioned here right? did you mean anything else?

Comment thread src/plugins/dev-asm.md Outdated
That's where most of our code will be, the key part is to declare a `RzAsmPlugin` containing a valid `disassemble`
field, a function pointer to the actual disassembler function.
- `librz/arch/p/asm_mycpu.c`
That's where most of our code will be, the key part is to declare a `RzAsmPlugin` containing a valid `disassemble`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's where most of our code will be,

Nah, the bunch of code should be in librz/arch/isa/mycpu/ please

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants