If you make dev-cpp more customizable mayby easy to
use to any uP and debugging enviroment. I put may
source changes file as attachment to this description to
more datail. I use about two years dev-cpp with gdb-
stub to write and debug Hitachi (Renesas) H8S
(H8S2390) but source wit my changes. In this time I
have prepared 4.9.8.0 to H8S. Please read attachment.
Logged In: NO
Attachment not attached :) but Comment may by working
Dev-C++ for Remote debuggig Hitachi h8s uC
Based on 4.9.7.0 version
1.Changes to correct parsing h8300-hms-gdb.exe output
1.1.debugwait.pas:In first source line TDebugWait.Analyze -
get_source_info after begin:
debugwait.pas:263:insert
if ( system.Pos('/cygdrive', s) > 0) then //rs add
s := StringReplace( s, '/cygdrive/c/','c:/',
[rfIgnoreCase]) // rs add
else //rs add
s := StringReplace( s, '\','c:\',[rfIgnoreCase]); // rs add
This replace source line path from h8300-hms-gdb to
correct for Devcpp
2.Increase Sleep() values to add time to communicate gdb
and remote stub via rs232
2.1. Refresh CPU Window procedure TCPUForm.rbSyntaxClick
(Sender: TObject);
CPUFrm.pas:94:change | sleep(20); | sleep(200);
2.2 Watch variable in Hint: TEditor.EditorHintTimer
Editor.pas:1089:change | Sleep(25); | Sleep(250);
3.Changes in CPUFrm.dfm and version.pas : rename
registers names and ...
version.pas:7:change | DEVCPP = 'Dev-C++'; |
DEVCPP = 'Dev-C++ h8s';
version.pas:8:change | DEVCPP_VERSION = '4.9.7.0';
| DEVCPP_VERSION = '4.9.7.0 rs 1.04 z 18.12.2002';
version.pas:18:change | DEV_MAKE_FILE
= 'Makefile.win';|DEV_MAKE_FILE = 'Makefile.h8s';
version.pas:49:change | EXE_EXT = '.exe'; |
EXE_EXT = '.out';|
version.pas:50:change | DEV_EXT = '.dev'; |
DEV_EXT = '.de8';
version.pas:86:change | FLT_PROJECTS = 'dev-c++ project
(.dev)|.dev'; | FLT_PROJECTS = 'dev-c++ project (.de8)
|.de8';
version.pas:142:change | GDB_EAX = '$eax'; |
GDB_EAX = '$er0';
version.pas:143:change | GDB_EBX = '$ebx'; |
GDB_EBX = '$er1';
version.pas:144:change | GDB_ECX = '$ecx'; |
GDB_ECX = '$er2';
version.pas:145:change | GDB_EDX = '$edx'; |
GDB_EDX = '$er3';
version.pas:146:change | GDB_ESI = '$esi'; |
GDB_ESI = '$er4';
version.pas:147:change | GDB_EDI = '$edi'; |
GDB_EDI = '$er5';
version.pas:148:change | GDB_EBP = '$ebp'; |
GDB_EBP = '$er6';
version.pas:149:change | GDB_ESP = '$esp'; |
GDB_ESP = '$sp';
version.pas:150:change | GDB_EIP = '$eip'; |
GDB_EIP = '$ccr';
version.pas:151:change | GDB_CS = '$cs'; |
GDB_CS = '$pc';
version.pas:152:change | GDB_DS = '$ds'; |
GDB_DS = '$pc';
version.pas:153:change | GDB_SS = '$ss'; |
GDB_SS = '$pc';
version.pas:154:change | GDB_ES = '$es'; |
GDB_ES = '$pc';
version.pas:124:change | GDB_FILE = 'file'; |
GDB_FILE = '_file';
version.pas:126:change | GDB_RUN = 'run'; |
GDB_RUN = '_run';
version.pas:155:change | GDB_SETARGS = 'set
args';| GDB_SETARGS = '_set_args';
main.pas.4775:change | Sleep(200); ... | Sleep(400); ...
4.Add more buttons (and commands) do debug on gdb
4.1 Insert at end procedure TDebugger.CloseDebugger
(Sender: TObject);
To change description of button to debug
debugger.pas:266:add |
MainForm.DDebugBtn.Caption := 'Debuguj'; // rs add
MainForm.GdbBusyLbl.Caption := 'Gdb no load'; // rs add
4.2 Insert at begin procedure TMainForm.actDebugExecute
(Sender: TObject);
main.pas:3429:add
if fDebugger.Executing then begin //rs add
fDebugger.CloseDebugger(sender); //rs add
exit; //rs add
end; //rs add
SetCurrentDir(fProject.Directory); //rs add
DDebugBtn.Caption := 'Zakończ'; // rs add
4.3 Insert at begin procedure TDebugger.SendCommand
(command, params : string);
To show last command send to gdb
debugger.pas:277:add |
MainForm.edtLastGdbCommand.Text := command + ' '+
params;
debugger.pas:277:add |
MainForm.GdbBusyLbl.Caption := 'Gdb busy';
4.4 main.pas:5451:add
procedure TMainForm.DebugResetBtnClick(Sender: TObject);
begin
if fDebugger.Executing then begin //rs add
fDebugger.SendCommand('reset', ''); //rs add
end;
end;
procedure TMainForm.DebugUntilReturnBtnClick(Sender:
TObject);
begin
if fDebugger.Executing then begin //rs add
fDebugger.SendCommand('finish', ''); //rs add
end;
end;
procedure TMainForm.DebugUntilBtnClick(Sender: TObject);
begin
if fDebugger.Executing then begin //rs add
fDebugger.SendCommand('until', ''); //rs add
end;
end;
procedure TMainForm.DebugReloadBtnClick(Sender:
TObject);
begin
if fDebugger.Executing then begin //rs add
fDebugger.SendCommand('ld', ''); //rs add
end;
end;
4.5 Add GdbBusyLbl
4.6 Add edtLastGdbCommand
4.7 Change Shortcuts to Debug-> ActionList an Execute
4.8 Change registers Labels in CPU Window Form
4.9 debugwait.pas:82:add
while (system.pos(#10#10, debugstr) <> 0) do
Delete(debugstr, system.pos(#10#10, debugstr), 2);
debugwait.pas:126:add
if s = T_PROMPT then
begin
MainForm.GdbBusyLbl.Caption := 'Gdb ready'; // rs add
result := TPrompt;
end
5.0 LangIDs.inc:200:add
ID_ITEM_DEBUG_RESET = 5001;
ID_ITEM_DEBUG_FINISH = 5002;
ID_ITEM_DEBUG_UNTIL = 5003;
ID_ITEM_DEBUG_RELOAD = 5004;
main.pas:1571:add
actReset.Caption:= Strings[ID_ITEM_DEBUG_RESET];
actFinish.Caption:= Strings[ID_ITEM_DEBUG_FINISH];
actUntil.Caption:= Strings[ID_ITEM_DEBUG_UNTIL];
actReload.Caption:= Strings
[ID_ITEM_DEBUG_RELOAD];
6.1 English.lng:148:Add
5001=&Reset
5002=&Until return
5003=Next &Line
5004=&Reload
6.2 Polish.lng:
248=K&ontynuuj
254=&Wskocz do
5001=&Reset
5002=D&okończ
5003=N&astepna Linia
5004=&Przeładuj
778=Inne optymalizacje
927=Dodaj bibliotekę lub obj
992=Ust. kompilatora
debuger.pas:353:change from:
SendCommand(GDB_DELETE, inttostr(I+1));
to
SendCommand('clear', TGdbBreakpoint(BreakList
[I]).editor.TabSheet.Caption + ':' + inttostr(TGdbBreakpoint
(BreakList[I]).line));
6.3 editor.pas:1368:add:procedure RunToCursor
if MainForm.fDebugger.Executing then begin
MAinForm.RemoveActiveBreakpoints;
MainForm.fDebugger.SendCommand(GDB_CONTINUE, '');
end;
6.4
main.pas:3959:add
procedure TMainForm.actStepOverExecute(Sender: TObject);
begin
if fDebugger.Executing then begin
RemoveActiveBreakpoints;
fDebugger.SendCommand(GDB_CONTINUE, '');
end;
if not fDebugger.Executing then begin
actCompRunExecute(self);
end;
end;
-Remove disabling Continue ,SingleStep,NextStep if no
debugging
( Remove OnUpdate Event from
ActStepOver,SingleStep,NextStep Action)
6.5 Change StopExecution -> Ctrl+F2 and
GoToProjectManager -> Alt+Ctrl+F2 in Menu (noAction)
6.6 Comment main.pas:3372:actCompileExecute to not
delete out file
// if fCompiler.Target = ctProject then
// DeleteFile(fProject.Executable);
6.7 -add to uses main and
compiler.pas:644:add and comment
else begin // execute normally
if devData.MinOnRun then
Application.Minimize;
MainForm.actDebugExecute(self);
// devExecutor.ExecuteAndWatch(fProject.Executable,
fRunParams,
// ExtractFileDir(fProject.Executable),
True, INFINITE, RunTerminate);
6.8 - change main.pas:3902
procedure TMainForm.actNextStepExecute(Sender: TObject);
begin
if fDebugger.Executing then begin
fDebugger.SendCommand(GDB_NEXT, '');
end;
if not fDebugger.Executing then begin
actCompRunExecute(self);
end;
end;
procedure TMainForm.actStepSingleExecute(Sender:
TObject);
begin
if fDebugger.Executing then begin
fDebugger.SendCommand(GDB_STEP, '');
end;
if not fDebugger.Executing then begin
actCompRunExecute(self);
end;
end;
7.0 compiler.pas:276:change. Correct Problem with best
dependencies
from for i := 0 to Lines.Count - 1 do
to
for i := 0 to Lines.Count - 2 do
8.0 compiler.pas:1022:add. Corect error with parse compiler
errors
or //rs
(Pos('undeclared', Line) > 0) then //rs
begin
O_file := Copy(Line, 1, Pos(':',Line)-1); //rs
Delete(Line, 1, Pos(':',Line)); //rs
O_line := Copy(Line, 1, Pos(':',Line)-1); //rs
Delete(Line, 1, Pos(':',Line)); //rs
O_Msg := Line; //rs
//rs Delete(Line, cpos - 2, Length(Line) - cpos + 3);
//rs cpos := GetLastPos(': ', Line);
//rs O_Msg := Copy(Line, cpos + 2, Length(Line) -
cpos) +
//rs ': No such file or directory.';
//rs Delete(Line, cpos, Length(Line) - cpos + 2);
//rs cpos := GetLastPos(':', Line);
//rs O_Line := Copy(Line, cpos + 1, Length(Line) -
cpos);
//rs Delete(Line, cpos, Length(Line) - cpos + 1);
//rs O_file := Line;
Logged In: NO
Attachment not attached :) but Comment may by working
Dev-C++ for Remote debuggig Hitachi h8s uC
Based on 4.9.7.0 version
1.Changes to correct parsing h8300-hms-gdb.exe output
1.1.debugwait.pas:In first source line TDebugWait.Analyze -
get_source_info after begin:
debugwait.pas:263:insert
if ( system.Pos('/cygdrive', s) > 0) then //rs add
s := StringReplace( s, '/cygdrive/c/','c:/',
[rfIgnoreCase]) // rs add
else //rs add
s := StringReplace( s, '\','c:\',[rfIgnoreCase]); // rs add
This replace source line path from h8300-hms-gdb to
correct for Devcpp
2.Increase Sleep() values to add time to communicate gdb
and remote stub via rs232
2.1. Refresh CPU Window procedure TCPUForm.rbSyntaxClick
(Sender: TObject);
CPUFrm.pas:94:change | sleep(20); | sleep(200);
2.2 Watch variable in Hint: TEditor.EditorHintTimer
Editor.pas:1089:change | Sleep(25); | Sleep(250);
3.Changes in CPUFrm.dfm and version.pas : rename
registers names and ...
version.pas:7:change | DEVCPP = 'Dev-C++'; |
DEVCPP = 'Dev-C++ h8s';
version.pas:8:change | DEVCPP_VERSION = '4.9.7.0';
| DEVCPP_VERSION = '4.9.7.0 rs 1.04 z 18.12.2002';
version.pas:18:change | DEV_MAKE_FILE
= 'Makefile.win';|DEV_MAKE_FILE = 'Makefile.h8s';
version.pas:49:change | EXE_EXT = '.exe'; |
EXE_EXT = '.out';|
version.pas:50:change | DEV_EXT = '.dev'; |
DEV_EXT = '.de8';
version.pas:86:change | FLT_PROJECTS = 'dev-c++ project
(.dev)|.dev'; | FLT_PROJECTS = 'dev-c++ project (.de8)
|.de8';
version.pas:142:change | GDB_EAX = '$eax'; |
GDB_EAX = '$er0';
version.pas:143:change | GDB_EBX = '$ebx'; |
GDB_EBX = '$er1';
version.pas:144:change | GDB_ECX = '$ecx'; |
GDB_ECX = '$er2';
version.pas:145:change | GDB_EDX = '$edx'; |
GDB_EDX = '$er3';
version.pas:146:change | GDB_ESI = '$esi'; |
GDB_ESI = '$er4';
version.pas:147:change | GDB_EDI = '$edi'; |
GDB_EDI = '$er5';
version.pas:148:change | GDB_EBP = '$ebp'; |
GDB_EBP = '$er6';
version.pas:149:change | GDB_ESP = '$esp'; |
GDB_ESP = '$sp';
version.pas:150:change | GDB_EIP = '$eip'; |
GDB_EIP = '$ccr';
version.pas:151:change | GDB_CS = '$cs'; |
GDB_CS = '$pc';
version.pas:152:change | GDB_DS = '$ds'; |
GDB_DS = '$pc';
version.pas:153:change | GDB_SS = '$ss'; |
GDB_SS = '$pc';
version.pas:154:change | GDB_ES = '$es'; |
GDB_ES = '$pc';
version.pas:124:change | GDB_FILE = 'file'; |
GDB_FILE = '_file';
version.pas:126:change | GDB_RUN = 'run'; |
GDB_RUN = '_run';
version.pas:155:change | GDB_SETARGS = 'set
args';| GDB_SETARGS = '_set_args';
main.pas.4775:change | Sleep(200); ... | Sleep(400); ...
4.Add more buttons (and commands) do debug on gdb
4.1 Insert at end procedure TDebugger.CloseDebugger
(Sender: TObject);
To change description of button to debug
debugger.pas:266:add |
MainForm.DDebugBtn.Caption := 'Debuguj'; // rs add
MainForm.GdbBusyLbl.Caption := 'Gdb no load'; // rs add
4.2 Insert at begin procedure TMainForm.actDebugExecute
(Sender: TObject);
main.pas:3429:add
if fDebugger.Executing then begin //rs add
fDebugger.CloseDebugger(sender); //rs add
exit; //rs add
end; //rs add
SetCurrentDir(fProject.Directory); //rs add
DDebugBtn.Caption := 'Zakończ'; // rs add
4.3 Insert at begin procedure TDebugger.SendCommand
(command, params : string);
To show last command send to gdb
debugger.pas:277:add |
MainForm.edtLastGdbCommand.Text := command + ' '+
params;
debugger.pas:277:add |
MainForm.GdbBusyLbl.Caption := 'Gdb busy';
4.4 main.pas:5451:add
procedure TMainForm.DebugResetBtnClick(Sender: TObject);
begin
if fDebugger.Executing then begin //rs add
fDebugger.SendCommand('reset', ''); //rs add
end;
end;
procedure TMainForm.DebugUntilReturnBtnClick(Sender:
TObject);
begin
if fDebugger.Executing then begin //rs add
fDebugger.SendCommand('finish', ''); //rs add
end;
end;
procedure TMainForm.DebugUntilBtnClick(Sender: TObject);
begin
if fDebugger.Executing then begin //rs add
fDebugger.SendCommand('until', ''); //rs add
end;
end;
procedure TMainForm.DebugReloadBtnClick(Sender:
TObject);
begin
if fDebugger.Executing then begin //rs add
fDebugger.SendCommand('ld', ''); //rs add
end;
end;
4.5 Add GdbBusyLbl
4.6 Add edtLastGdbCommand
4.7 Change Shortcuts to Debug-> ActionList an Execute
4.8 Change registers Labels in CPU Window Form
4.9 debugwait.pas:82:add
while (system.pos(#10#10, debugstr) <> 0) do
Delete(debugstr, system.pos(#10#10, debugstr), 2);
debugwait.pas:126:add
if s = T_PROMPT then
begin
MainForm.GdbBusyLbl.Caption := 'Gdb ready'; // rs add
result := TPrompt;
end
5.0 LangIDs.inc:200:add
ID_ITEM_DEBUG_RESET = 5001;
ID_ITEM_DEBUG_FINISH = 5002;
ID_ITEM_DEBUG_UNTIL = 5003;
ID_ITEM_DEBUG_RELOAD = 5004;
main.pas:1571:add
actReset.Caption:= Strings[ID_ITEM_DEBUG_RESET];
actFinish.Caption:= Strings[ID_ITEM_DEBUG_FINISH];
actUntil.Caption:= Strings[ID_ITEM_DEBUG_UNTIL];
actReload.Caption:= Strings
[ID_ITEM_DEBUG_RELOAD];
6.1 English.lng:148:Add
5001=&Reset
5002=&Until return
5003=Next &Line
5004=&Reload
6.2 Polish.lng:
248=K&ontynuuj
254=&Wskocz do
5001=&Reset
5002=D&okończ
5003=N&astepna Linia
5004=&Przeładuj
778=Inne optymalizacje
927=Dodaj bibliotekę lub obj
992=Ust. kompilatora
debuger.pas:353:change from:
SendCommand(GDB_DELETE, inttostr(I+1));
to
SendCommand('clear', TGdbBreakpoint(BreakList
[I]).editor.TabSheet.Caption + ':' + inttostr(TGdbBreakpoint
(BreakList[I]).line));
6.3 editor.pas:1368:add:procedure RunToCursor
if MainForm.fDebugger.Executing then begin
MAinForm.RemoveActiveBreakpoints;
MainForm.fDebugger.SendCommand(GDB_CONTINUE, '');
end;
6.4
main.pas:3959:add
procedure TMainForm.actStepOverExecute(Sender: TObject);
begin
if fDebugger.Executing then begin
RemoveActiveBreakpoints;
fDebugger.SendCommand(GDB_CONTINUE, '');
end;
if not fDebugger.Executing then begin
actCompRunExecute(self);
end;
end;
-Remove disabling Continue ,SingleStep,NextStep if no
debugging
( Remove OnUpdate Event from
ActStepOver,SingleStep,NextStep Action)
6.5 Change StopExecution -> Ctrl+F2 and
GoToProjectManager -> Alt+Ctrl+F2 in Menu (noAction)
6.6 Comment main.pas:3372:actCompileExecute to not
delete out file
// if fCompiler.Target = ctProject then
// DeleteFile(fProject.Executable);
6.7 -add to uses main and
compiler.pas:644:add and comment
else begin // execute normally
if devData.MinOnRun then
Application.Minimize;
MainForm.actDebugExecute(self);
// devExecutor.ExecuteAndWatch(fProject.Executable,
fRunParams,
// ExtractFileDir(fProject.Executable),
True, INFINITE, RunTerminate);
6.8 - change main.pas:3902
procedure TMainForm.actNextStepExecute(Sender: TObject);
begin
if fDebugger.Executing then begin
fDebugger.SendCommand(GDB_NEXT, '');
end;
if not fDebugger.Executing then begin
actCompRunExecute(self);
end;
end;
procedure TMainForm.actStepSingleExecute(Sender:
TObject);
begin
if fDebugger.Executing then begin
fDebugger.SendCommand(GDB_STEP, '');
end;
if not fDebugger.Executing then begin
actCompRunExecute(self);
end;
end;
7.0 compiler.pas:276:change. Correct Problem with best
dependencies
from for i := 0 to Lines.Count - 1 do
to
for i := 0 to Lines.Count - 2 do
8.0 compiler.pas:1022:add. Corect error with parse compiler
errors
or //rs
(Pos('undeclared', Line) > 0) then //rs
begin
O_file := Copy(Line, 1, Pos(':',Line)-1); //rs
Delete(Line, 1, Pos(':',Line)); //rs
O_line := Copy(Line, 1, Pos(':',Line)-1); //rs
Delete(Line, 1, Pos(':',Line)); //rs
O_Msg := Line; //rs
//rs Delete(Line, cpos - 2, Length(Line) - cpos + 3);
//rs cpos := GetLastPos(': ', Line);
//rs O_Msg := Copy(Line, cpos + 2, Length(Line) -
cpos) +
//rs ': No such file or directory.';
//rs Delete(Line, cpos, Length(Line) - cpos + 2);
//rs cpos := GetLastPos(':', Line);
//rs O_Line := Copy(Line, cpos + 1, Length(Line) -
cpos);
//rs Delete(Line, cpos, Length(Line) - cpos + 1);
//rs O_file := Line;