Patch #2225 2007-11-04 10:19

jenslody

makes gdb stop at first instruction in main on linux
Download
2225-makes_gdb_stop.patch (1.5 KB)
Category
Plugin::Bugfix
Status
Accepted
Close date
2007-11-05 08:49
Assigned to
 
--- cb-orig/src/plugins/debuggergdb/gdb_driver.cpp      2007-10-27 21:29:40.000000000 +0200
+++ cb-patch/src/plugins/debuggergdb/gdb_driver.cpp     2007-10-28 04:02:19.000000000 +0100
@@ -456,7 +456,16 @@
         if (!Manager::Get()->GetConfigManager(_T("debugger"))->ReadBool(_T("do_not_run"), false))
         {
             // start the process
-            QueueCommand(new DebuggerCmd(this, remoteDebugging ? _T("continue") : _T("start")));
+            if(breakOnEntry)
+            {
+                QueueCommand(new DebuggerCmd(this, remoteDebugging ? _T("continue") : _T("start")));
+            }
+            else
+            {
+                // if breakOnEntry is not set, we need to use 'run' to make gdb stop at a breakpoint at first instruction
+                m_ManualBreakOnEntry=false;  // must be reset or gdb does not stop at first breakpoint
+                QueueCommand(new DebuggerCmd(this, remoteDebugging ? _T("continue") : _T("run")));
+            }
             m_IsStarted = true;
         }
     }
@@ -971,13 +980,15 @@
     {
         if (m_ManualBreakOnEntry)
         {
-            m_ManualBreakOnEntry = false;
             QueueCommand(new GdbCmd_InfoProgram(this), DebuggerDriver::High);
-            if (!m_BreakOnEntry)
-                Continue();
+        }
+        if (m_ManualBreakOnEntry && !m_BreakOnEntry)
+        {
+            Continue();
         }
         else
         {
+            m_ManualBreakOnEntry = false;
             wxString lineStr;
             if(platform::windows)
             {
jenslody 2007-11-04 10:26

If a breakpoint is set at first instruction, gdb does not stop there on Linux (and maybe other ports except on windows), and if stepped into main the cursor does not change its appearence.

Both is fixed by this patch.

The first was reported as "sub-bug" of #11049 (called bug 2).