From c23a23fb344a9ca75041b0b18f90c82de55fbb09 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 1 Aug 2006 23:17:13 +0000 Subject: [PATCH] Added new .dbg.info section to the compiler for helping counting --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4051 --- sourcepawn/compiler/pawncc.c | 14 ++++++++++++++ sourcepawn/include/sp_file_headers.h | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/sourcepawn/compiler/pawncc.c b/sourcepawn/compiler/pawncc.c index a64ac5aa..f9839590 100644 --- a/sourcepawn/compiler/pawncc.c +++ b/sourcepawn/compiler/pawncc.c @@ -24,6 +24,7 @@ enum FileSections FS_DbgAutomaton, FS_DbgState, FS_DbgStrings, + FS_DbgInfo, /* --- */ FS_Number, }; @@ -113,7 +114,9 @@ int main(int argc, char *argv[]) spfw_add_section(spf, ".dbg.symbols"); sections[FS_DbgSymbol] = dbg->symbols; } + sections[FS_DbgInfo] = 1; sections[FS_DbgStrings] = 1; + spfw_add_section(spf, ".dbg.info"); spfw_add_section(spf, ".dbg.strings"); } } @@ -266,6 +269,10 @@ int main(int argc, char *argv[]) if (hdr->flags & AMX_FLAG_DEBUG) { + sp_fdbg_info_t info; + + memset(&info, 0, sizeof(sp_fdbg_info_t)); + if (sections[FS_DbgFile]) { uint32_t idx; @@ -284,6 +291,7 @@ int main(int argc, char *argv[]) /* write to tab, then move to next */ memfile_write(dbgtab, _ptr->name, len + 1); dbgptr += sizeof(AMX_DBG_FILE) + len; + info.num_files++; } spfw_next_section(spf); } @@ -303,6 +311,7 @@ int main(int argc, char *argv[]) sfwrite(&dbgline, sizeof(sp_fdbg_line_t), 1, spf); /* move to next */ dbgptr += sizeof(AMX_DBG_LINE); + info.num_lines++; } spfw_next_section(spf); } @@ -337,6 +346,7 @@ int main(int argc, char *argv[]) /* move to next */ dbgptr += sizeof(AMX_DBG_SYMBOL) + len; /* look for any dimensions */ + info.num_syms++; for (dnum=0; dnumbase, sizeof(char), dbgtab->usedoffs, spf); diff --git a/sourcepawn/include/sp_file_headers.h b/sourcepawn/include/sp_file_headers.h index 9ccf4bb9..a390a653 100644 --- a/sourcepawn/include/sp_file_headers.h +++ b/sourcepawn/include/sp_file_headers.h @@ -108,6 +108,14 @@ typedef struct sp_file_pubvars_s #pragma pack(pop) /* reset previous packing */ #endif +typedef struct sp_fdbg_info_s +{ + uint32_t num_files; /* number of files */ + uint32_t num_lines; /* number of lines */ + uint32_t num_syms; /* number of symbols */ + uint32_t num_arrays; /* number of symbols which are arrays */ +} sp_fdbg_info_t; + /** * Debug information structures */