GithubHelp home page GithubHelp logo

Comments (1)

commial avatar commial commented on August 15, 2024

In Miasm2, the delay-slot is handled during the creation of IR Blocks, by separating the update of the IRDst variable and its use. This variable indicates where is the next block to execute (in contrary of PC, which can't have labelled values like generated labels).

For instance, if I asm the mips32.S sample:

python asm/shellcode.py mips32b samples/mips32.S babar.bin

And then I gen the associated IR:

python -i disasm/full.py mips32b babar.bin 0

The block named loc_0000000000000008:0x00000008 has the following list of affectation block

A1 = (A1+0x1)

PC = ((A0+(- ZERO))?loc_0000000000000008:0x00000008,loc_0000000000000014:0x00000014))
IRDst = ((A0+(- ZERO))?loc_0000000000000008:0x00000008,loc_0000000000000014:0x00000014))

A0 = (A0+0xFFFFFFFF)

We can observe the block relative to offset 0x10 does not set IRDst, which is evaluated in the context of the offset 0xC.

Now, the way the step work in the debugging feature is implemented in miasm2/analysis/debugging.py, method step:

# Force the jit of one line, and remove the old one
self.myjit.jit.set_options(jit_maxline=1)
self.myjit.jit.updt_automod_code(self.myjit.vm, self.myjit.pc, 8)

# Launch the run (just one line will be jitted and execute)
res = self.myjit.continue_run(step=True)
# Handle the result (exceptions, breakpoints, ...)
self.handle_exception(res)

...

So, currently, lines are considered separately. That's why in run mode, the debugging will work with delay slot, and in the step mode it will not.

I'll get back to you if I found a clean way to handle delay-slot in this case.
Hope I've help you to understand the code you've nightly watched.

from miasm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.