mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
ide: GDB now supports breaking the process in Win32
git-svn-id: svn://ultimatepp.org/upp/trunk@12017 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
cf1fd931c7
commit
f7ab65cd67
2 changed files with 34 additions and 5 deletions
|
|
@ -152,6 +152,10 @@ public:
|
|||
String autoline;
|
||||
bool firstrun;
|
||||
|
||||
int pid = 0; // debugee pid
|
||||
|
||||
String DoRun();
|
||||
|
||||
bool Result(String& result, const String& s);
|
||||
|
||||
void AddReg(const char *reg, Label *lbl) { regname.Add(reg); reglbl.Add(lbl); }
|
||||
|
|
@ -205,6 +209,8 @@ public:
|
|||
void CopyStack();
|
||||
void CopyStackAll();
|
||||
void CopyDisas();
|
||||
|
||||
void BreakRunning();
|
||||
|
||||
bool Create(One<Host>&& host, const String& exefile, const String& cmdline, bool console);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ void Gdb::DebugBar(Bar& bar)
|
|||
bar.Add(b, AK_RUNTO, DbgImg::RunTo(), THISBACK(DoRunTo));
|
||||
bar.Add(b, AK_RUN, DbgImg::Run(), THISBACK(Run));
|
||||
// bar.Add(b, AK_SETIP, DbgImg::SetIp(), THISBACK(SetIp));
|
||||
// bar.Add(!b, AK_STOP, DbgImg::Stop(), THISBACK(BreakRunning));
|
||||
bar.Add(!b && pid, AK_BREAK, DbgImg::Stop(), THISBACK(BreakRunning));
|
||||
bar.MenuSeparator();
|
||||
bar.Add(b, AK_AUTOS, THISBACK1(SetTab, 0));
|
||||
bar.Add(b, AK_LOCALS, THISBACK1(SetTab, 1));
|
||||
|
|
@ -276,6 +276,19 @@ String Gdb::Cmdp(const char *cmdline, bool fr)
|
|||
return s;
|
||||
}
|
||||
|
||||
String Gdb::DoRun()
|
||||
{
|
||||
if(firstrun) {
|
||||
firstrun = false;
|
||||
Cmd("start");
|
||||
String s = Cmd("info inferior");
|
||||
int q = s.FindAfter("process");
|
||||
pid = atoi(~s + q);
|
||||
IdeSetBar();
|
||||
}
|
||||
return Cmdp("continue");
|
||||
}
|
||||
|
||||
bool Gdb::RunTo()
|
||||
{
|
||||
if(IdeIsDebugLock())
|
||||
|
|
@ -293,8 +306,7 @@ bool Gdb::RunTo()
|
|||
Exclamation("No code at chosen location !");
|
||||
return false;
|
||||
}
|
||||
String e = Cmdp(firstrun ? "run" : "continue");
|
||||
firstrun = false;
|
||||
String e = DoRun();
|
||||
FastCmd("clear " + bi);
|
||||
if(df)
|
||||
disas.SetFocus();
|
||||
|
|
@ -303,12 +315,23 @@ bool Gdb::RunTo()
|
|||
return true;
|
||||
}
|
||||
|
||||
void Gdb::BreakRunning()
|
||||
{
|
||||
#ifdef PLATFORM_WIN32
|
||||
HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
|
||||
if(h) {
|
||||
DebugBreakProcess(h);
|
||||
CloseHandle(h);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Gdb::Run()
|
||||
{
|
||||
if(IdeIsDebugLock())
|
||||
return;
|
||||
CheckEnd(Cmdp(firstrun ? "run" : "continue"));
|
||||
firstrun = false;
|
||||
String s = DoRun();
|
||||
CheckEnd(s);
|
||||
IdeActivateBottom();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue