Closed Bug 1071604 Opened 10 years ago Closed 10 years ago

Make the ARM simulator's embedded REPL easily available

Categories

(Core :: JavaScript Engine: JIT, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: lth, Assigned: lth)

Details

Attachments

(1 file)

The REPL is pretty nice, and serves as a lightweight disassembler and debugger (single stepping, register printing, memory dumping), if you have LLVM available and GDB is not a great option.  (Both tend to be true on Mac these days.)

The main problem is that the LLVM tools have inconstant names.  What the REPL wants to call llvm-mc ("LLVM machine code playground"), which it uses for disassembly, is known as llvm-mc-mp-3.5 on my system.

The simple fix to that is to keep the name llvm-mc and just require there to be a symlink locally.

Anyway, with this patch one triggers the REPL from generated code by calling the "simulatorStop()" method on the MacroAssembler, when the REPL is entered it prints this, for example ("compareExchange" is a message I passed):

Simulator hit compareExchange
0x27f64b4	add	lr, r11, r3

and then there's a number of interactive commands, eg disassembly:

sim> di 
0x27f64b4	add	lr, r11, r3
0x27f64b8	add	lr, lr, #0
0x27f64bc	ldrex	r0, [lr]
0x27f64c0	cmp	r0, r1
0x27f64c4	bne	#8
0x27f64c8	strex	r12, r2, [lr]
0x27f64cc	cmp	r12, #1
0x27f64d0	beq	#-28
0x27f64d4	nop
0x27f64d8	add	sp, sp, #4
Attachment #8493767 - Flags: review?(mrosenberg)
Comment on attachment 8493767 [details] [diff] [review]
ARMSimulatorREPL.diff

Review of attachment 8493767 [details] [diff] [review]:
-----------------------------------------------------------------

Cool, this feature is already present in the simulator?
Attachment #8493767 - Flags: review?(mrosenberg) → review+
(In reply to Marty Rosenberg [:mjrosenb] from comment #1)

> Cool, this feature is already present in the simulator?

Yes.  Pretty neat.
https://hg.mozilla.org/mozilla-central/rev/af1438063539
Assignee: nobody → lhansen
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: