Added new .dbg.info section to the compiler for helping counting
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4051
This commit is contained in:
parent
a9b3da5904
commit
c23a23fb34
@ -24,6 +24,7 @@ enum FileSections
|
|||||||
FS_DbgAutomaton,
|
FS_DbgAutomaton,
|
||||||
FS_DbgState,
|
FS_DbgState,
|
||||||
FS_DbgStrings,
|
FS_DbgStrings,
|
||||||
|
FS_DbgInfo,
|
||||||
/* --- */
|
/* --- */
|
||||||
FS_Number,
|
FS_Number,
|
||||||
};
|
};
|
||||||
@ -113,7 +114,9 @@ int main(int argc, char *argv[])
|
|||||||
spfw_add_section(spf, ".dbg.symbols");
|
spfw_add_section(spf, ".dbg.symbols");
|
||||||
sections[FS_DbgSymbol] = dbg->symbols;
|
sections[FS_DbgSymbol] = dbg->symbols;
|
||||||
}
|
}
|
||||||
|
sections[FS_DbgInfo] = 1;
|
||||||
sections[FS_DbgStrings] = 1;
|
sections[FS_DbgStrings] = 1;
|
||||||
|
spfw_add_section(spf, ".dbg.info");
|
||||||
spfw_add_section(spf, ".dbg.strings");
|
spfw_add_section(spf, ".dbg.strings");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,6 +269,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (hdr->flags & AMX_FLAG_DEBUG)
|
if (hdr->flags & AMX_FLAG_DEBUG)
|
||||||
{
|
{
|
||||||
|
sp_fdbg_info_t info;
|
||||||
|
|
||||||
|
memset(&info, 0, sizeof(sp_fdbg_info_t));
|
||||||
|
|
||||||
if (sections[FS_DbgFile])
|
if (sections[FS_DbgFile])
|
||||||
{
|
{
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
@ -284,6 +291,7 @@ int main(int argc, char *argv[])
|
|||||||
/* write to tab, then move to next */
|
/* write to tab, then move to next */
|
||||||
memfile_write(dbgtab, _ptr->name, len + 1);
|
memfile_write(dbgtab, _ptr->name, len + 1);
|
||||||
dbgptr += sizeof(AMX_DBG_FILE) + len;
|
dbgptr += sizeof(AMX_DBG_FILE) + len;
|
||||||
|
info.num_files++;
|
||||||
}
|
}
|
||||||
spfw_next_section(spf);
|
spfw_next_section(spf);
|
||||||
}
|
}
|
||||||
@ -303,6 +311,7 @@ int main(int argc, char *argv[])
|
|||||||
sfwrite(&dbgline, sizeof(sp_fdbg_line_t), 1, spf);
|
sfwrite(&dbgline, sizeof(sp_fdbg_line_t), 1, spf);
|
||||||
/* move to next */
|
/* move to next */
|
||||||
dbgptr += sizeof(AMX_DBG_LINE);
|
dbgptr += sizeof(AMX_DBG_LINE);
|
||||||
|
info.num_lines++;
|
||||||
}
|
}
|
||||||
spfw_next_section(spf);
|
spfw_next_section(spf);
|
||||||
}
|
}
|
||||||
@ -337,6 +346,7 @@ int main(int argc, char *argv[])
|
|||||||
/* move to next */
|
/* move to next */
|
||||||
dbgptr += sizeof(AMX_DBG_SYMBOL) + len;
|
dbgptr += sizeof(AMX_DBG_SYMBOL) + len;
|
||||||
/* look for any dimensions */
|
/* look for any dimensions */
|
||||||
|
info.num_syms++;
|
||||||
for (dnum=0; dnum<dbgsym.dimcount; dnum++)
|
for (dnum=0; dnum<dbgsym.dimcount; dnum++)
|
||||||
{
|
{
|
||||||
/* get entry info */
|
/* get entry info */
|
||||||
@ -347,11 +357,15 @@ int main(int argc, char *argv[])
|
|||||||
sfwrite(&dbgdim, sizeof(sp_fdbg_arraydim_t), 1, spf);
|
sfwrite(&dbgdim, sizeof(sp_fdbg_arraydim_t), 1, spf);
|
||||||
/* move to next */
|
/* move to next */
|
||||||
dbgptr += sizeof(AMX_DBG_SYMDIM);
|
dbgptr += sizeof(AMX_DBG_SYMDIM);
|
||||||
|
info.num_arrays++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spfw_next_section(spf);
|
spfw_next_section(spf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sfwrite(&info, sizeof(sp_fdbg_info_t), 1, spf);
|
||||||
|
spfw_next_section(spf);
|
||||||
|
|
||||||
if (sections[FS_DbgStrings])
|
if (sections[FS_DbgStrings])
|
||||||
{
|
{
|
||||||
sfwrite(dbgtab->base, sizeof(char), dbgtab->usedoffs, spf);
|
sfwrite(dbgtab->base, sizeof(char), dbgtab->usedoffs, spf);
|
||||||
|
@ -108,6 +108,14 @@ typedef struct sp_file_pubvars_s
|
|||||||
#pragma pack(pop) /* reset previous packing */
|
#pragma pack(pop) /* reset previous packing */
|
||||||
#endif
|
#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
|
* Debug information structures
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user