dbgbase.pas 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. {
  2. Copyright (c) 2003-2004 by Peter Vreman and Florian Klaempfl
  3. This units contains support for debug info generation
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit dbgbase;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. systems,
  22. symdef,symtype,
  23. symsym,
  24. aasmtai;
  25. type
  26. TDebugInfo=class
  27. constructor Create;virtual;
  28. procedure inserttypeinfo;virtual;
  29. procedure insertmoduleinfo;virtual;
  30. procedure insertlineinfo(list:taasmoutput);virtual;
  31. procedure referencesections(list:taasmoutput);virtual;
  32. end;
  33. TDebugInfoClass=class of TDebugInfo;
  34. var
  35. CDebugInfo : array[tdbg] of TDebugInfoClass;
  36. DebugInfo : TDebugInfo;
  37. procedure InitDebugInfo;
  38. procedure DoneDebugInfo;
  39. procedure RegisterDebugInfo(const r:tdbginfo;c:TDebugInfoClass);
  40. implementation
  41. uses
  42. verbose;
  43. constructor tdebuginfo.Create;
  44. begin
  45. end;
  46. procedure tdebuginfo.insertmoduleinfo;
  47. begin
  48. end;
  49. procedure tdebuginfo.inserttypeinfo;
  50. begin
  51. end;
  52. procedure tdebuginfo.insertlineinfo(list:taasmoutput);
  53. begin
  54. end;
  55. procedure tdebuginfo.referencesections(list:taasmoutput);
  56. begin
  57. end;
  58. procedure InitDebugInfo;
  59. begin
  60. if not assigned(CDebugInfo[target_dbg.id]) then
  61. begin
  62. Comment(V_Fatal,'cg_f_debuginfo_output_not_supported');
  63. exit;
  64. end;
  65. DebugInfo:=CDebugInfo[target_dbg.id].Create;
  66. end;
  67. procedure DoneDebugInfo;
  68. begin
  69. if assigned(DebugInfo) then
  70. begin
  71. DebugInfo.Free;
  72. DebugInfo:=nil;
  73. end;
  74. end;
  75. procedure RegisterDebugInfo(const r:tdbginfo;c:TDebugInfoClass);
  76. var
  77. t : tdbg;
  78. begin
  79. t:=r.id;
  80. if assigned(dbginfos[t]) then
  81. writeln('Warning: DebugInfo is already registered!')
  82. else
  83. Getmem(dbginfos[t],sizeof(tdbginfo));
  84. dbginfos[t]^:=r;
  85. CDebugInfo[t]:=c;
  86. end;
  87. const
  88. dbg_none_info : tdbginfo =
  89. (
  90. id : dbg_none;
  91. idtxt : 'NONE';
  92. );
  93. initialization
  94. RegisterDebugInfo(dbg_none_info,tdebuginfo);
  95. end.