testgdb.pp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 gdbcon;
  12. var
  13. last,s,parafile : string;
  14. gdb : tgdbcontroller;
  15. begin
  16. gdb.init;
  17. if paramcount=1 then
  18. parafile:=paramstr(1)
  19. else
  20. parafile:='test';
  21. gdb.loadfile(parafile);
  22. Writeln('Welcome to the pascal GDB...');
  23. Writeln('Type "q" to exit...');
  24. last:='';
  25. repeat
  26. write('>');
  27. readln(s);
  28. if (s='a') then
  29. gdb.starttrace
  30. else
  31. if (s='s') then
  32. gdb.tracestep
  33. else
  34. if (s='n') then
  35. gdb.tracenext
  36. else
  37. if (s='q') then
  38. break
  39. else
  40. begin
  41. if s='' then
  42. s:=last;
  43. GDB.Command(s);
  44. GDB.WriteErrorBuf;
  45. GDB.WriteOutputBuf;
  46. last:=s;
  47. end;
  48. until false;
  49. gdb.done;
  50. Writeln('End of pascal GDB...');
  51. end.