Skip to content

Commit

Permalink
Hooking up the Jump table dialog (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
uxmal committed Sep 19, 2016
1 parent 1c3f9ca commit 72d3a55
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 44 deletions.
5 changes: 5 additions & 0 deletions src/Gui/Forms/IJumpTableDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#endregion

using Reko.Core;
using Reko.Core.Machine;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -28,6 +29,10 @@ namespace Reko.Gui.Forms
{
public interface IJumpTableDialog : IDialog
{
Program Program { get; set; }
MachineInstruction Instruction { get; set; }
Address VectorAddress { get; set; }

UserIndirectJump GetResults();
}
}
73 changes: 35 additions & 38 deletions src/Gui/Windows/Forms/JumpTableDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Gui/Windows/Forms/JumpTableDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public JumpTableDialog()
}

public IServiceProvider Services { get; set; }
public MachineInstruction IndirectJump { get; set; }
public MachineInstruction Instruction { get; set; }
public Address VectorAddress { get; set; }
public Program Program { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions src/Gui/Windows/Forms/JumpTableInteractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public void Attach(JumpTableDialog dlg)

private void Dlg_Load(object sender, EventArgs e)
{
dlg.CaptionLabel.Text = string.Format("Jump table for {0}", dlg.IndirectJump.Address);
dlg.IndirectJumpLabel.Text = dlg.IndirectJump.ToString().Replace('\t', ' ');
dlg.CaptionLabel.Text = string.Format("Jump table for {0}", dlg.Instruction.Address);
dlg.IndirectJumpLabel.Text = dlg.Instruction.ToString().Replace('\t', ' ');
if (dlg.VectorAddress != null)
{
dlg.JumpTableStartAddress.Text = dlg.VectorAddress.ToString();
Expand Down Expand Up @@ -97,7 +97,7 @@ public UserIndirectJump GetResults()
var table = new ImageMapVectorTable(dlg.VectorAddress, entries.ToArray(), 0);
return new UserIndirectJump
{
Address = dlg.IndirectJump.Address,
Address = dlg.Instruction.Address,
Table = table,
IndexRegister = dlg.Program.Architecture.GetRegister(dlg.IndexRegister.SelectedIndex.ToString())
};
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/Windows/WindowsFormsDialogFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public IJumpTableDialog CreateJumpTableDialog(Program program, MachineInstructio
{
Services = this.services,
Program = program,
IndirectJump = instrIndirectJmp,
Instruction = instrIndirectJmp,
VectorAddress = addrVector
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void Given_Dialog_32Bit()
this.dlg = new JumpTableDialog()
{
Program = program,
IndirectJump = new FakeInstruction(Operation.Jump) { Address = Address.Ptr32(0x1000) }
Instruction = new FakeInstruction(Operation.Jump) { Address = Address.Ptr32(0x1000) }
};
}

Expand Down

0 comments on commit 72d3a55

Please sign in to comment.