testgdb.pp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {
  2. Copyright (c) 1998 by Peter Vreman
  3. Small example program to the GDB
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. program testgdb;
  11. uses
  12. {$ifdef USE_MINGW_GDB}
  13. mingw,
  14. {$endif}
  15. gdbcon;
  16. var
  17. last,s,parafile : string;
  18. gdb : tgdbcontroller;
  19. begin
  20. gdb.init;
  21. if paramcount=1 then
  22. parafile:=paramstr(1)
  23. else
  24. parafile:='test';
  25. gdb.loadfile(parafile);
  26. Writeln('Welcome to the pascal GDB...');
  27. Writeln('Type "q" to exit...');
  28. last:='';
  29. repeat
  30. write('>');
  31. readln(s);
  32. if (s='a') then
  33. gdb.starttrace
  34. else
  35. if (s='s') then
  36. gdb.tracestep
  37. else
  38. if (s='n') then
  39. gdb.tracenext
  40. else
  41. if (s='q') then
  42. break
  43. else
  44. begin
  45. if s='' then
  46. s:=last;
  47. GDB.Command(s);
  48. GDB.WriteErrorBuf;
  49. GDB.WriteOutputBuf;
  50. last:=s;
  51. end;
  52. until false;
  53. gdb.done;
  54. Writeln('End of pascal GDB...');
  55. end.