private void toggleBreakpointButton_Click(object sender, EventArgs e) { if (!ready) { return; } if (disassembly.CurrentRow.DefaultCellStyle.BackColor == Color.Red) { disassembly.CurrentRow.DefaultCellStyle.BackColor = Color.White; ProcInfoRow pir = disassembly.CurrentRow.DataBoundItem as ProcInfoRow; if (pir != null) { disassembly.CurrentRow.DefaultCellStyle.SelectionBackColor = Color.LightGray; pir.BP = ""; } } else { disassembly.CurrentRow.DefaultCellStyle.BackColor = Color.Red; ProcInfoRow pir = disassembly.CurrentRow.DataBoundItem as ProcInfoRow; if (pir != null) { disassembly.CurrentRow.DefaultCellStyle.SelectionBackColor = Color.Maroon; pir.BP = "X"; } string name = procList.Items[procList.SelectedIndex].ToString(); Dictionary <string, object> cont = new Dictionary <string, object>(); cont["proc_name"] = name; cont["offset"] = pir.Offset; send_message("set_breakpoint", cont); } }
private void disassembly_SelectionChanged(object sender, EventArgs e) { if (!ready) { return; } ProcInfoRow pir = disassembly.CurrentRow.DataBoundItem as ProcInfoRow; if (pir != null) { if (pir.isCurrent == ">") { disassembly.CurrentRow.DefaultCellStyle.SelectionBackColor = Color.DarkCyan; } else { if (pir.BP == "X") { disassembly.CurrentRow.DefaultCellStyle.SelectionBackColor = Color.Maroon; } else { disassembly.CurrentRow.DefaultCellStyle.SelectionBackColor = Color.LightGray; } } } }
public void receive_data() { while (true) { string strMsg = reader.ReadLine(); if (string.IsNullOrEmpty(strMsg)) { continue; } //MessageBox.Show("Reading"); //writer.Write("ignore\n"); //writer.Flush(); Message msg = JsonConvert.DeserializeObject <Message>(strMsg); //MessageBox.Show(line); if (msg.type == "disassembly") { f**k = JsonConvert.DeserializeObject <List <ProcInfoRow> >(msg.content); oSignalEvent.Set(); } else if (msg.type == "debugger current") { Shit shit = JsonConvert.DeserializeObject <Shit>(msg.content); ProcInfoRow pir = disassembly.CurrentRow.DataBoundItem as ProcInfoRow; if (pir != null) { pir.isCurrent = ""; } int currentStep; ProcEntry fuckass = procInfos[shit.procname]; for (int i = 0; i < fuckass.disassembly.Count; i++) { procInfos[shit.procname].disassembly[i].isCurrent = ""; if (procInfos[shit.procname].disassembly[i].Offset == shit.offset) { procInfos[shit.procname].disassembly[i].isCurrent = ">"; currentStep = i; } } Invoke(new Action(() => { int hack = disassembly.FirstDisplayedScrollingRowIndex; int current = disassembly.CurrentRow.Index; BindingSource bs = new BindingSource(); bs.DataSource = procInfos[shit.procname].disassembly; disassembly.DataSource = bs; disassembly.Rows[current].Selected = true; disassembly.FirstDisplayedScrollingRowIndex = hack; })); } else if (msg.type == "local variables" && msg.content != null) { //MessageBox.Show(msg.content); List <LocalVariable> locals = JsonConvert.DeserializeObject <List <LocalVariable> >(msg.content); Invoke(new Action(() => { BindingSource bs = new BindingSource(); if (locals != null) { bs.DataSource = locals; } else { bs.DataSource = new List <LocalVariable>(); } localVariables.DataSource = bs; })); } else if (msg.type == "arguments" && msg.content != null) { //MessageBox.Show(msg.content); List <Argument> args = JsonConvert.DeserializeObject <List <Argument> >(msg.content); Invoke(new Action(() => { BindingSource bs = new BindingSource(); if (args != null) { bs.DataSource = args; } else { bs.DataSource = new List <Argument>(); } arguments.DataSource = bs; })); } else if (msg.type == "stack" && msg.content != null) { //MessageBox.Show(msg.content); List <Argument> args = JsonConvert.DeserializeObject <List <Argument> >(msg.content); Invoke(new Action(() => { BindingSource bs = new BindingSource(); if (args != null) { bs.DataSource = args; } else { bs.DataSource = new List <Argument>(); } procStack.DataSource = bs; })); } else if (msg.type == "callstack" && msg.content != null) { //MessageBox.Show(msg.content); List <string> procs = JsonConvert.DeserializeObject <List <string> >(msg.content); Invoke(new Action(() => { BindingSource bs = new BindingSource(); if (procs != null) { bs.DataSource = procs; } else { bs.DataSource = new List <Argument>(); } callStack.DataSource = bs; })); } } }