mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
update gdb to 7.3
add break to Cosmos.Debug.GDB client and update it for current gdb version
This commit is contained in:
parent
f41a3ae707
commit
612ef94eb0
10 changed files with 479 additions and 241 deletions
Binary file not shown.
|
|
@ -29,7 +29,7 @@ namespace Cosmos.Debug.GDB {
|
|||
}
|
||||
|
||||
public void OnDelete(GDB.Response aResponse) {
|
||||
var xSplit = aResponse.Reply.Split(' ');
|
||||
string[] xSplit = aResponse.Reply.Split(' ');
|
||||
int xID = int.Parse(xSplit[1]);
|
||||
var xUC = mBreakpoints[xID];
|
||||
mBreakpoints.Remove(xID);
|
||||
|
|
|
|||
278
source2/Debug/Cosmos.Debug.GDB/FormLog.Designer.cs
generated
278
source2/Debug/Cosmos.Debug.GDB/FormLog.Designer.cs
generated
|
|
@ -23,148 +23,148 @@
|
|||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mitmCopyToClipboard = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mitmClear = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.butnSendCmd = new System.Windows.Forms.Button();
|
||||
this.textSendCmd = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.lboxDebug = new System.Windows.Forms.ListBox();
|
||||
this.lboxCmd = new System.Windows.Forms.ListBox();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mitmCopyToClipboard = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mitmClear = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.butnSendCmd = new System.Windows.Forms.Button();
|
||||
this.textSendCmd = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.lboxDebug = new System.Windows.Forms.ListBox();
|
||||
this.lboxCmd = new System.Windows.Forms.ListBox();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(489, 24);
|
||||
this.menuStrip1.TabIndex = 6;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(489, 24);
|
||||
this.menuStrip1.TabIndex = 6;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mitmCopyToClipboard,
|
||||
this.mitmClear});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "&File";
|
||||
//
|
||||
// mitmCopyToClipboard
|
||||
//
|
||||
this.mitmCopyToClipboard.Name = "mitmCopyToClipboard";
|
||||
this.mitmCopyToClipboard.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||
this.mitmCopyToClipboard.Size = new System.Drawing.Size(213, 22);
|
||||
this.mitmCopyToClipboard.Text = "&Copy to Clipboard";
|
||||
this.mitmCopyToClipboard.Click += new System.EventHandler(this.mitmCopyToClipboard_Click);
|
||||
//
|
||||
// mitmClear
|
||||
//
|
||||
this.mitmClear.Name = "mitmClear";
|
||||
this.mitmClear.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L)));
|
||||
this.mitmClear.Size = new System.Drawing.Size(213, 22);
|
||||
this.mitmClear.Text = "C&lear";
|
||||
this.mitmClear.Click += new System.EventHandler(this.mitmClear_Click);
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.butnSendCmd);
|
||||
this.panel2.Controls.Add(this.textSendCmd);
|
||||
this.panel2.Controls.Add(this.label1);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 24);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(489, 33);
|
||||
this.panel2.TabIndex = 10;
|
||||
//
|
||||
// butnSendCmd
|
||||
//
|
||||
this.butnSendCmd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.butnSendCmd.Location = new System.Drawing.Point(438, 5);
|
||||
this.butnSendCmd.Name = "butnSendCmd";
|
||||
this.butnSendCmd.Size = new System.Drawing.Size(47, 23);
|
||||
this.butnSendCmd.TabIndex = 2;
|
||||
this.butnSendCmd.Text = "Send";
|
||||
this.butnSendCmd.UseVisualStyleBackColor = true;
|
||||
this.butnSendCmd.Click += new System.EventHandler(this.butnSendCmd_Click);
|
||||
//
|
||||
// textSendCmd
|
||||
//
|
||||
this.textSendCmd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textSendCmd.Location = new System.Drawing.Point(63, 7);
|
||||
this.textSendCmd.Name = "textSendCmd";
|
||||
this.textSendCmd.Size = new System.Drawing.Size(370, 20);
|
||||
this.textSendCmd.TabIndex = 1;
|
||||
this.textSendCmd.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textSendCmd_KeyPress);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(4, 10);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(57, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Command:";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.lboxDebug);
|
||||
this.panel1.Controls.Add(this.lboxCmd);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 57);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(489, 317);
|
||||
this.panel1.TabIndex = 11;
|
||||
//
|
||||
// lboxDebug
|
||||
//
|
||||
this.lboxDebug.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lboxDebug.FormattingEnabled = true;
|
||||
this.lboxDebug.Location = new System.Drawing.Point(188, 0);
|
||||
this.lboxDebug.Name = "lboxDebug";
|
||||
this.lboxDebug.Size = new System.Drawing.Size(301, 316);
|
||||
this.lboxDebug.TabIndex = 9;
|
||||
//
|
||||
// lboxCmd
|
||||
//
|
||||
this.lboxCmd.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.lboxCmd.FormattingEnabled = true;
|
||||
this.lboxCmd.Location = new System.Drawing.Point(0, 0);
|
||||
this.lboxCmd.Name = "lboxCmd";
|
||||
this.lboxCmd.Size = new System.Drawing.Size(188, 316);
|
||||
this.lboxCmd.TabIndex = 7;
|
||||
this.lboxCmd.SelectedIndexChanged += new System.EventHandler(this.lboxCmd_SelectedIndexChanged);
|
||||
//
|
||||
// FormLog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(489, 374);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "FormLog";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Debug Log";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormLog_FormClosing);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "&File";
|
||||
//
|
||||
// mitmCopyToClipboard
|
||||
//
|
||||
this.mitmCopyToClipboard.Name = "mitmCopyToClipboard";
|
||||
this.mitmCopyToClipboard.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||
this.mitmCopyToClipboard.Size = new System.Drawing.Size(213, 22);
|
||||
this.mitmCopyToClipboard.Text = "&Copy to Clipboard";
|
||||
this.mitmCopyToClipboard.Click += new System.EventHandler(this.mitmCopyToClipboard_Click);
|
||||
//
|
||||
// mitmClear
|
||||
//
|
||||
this.mitmClear.Name = "mitmClear";
|
||||
this.mitmClear.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L)));
|
||||
this.mitmClear.Size = new System.Drawing.Size(213, 22);
|
||||
this.mitmClear.Text = "C&lear";
|
||||
this.mitmClear.Click += new System.EventHandler(this.mitmClear_Click);
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.butnSendCmd);
|
||||
this.panel2.Controls.Add(this.textSendCmd);
|
||||
this.panel2.Controls.Add(this.label1);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 24);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(489, 33);
|
||||
this.panel2.TabIndex = 10;
|
||||
//
|
||||
// butnSendCmd
|
||||
//
|
||||
this.butnSendCmd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.butnSendCmd.Location = new System.Drawing.Point(438, 5);
|
||||
this.butnSendCmd.Name = "butnSendCmd";
|
||||
this.butnSendCmd.Size = new System.Drawing.Size(47, 23);
|
||||
this.butnSendCmd.TabIndex = 2;
|
||||
this.butnSendCmd.Text = "Send";
|
||||
this.butnSendCmd.UseVisualStyleBackColor = true;
|
||||
this.butnSendCmd.Click += new System.EventHandler(this.butnSendCmd_Click);
|
||||
//
|
||||
// textSendCmd
|
||||
//
|
||||
this.textSendCmd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textSendCmd.Location = new System.Drawing.Point(63, 7);
|
||||
this.textSendCmd.Name = "textSendCmd";
|
||||
this.textSendCmd.Size = new System.Drawing.Size(370, 20);
|
||||
this.textSendCmd.TabIndex = 1;
|
||||
this.textSendCmd.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textSendCmd_KeyPress);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(4, 10);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(57, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Command:";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.lboxDebug);
|
||||
this.panel1.Controls.Add(this.lboxCmd);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 57);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(489, 317);
|
||||
this.panel1.TabIndex = 11;
|
||||
//
|
||||
// lboxDebug
|
||||
//
|
||||
this.lboxDebug.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lboxDebug.FormattingEnabled = true;
|
||||
this.lboxDebug.Location = new System.Drawing.Point(188, 0);
|
||||
this.lboxDebug.Name = "lboxDebug";
|
||||
this.lboxDebug.Size = new System.Drawing.Size(301, 317);
|
||||
this.lboxDebug.TabIndex = 9;
|
||||
//
|
||||
// lboxCmd
|
||||
//
|
||||
this.lboxCmd.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.lboxCmd.FormattingEnabled = true;
|
||||
this.lboxCmd.Location = new System.Drawing.Point(0, 0);
|
||||
this.lboxCmd.Name = "lboxCmd";
|
||||
this.lboxCmd.Size = new System.Drawing.Size(188, 317);
|
||||
this.lboxCmd.TabIndex = 7;
|
||||
this.lboxCmd.SelectedIndexChanged += new System.EventHandler(this.lboxCmd_SelectedIndexChanged);
|
||||
//
|
||||
// FormLog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(489, 374);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.panel2);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "FormLog";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Debug Log";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormLog_FormClosing);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,11 +54,17 @@ namespace Cosmos.Debug.GDB {
|
|||
if (xResponse.Error) {
|
||||
lboxDebug.Items.Add("ERROR: " + xResponse.ErrorMsg);
|
||||
}
|
||||
lboxDebug.Items.Add("");
|
||||
lboxDebug.Items.Add(string.Empty);
|
||||
|
||||
foreach (var x in xResponse.Text) {
|
||||
lboxDebug.Items.Add(x);
|
||||
}
|
||||
|
||||
if (xResponse.Reply != xResponse.Command)
|
||||
{
|
||||
lboxDebug.Items.Add(string.Empty);
|
||||
lboxDebug.Items.Add(xResponse.Reply);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,12 +112,12 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
38
source2/Debug/Cosmos.Debug.GDB/FormMain.Designer.cs
generated
38
source2/Debug/Cosmos.Debug.GDB/FormMain.Designer.cs
generated
|
|
@ -25,6 +25,7 @@
|
|||
private void InitializeComponent() {
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.butnBreak = new System.Windows.Forms.Button();
|
||||
this.butnBreakpoints = new System.Windows.Forms.Button();
|
||||
this.lablRunning = new System.Windows.Forms.Label();
|
||||
this.lablConnected = new System.Windows.Forms.Label();
|
||||
|
|
@ -42,6 +43,7 @@
|
|||
this.mitmStepOver = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mitmContinue = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mitmBreak = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mitmViewBreakpoints = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mitmMainViewCallStack = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
|
@ -65,6 +67,7 @@
|
|||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.butnBreak);
|
||||
this.panel1.Controls.Add(this.butnBreakpoints);
|
||||
this.panel1.Controls.Add(this.lablRunning);
|
||||
this.panel1.Controls.Add(this.lablConnected);
|
||||
|
|
@ -76,9 +79,19 @@
|
|||
this.panel1.Size = new System.Drawing.Size(589, 30);
|
||||
this.panel1.TabIndex = 3;
|
||||
//
|
||||
// butnBreak
|
||||
//
|
||||
this.butnBreak.Location = new System.Drawing.Point(117, 4);
|
||||
this.butnBreak.Name = "butnBreak";
|
||||
this.butnBreak.Size = new System.Drawing.Size(26, 23);
|
||||
this.butnBreak.TabIndex = 4;
|
||||
this.butnBreak.Text = "| |";
|
||||
this.butnBreak.UseVisualStyleBackColor = true;
|
||||
this.butnBreak.Click += new System.EventHandler(this.mitmBreak_Click);
|
||||
//
|
||||
// butnBreakpoints
|
||||
//
|
||||
this.butnBreakpoints.Location = new System.Drawing.Point(118, 3);
|
||||
this.butnBreakpoints.Location = new System.Drawing.Point(152, 4);
|
||||
this.butnBreakpoints.Name = "butnBreakpoints";
|
||||
this.butnBreakpoints.Size = new System.Drawing.Size(75, 23);
|
||||
this.butnBreakpoints.TabIndex = 2;
|
||||
|
|
@ -110,19 +123,19 @@
|
|||
//
|
||||
// butnContinue
|
||||
//
|
||||
this.butnContinue.Location = new System.Drawing.Point(70, 4);
|
||||
this.butnContinue.Location = new System.Drawing.Point(87, 4);
|
||||
this.butnContinue.Name = "butnContinue";
|
||||
this.butnContinue.Size = new System.Drawing.Size(26, 23);
|
||||
this.butnContinue.TabIndex = 1;
|
||||
this.butnContinue.Text = ">";
|
||||
this.butnContinue.UseVisualStyleBackColor = true;
|
||||
this.butnContinue.Click += new System.EventHandler(this.continueToolStripMenuItem_Click);
|
||||
this.butnContinue.Click += new System.EventHandler(this.mitmContinue_Click);
|
||||
//
|
||||
// butnConnect
|
||||
//
|
||||
this.butnConnect.Location = new System.Drawing.Point(3, 3);
|
||||
this.butnConnect.Name = "butnConnect";
|
||||
this.butnConnect.Size = new System.Drawing.Size(56, 23);
|
||||
this.butnConnect.Size = new System.Drawing.Size(78, 23);
|
||||
this.butnConnect.TabIndex = 0;
|
||||
this.butnConnect.Text = "Connect";
|
||||
this.butnConnect.UseVisualStyleBackColor = true;
|
||||
|
|
@ -194,7 +207,8 @@
|
|||
this.mitmStepInto,
|
||||
this.mitmStepOver,
|
||||
this.toolStripMenuItem1,
|
||||
this.mitmContinue});
|
||||
this.mitmContinue,
|
||||
this.mitmBreak});
|
||||
this.executeToolStripMenuItem.Name = "executeToolStripMenuItem";
|
||||
this.executeToolStripMenuItem.Size = new System.Drawing.Size(40, 20);
|
||||
this.executeToolStripMenuItem.Text = "&Run";
|
||||
|
|
@ -226,7 +240,15 @@
|
|||
this.mitmContinue.ShortcutKeys = System.Windows.Forms.Keys.F5;
|
||||
this.mitmContinue.Size = new System.Drawing.Size(150, 22);
|
||||
this.mitmContinue.Text = "&Continue";
|
||||
this.mitmContinue.Click += new System.EventHandler(this.continueToolStripMenuItem_Click);
|
||||
this.mitmContinue.Click += new System.EventHandler(this.mitmContinue_Click);
|
||||
//
|
||||
// mitmBreak
|
||||
//
|
||||
this.mitmBreak.Name = "mitmBreak";
|
||||
this.mitmBreak.ShortcutKeys = System.Windows.Forms.Keys.F6;
|
||||
this.mitmBreak.Size = new System.Drawing.Size(150, 22);
|
||||
this.mitmBreak.Text = "&Break";
|
||||
this.mitmBreak.Click += new System.EventHandler(this.mitmBreak_Click);
|
||||
//
|
||||
// viewToolStripMenuItem
|
||||
//
|
||||
|
|
@ -367,7 +389,7 @@
|
|||
this.Name = "FormMain";
|
||||
this.Text = "Cosmos GDB Debugger";
|
||||
this.Activated += new System.EventHandler(this.FormMain_Activated);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormMain_FormClosed);
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
this.Shown += new System.EventHandler(this.FormMain_Shown);
|
||||
this.Resize += new System.EventHandler(this.FormMain_Resize);
|
||||
|
|
@ -418,6 +440,8 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem mitemDisassemblyAddBreakpoint;
|
||||
private System.Windows.Forms.ToolStripMenuItem mitmCopyToClipboard;
|
||||
private System.Windows.Forms.Button butnBreakpoints;
|
||||
private System.Windows.Forms.Button butnBreak;
|
||||
private System.Windows.Forms.ToolStripMenuItem mitmBreak;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Cosmos.Debug.GDB {
|
||||
public partial class FormMain : Form {
|
||||
|
|
@ -16,6 +17,7 @@ namespace Cosmos.Debug.GDB {
|
|||
public readonly string mLabel;
|
||||
public readonly string mOp;
|
||||
public readonly string mData = string.Empty;
|
||||
public readonly bool mEIPHere;
|
||||
|
||||
public AsmLine(string aInput) {
|
||||
//"0x0056d2b9 <_end_data+0>:\tmov DWORD PTR ds:0x550020,ebx\n"
|
||||
|
|
@ -23,10 +25,18 @@ namespace Cosmos.Debug.GDB {
|
|||
var xSplit1 = s.Split(Global.TabSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
var xSplit2 = xSplit1[0].Split(Global.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||
mAddr = Global.FromHexWithLeadingZeroX(xSplit2[0]);
|
||||
|
||||
int xIndex = 0;
|
||||
//newer gdb above 6.6 or higher versions
|
||||
if (xSplit2[0] == "=>")
|
||||
{
|
||||
mEIPHere = true;
|
||||
xIndex = 1;
|
||||
}
|
||||
mAddr = Global.FromHexWithLeadingZeroX(xSplit2[xIndex]);
|
||||
string xLabel;
|
||||
if (xSplit2.Length > 1) {
|
||||
xLabel = xSplit2[1];
|
||||
if (xSplit2.Length > xIndex + 1) {
|
||||
xLabel = xSplit2[xIndex + 1];
|
||||
}
|
||||
|
||||
xSplit2 = xSplit1[1].Split(Global.SpaceSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
|
@ -45,7 +55,10 @@ namespace Cosmos.Debug.GDB {
|
|||
}
|
||||
}
|
||||
|
||||
const int MAX_RETRY = 3;
|
||||
protected string mFuncName;
|
||||
protected bool mCreated;
|
||||
protected int mConnectRetry;
|
||||
|
||||
protected void OnGDBResponse(GDB.Response aResponse) {
|
||||
try {
|
||||
|
|
@ -54,21 +67,75 @@ namespace Cosmos.Debug.GDB {
|
|||
if (xCmdLine == "info registers") {
|
||||
Windows.mRegistersForm.UpdateRegisters(aResponse);
|
||||
Windows.UpdateAfterRegisterUpdate();
|
||||
} else if (xCmdLine == "") {
|
||||
// This happens on initial connect
|
||||
}else if(xCmdLine.Length == 0) {
|
||||
if (aResponse.Text.Count == 2 && aResponse.Text[0] == "Breakpoint")
|
||||
{
|
||||
// program breaks on aResponse.Text[1]
|
||||
}
|
||||
else
|
||||
{
|
||||
// contains address where we are
|
||||
}
|
||||
} else {
|
||||
var xCmdParts = xCmdLine.Split(Global.SpaceSeparator);
|
||||
var xCmd = xCmdParts[0];
|
||||
bool asyncCmd = false;
|
||||
if (xCmd.EndsWith("&"))
|
||||
{
|
||||
asyncCmd = true;
|
||||
xCmd = xCmd.Substring(0, xCmd.Length - 1);
|
||||
}
|
||||
if (xCmd == "disassemble") {
|
||||
OnDisassemble(aResponse);
|
||||
} else if (xCmd == "symbol-file") { // nothing
|
||||
} else if (xCmd == "set") { // nothing
|
||||
} else if (xCmd == "target") { // nothing
|
||||
} else if (xCmd == "target") {
|
||||
|
||||
if (Global.GDB.Connected)
|
||||
{
|
||||
lablConnected.Visible = true;
|
||||
lablRunning.Visible = true;
|
||||
|
||||
mitmConnect.Enabled = true;
|
||||
butnConnect.Enabled = true;
|
||||
mitmConnect.Text = "&Disconnect";
|
||||
butnConnect.Text = "&Disconnect";
|
||||
|
||||
Settings.InitWindows();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mConnectRetry < MAX_RETRY + 1)
|
||||
{
|
||||
Connect();
|
||||
}
|
||||
else
|
||||
{
|
||||
mitmConnect.Enabled = true;
|
||||
butnConnect.Enabled = true;
|
||||
mitmConnect.Text = "&Connect";
|
||||
butnConnect.Text = "&Connect";
|
||||
}
|
||||
}
|
||||
} else if (xCmd == "detach") {
|
||||
if (false == Global.GDB.Connected)
|
||||
{
|
||||
mitmConnect.Text = "&Connect";
|
||||
butnConnect.Text = "&Connect";
|
||||
mitmContinue.Enabled = false;
|
||||
butnContinue.Enabled = false;
|
||||
mitmStepInto.Enabled = false;
|
||||
mitmStepOver.Enabled = false;
|
||||
lboxDisassemble.Items.Clear();
|
||||
lablConnected.Visible = false;
|
||||
lablRunning.Visible = false;
|
||||
textCurrentFunction.Visible = false;
|
||||
}
|
||||
} else if (xCmd == "delete") {
|
||||
Windows.mBreakpointsForm.OnDelete(aResponse);
|
||||
} else if ((xCmd == "stepi") || (xCmd == "nexti") || (xCmd == "continue")) {
|
||||
lablRunning.Text = "Stopped";
|
||||
Windows.UpdateAllWindows();
|
||||
} else if ((xCmd == "stepi") || (xCmd == "nexti")) {
|
||||
} else if (xCmd == "continue" || xCmd== "fg") {
|
||||
lboxDisassemble.Items.Clear();
|
||||
} else if (xCmd == "where") {
|
||||
Windows.mCallStackForm.OnWhere(aResponse);
|
||||
} else if (xCmd == "break") {
|
||||
|
|
@ -87,7 +154,12 @@ namespace Cosmos.Debug.GDB {
|
|||
public void Disassemble(string aLabel) {
|
||||
textCurrentFunction.Text = string.Empty;
|
||||
textCurrentFunction.Visible = true;
|
||||
Global.GDB.SendCmd("disassemble " + aLabel.TrimEnd());
|
||||
// force space free at end
|
||||
var xDisAsmCmd = "disassemble";
|
||||
var xLabelTrimed = aLabel.TrimEnd();
|
||||
if (xLabelTrimed.Length > 0)
|
||||
xDisAsmCmd += " " + xLabelTrimed;
|
||||
Global.GDB.SendCmd(xDisAsmCmd);
|
||||
}
|
||||
|
||||
protected void OnDisassemble(GDB.Response xResponse) {
|
||||
|
|
@ -136,45 +208,84 @@ namespace Cosmos.Debug.GDB {
|
|||
}
|
||||
|
||||
private void mitmStepInto_Click(object sender, EventArgs e) {
|
||||
lablRunning.Text = "Running";
|
||||
Global.GDB.SendCmd("stepi");
|
||||
}
|
||||
|
||||
private void mitmStepOver_Click(object sender, EventArgs e) {
|
||||
lablRunning.Text = "Running";
|
||||
Global.GDB.SendCmd("nexti");
|
||||
}
|
||||
|
||||
protected void Connect(int aRetry) {
|
||||
if (!mitmConnect.Enabled) {
|
||||
return;
|
||||
}
|
||||
protected void Connect() {
|
||||
mitmConnect.Enabled = false;
|
||||
butnConnect.Enabled = false;
|
||||
|
||||
Windows.CreateForms();
|
||||
Global.AsmSource = new AsmFile(Path.Combine(Settings.OutputPath, Settings.AsmFile));
|
||||
Global.GDB = new GDB(aRetry, OnGDBResponse);
|
||||
if (Global.GDB.Connected) {
|
||||
lablConnected.Visible = true;
|
||||
lablRunning.Visible = true;
|
||||
lablRunning.Text = "Stopped";
|
||||
Settings.InitWindows();
|
||||
Windows.UpdateAllWindows();
|
||||
}
|
||||
mitmConnect.Text = "Try " + mConnectRetry;
|
||||
butnConnect.Text = "Try " + mConnectRetry++;
|
||||
|
||||
if (false == mCreated)
|
||||
{
|
||||
Windows.CreateForms();
|
||||
Global.AsmSource = new AsmFile(Path.Combine(Settings.OutputPath, Settings.AsmFile));
|
||||
Global.GDB = new GDB(OnGDBResponse, OnRunStateChanged);
|
||||
mCreated = true;
|
||||
}
|
||||
Global.GDB.Connect();
|
||||
}
|
||||
|
||||
private void OnRunStateChanged(bool stopped)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke((MethodInvoker) delegate{OnRunStateChanged(stopped);});
|
||||
return;
|
||||
}
|
||||
if (stopped)
|
||||
{
|
||||
lablRunning.Text = "Stopped";
|
||||
mitmContinue.Enabled = true;
|
||||
butnContinue.Enabled = true;
|
||||
mitmBreak.Enabled = false;
|
||||
butnBreak.Enabled = false;
|
||||
mitmConnect.Enabled = true;
|
||||
butnConnect.Enabled = true;
|
||||
mitmStepInto.Enabled = true;
|
||||
mitmStepOver.Enabled = true;
|
||||
Windows.UpdateAllWindows();
|
||||
}
|
||||
else
|
||||
{
|
||||
lablRunning.Text = "Running";
|
||||
mitmContinue.Enabled = false;
|
||||
butnContinue.Enabled = false;
|
||||
mitmBreak.Enabled = true;
|
||||
butnBreak.Enabled = true;
|
||||
mitmConnect.Enabled = false;
|
||||
butnConnect.Enabled = false;
|
||||
mitmStepInto.Enabled = false;
|
||||
mitmStepOver.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void mitmConnect_Click(object sender, EventArgs e) {
|
||||
Connect(30);
|
||||
if (!mitmConnect.Enabled)
|
||||
return;
|
||||
if (mCreated && Global.GDB.Connected)
|
||||
{
|
||||
Global.GDB.Disconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
mConnectRetry = 1;
|
||||
Connect();
|
||||
}
|
||||
}
|
||||
|
||||
private void mitmRefresh_Click(object sender, EventArgs e) {
|
||||
Windows.UpdateAllWindows();
|
||||
}
|
||||
|
||||
private void continueToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
lablRunning.Text = "Running";
|
||||
Global.GDB.SendCmd("continue");
|
||||
private void mitmContinue_Click(object sender, EventArgs e) {
|
||||
Global.GDB.SendCmd("continue&");
|
||||
}
|
||||
|
||||
private void mitmMainViewCallStack_Click(object sender, EventArgs e) {
|
||||
|
|
@ -214,13 +325,21 @@ namespace Cosmos.Debug.GDB {
|
|||
}
|
||||
|
||||
private void FormMain_Shown(object sender, EventArgs e) {
|
||||
mitmContinue.Enabled = false;
|
||||
butnContinue.Enabled = false;
|
||||
mitmBreak.Enabled = false;
|
||||
butnBreak.Enabled = false;
|
||||
mitmStepInto.Enabled = false;
|
||||
mitmStepOver.Enabled = false;
|
||||
|
||||
// Dont put this in load. Load happens in main call from Main.cs and on exceptions just
|
||||
// goes out, no message.
|
||||
// goes out, no message.
|
||||
// Also we want to show other forms after main form, not before.
|
||||
// We also only want to run this once, not on each possible show.
|
||||
if (mitmConnect.Enabled) {
|
||||
if (Settings.AutoConnect) {
|
||||
Connect(30);
|
||||
mConnectRetry = 1;
|
||||
Connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -269,9 +388,6 @@ namespace Cosmos.Debug.GDB {
|
|||
Clipboard.SetText(x.ToString());
|
||||
}
|
||||
|
||||
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
}
|
||||
|
||||
private void butnBreakpoints_Click(object sender, EventArgs e) {
|
||||
mitmViewBreakpoints.PerformClick();
|
||||
}
|
||||
|
|
@ -284,5 +400,18 @@ namespace Cosmos.Debug.GDB {
|
|||
textCurrentFunction.Width = (int)size.Width + textCurrentFunction.Padding.Horizontal;
|
||||
}
|
||||
}
|
||||
|
||||
private void mitmBreak_Click(object sender, EventArgs e) {
|
||||
Global.GDB.SendCmd("-exec-interrupt");
|
||||
}
|
||||
|
||||
private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
if (mCreated && Global.GDB.Connected)
|
||||
{
|
||||
Global.GDB.Disconnect();
|
||||
Global.GDB.SendCmd("quit");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ using System.Text;
|
|||
using System.Threading;
|
||||
using Registry = Microsoft.Win32.Registry;
|
||||
using Path = System.IO.Path;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Cosmos.Debug.GDB {
|
||||
public class GDB {
|
||||
|
|
@ -23,8 +24,9 @@ namespace Cosmos.Debug.GDB {
|
|||
}
|
||||
|
||||
protected Queue<string> mLastCmd = new Queue<string>();
|
||||
protected System.Diagnostics.Process mGDBProcess;
|
||||
public System.Diagnostics.Process mGDBProcess;
|
||||
protected Action<Response> mOnResponse;
|
||||
protected Action<bool> mOnRunStateChange;
|
||||
protected List<string> mBuffer = new List<string>();
|
||||
|
||||
// DO NOT change to sync reads.. with process output there are SERIOUS bugs in the StreamReader..
|
||||
|
|
@ -33,19 +35,67 @@ namespace Cosmos.Debug.GDB {
|
|||
// StreamReader in general has other issues on non seekable streams as well and accounts for why even our
|
||||
// implementation looks poor in places.
|
||||
void mGDBProcess_OutputDataReceived(object sender, DataReceivedEventArgs e) {
|
||||
string xData = e.Data.Trim();
|
||||
if (xData == "(gdb)") {
|
||||
ProcessResponse();
|
||||
} else {
|
||||
mBuffer.Add(xData);
|
||||
}
|
||||
all.Add(e.Data);
|
||||
if (e.Data == null)
|
||||
return;
|
||||
ProcessResponse(e.Data);
|
||||
}
|
||||
|
||||
protected void ProcessResponse() {
|
||||
bool firstRun = true;
|
||||
|
||||
List<string> all = new List<string>();
|
||||
protected bool m_IsStopped = true;
|
||||
|
||||
void OnRunStateChanged(bool stopped)
|
||||
{
|
||||
m_IsStopped = stopped;
|
||||
mOnRunStateChange(stopped);
|
||||
}
|
||||
|
||||
protected void ProcessResponse(string line) {
|
||||
switch (line)
|
||||
{
|
||||
case "(gdb) ":
|
||||
if (firstRun)
|
||||
{
|
||||
// remove start things, like versions etc.
|
||||
mBuffer.Clear();
|
||||
firstRun = false;
|
||||
return;
|
||||
}
|
||||
else if (mBuffer.Count == 0)
|
||||
{
|
||||
// occures if CTRL + C the program breaks
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// only 7.x
|
||||
if (line[0] == '*')
|
||||
{ // represents start or stopped
|
||||
int xIndex = line.IndexOf(',');
|
||||
string xState = line.Substring(1, xIndex - 1);
|
||||
switch (xState)
|
||||
{
|
||||
case "stopped":
|
||||
OnRunStateChanged(true);
|
||||
break;
|
||||
case "running":
|
||||
OnRunStateChanged(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
mBuffer.Add(line);
|
||||
return;
|
||||
}
|
||||
var xResponse = new Response();
|
||||
lock (mLastCmd) {
|
||||
xResponse.Command = mLastCmd.Dequeue();
|
||||
}
|
||||
|
||||
string xCmd = mBuffer[0];
|
||||
if (xCmd[0] == '&')
|
||||
{
|
||||
xResponse.Command = Unescape(xCmd.Substring(1));
|
||||
}
|
||||
|
||||
foreach (string xLine in mBuffer) {
|
||||
var xType = xLine[0];
|
||||
|
|
@ -65,16 +115,33 @@ namespace Cosmos.Debug.GDB {
|
|||
|
||||
string sData = Unescape(xLine.Substring(1));
|
||||
if (xType == '&') {
|
||||
xResponse.Reply = sData;
|
||||
} else if (xType == '^') {
|
||||
xResponse.Error = sData != "done";
|
||||
if (xResponse.Reply.Length == 0)
|
||||
xResponse.Reply = sData;
|
||||
else
|
||||
xResponse.Reply += Environment.NewLine + sData;
|
||||
} else if (xType == '~') {
|
||||
xResponse.Text.Add(Unescape(sData));
|
||||
}
|
||||
else if (xType == '^') {
|
||||
xResponse.Error = sData.StartsWith("error");
|
||||
}
|
||||
}
|
||||
|
||||
mBuffer.Clear();
|
||||
Windows.mMainForm.Invoke(mOnResponse, new object[] { xResponse });
|
||||
|
||||
// detect manual input of cmds
|
||||
var xSplit = xResponse.Command.Split(new char[]{' ', '\t'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (xSplit.Length == 1 && xSplit[0] == "detach")
|
||||
{
|
||||
if (false == xResponse.Error)
|
||||
mConnected = false;
|
||||
}
|
||||
else if (xSplit.Length > 2 && xSplit[0] == "target" && xSplit[1] == "remote")
|
||||
{
|
||||
TargetCmdReply(xResponse);
|
||||
}
|
||||
if (false == Windows.mMainForm.IsDisposed)
|
||||
Windows.mMainForm.Invoke(mOnResponse, new object[] { xResponse });
|
||||
}
|
||||
|
||||
static public string Unescape(string aInput) {
|
||||
|
|
@ -89,10 +156,8 @@ namespace Cosmos.Debug.GDB {
|
|||
}
|
||||
|
||||
public void SendCmd(string aCmd) {
|
||||
lock (mLastCmd) {
|
||||
mLastCmd.Enqueue(aCmd);
|
||||
}
|
||||
mGDBProcess.StandardInput.WriteLine(aCmd);
|
||||
all.Add("Cmd: " + aCmd);
|
||||
mGDBProcess.StandardInput.WriteLine(aCmd);
|
||||
}
|
||||
|
||||
protected bool mConnected = false;
|
||||
|
|
@ -100,6 +165,11 @@ namespace Cosmos.Debug.GDB {
|
|||
get { return mConnected; }
|
||||
}
|
||||
|
||||
public bool Stopped
|
||||
{
|
||||
get { return m_IsStopped; }
|
||||
}
|
||||
|
||||
static readonly string mGDBExePath;
|
||||
|
||||
static GDB()
|
||||
|
|
@ -113,49 +183,59 @@ namespace Cosmos.Debug.GDB {
|
|||
}
|
||||
}
|
||||
|
||||
public GDB(int aRetry, Action<Response> aOnResponse) {
|
||||
public GDB(Action<Response> aOnResponse, Action<bool> aOnRunStateChange)
|
||||
{
|
||||
mOnResponse = aOnResponse;
|
||||
// To handle greeting from GDB since its not associated with any command
|
||||
mLastCmd.Enqueue(string.Empty);
|
||||
mOnRunStateChange = aOnRunStateChange;
|
||||
|
||||
var xStartInfo = new ProcessStartInfo();
|
||||
xStartInfo.FileName = mGDBExePath;
|
||||
xStartInfo.Arguments = @"--interpreter=mi2";
|
||||
xStartInfo.Arguments = @"--interpreter=mi2 -silent -nx";
|
||||
xStartInfo.WorkingDirectory = Settings.OutputPath;
|
||||
xStartInfo.CreateNoWindow = true;
|
||||
xStartInfo.UseShellExecute = false;
|
||||
xStartInfo.RedirectStandardError = true;
|
||||
xStartInfo.RedirectStandardInput = true;
|
||||
xStartInfo.RedirectStandardOutput = true;
|
||||
|
||||
mGDBProcess = System.Diagnostics.Process.Start(xStartInfo);
|
||||
mGDBProcess.StandardInput.AutoFlush = true;
|
||||
|
||||
mGDBProcess.OutputDataReceived += new DataReceivedEventHandler(mGDBProcess_OutputDataReceived);
|
||||
mGDBProcess.BeginOutputReadLine();
|
||||
|
||||
mConnected = true;
|
||||
|
||||
SendCmd("set target-async 1"); // doc http://sourceware.org/gdb/onlinedocs/gdb/Asynchronous-and-non_002dstop-modes.html
|
||||
SendCmd("symbol-file " + Settings.ObjFile);
|
||||
SendCmd("target remote :8832");
|
||||
|
||||
//while (!mConnected) {
|
||||
// var x = SendCmd("target remote :8832");
|
||||
// mConnected = !x.Error;
|
||||
// aRetry--;
|
||||
// if (aRetry == 0) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// System.Threading.Thread.Sleep(1000);
|
||||
// System.Windows.Forms.Application.DoEvents();
|
||||
//}
|
||||
|
||||
SendCmd("set architecture i386");
|
||||
SendCmd("set language asm");
|
||||
SendCmd("set disassembly-flavor intel");
|
||||
SendCmd("break Kernel_Start");
|
||||
SendCmd("continue");
|
||||
SendCmd("delete 1");
|
||||
SendCmd("set architecture i386");
|
||||
SendCmd("set language asm");
|
||||
SendCmd("set disassembly-flavor intel");
|
||||
}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
SendCmd("target remote :8832");
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
SendCmd("detach");
|
||||
}
|
||||
|
||||
protected void TargetCmdReply(Response res)
|
||||
{
|
||||
mConnected = !res.Error;
|
||||
if (false == res.Error)
|
||||
{
|
||||
// get current address
|
||||
var xAddr = Global.FromHexWithLeadingZeroX(res.Text[1].Substring(0, res.Text[1].IndexOf(' ')));
|
||||
// only use breakpoint if not already deep in OS
|
||||
const int START_ADDRESS = 0x000ffff0;
|
||||
if (xAddr <= START_ADDRESS)
|
||||
{
|
||||
SendCmd("break Kernel_Start");
|
||||
SendCmd("continue");
|
||||
SendCmd("delete 1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Environment = System.Environment;
|
||||
using STAThread = System.STAThreadAttribute;
|
||||
using Application = System.Windows.Forms.Application;
|
||||
|
||||
namespace Cosmos.Debug.GDB {
|
||||
static class Program {
|
||||
[STAThread]
|
||||
static void Main() {
|
||||
var xArgs = System.Environment.GetCommandLineArgs();
|
||||
var xArgs = Environment.GetCommandLineArgs();
|
||||
if (xArgs.Length > 1) {
|
||||
if (false == Settings.Load(xArgs[1]))
|
||||
return;
|
||||
}
|
||||
if (xArgs.Length > 2) {
|
||||
//Settings.AutoConnect = string.Compare(xArgs[2], "/Connect", true) == 0;
|
||||
Settings.AutoConnect = string.Compare(xArgs[2], "/Connect", true) == 0;
|
||||
}
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ namespace Cosmos.Debug.GDB {
|
|||
}
|
||||
|
||||
static public void UpdateAllWindows() {
|
||||
Windows.mMainForm.Disassemble("");
|
||||
Windows.mMainForm.Disassemble(string.Empty);
|
||||
Windows.mRegistersForm.Redo();
|
||||
Windows.mCallStackForm.Redo();
|
||||
Windows.mCallStackForm.Redo();
|
||||
}
|
||||
|
||||
static public void UpdateAfterRegisterUpdate()
|
||||
|
|
@ -129,4 +129,4 @@ namespace Cosmos.Debug.GDB {
|
|||
mVisibleWindows.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue