Added new .dbg.info section to the compiler for helping counting
authorDavid Anderson <dvander@alliedmods.net>
Tue Aug 01 23:17:13 2006 +0000 (2006-08-01)
changeset 46c58663b972fe
parent 45 c4d89a7e0bfb
child 47 50d5e52ded7e
Added new .dbg.info section to the compiler for helping counting
sourcepawn/compiler/pawncc.c
sourcepawn/include/sp_file_headers.h
     1.1 --- a/sourcepawn/compiler/pawncc.c	Tue Aug 01 19:49:33 2006 +0000
     1.2 +++ b/sourcepawn/compiler/pawncc.c	Tue Aug 01 23:17:13 2006 +0000
     1.3 @@ -24,6 +24,7 @@
     1.4  	FS_DbgAutomaton,
     1.5  	FS_DbgState,
     1.6  	FS_DbgStrings,
     1.7 +	FS_DbgInfo,
     1.8  	/* --- */
     1.9  	FS_Number,
    1.10  };
    1.11 @@ -113,7 +114,9 @@
    1.12  					spfw_add_section(spf, ".dbg.symbols");
    1.13  					sections[FS_DbgSymbol] = dbg->symbols;
    1.14  				}
    1.15 +				sections[FS_DbgInfo] = 1;
    1.16  				sections[FS_DbgStrings] = 1;
    1.17 +				spfw_add_section(spf, ".dbg.info");
    1.18  				spfw_add_section(spf, ".dbg.strings");
    1.19  			}
    1.20  		}
    1.21 @@ -266,6 +269,10 @@
    1.22  
    1.23  		if (hdr->flags & AMX_FLAG_DEBUG)
    1.24  		{
    1.25 +			sp_fdbg_info_t info;
    1.26 +
    1.27 +			memset(&info, 0, sizeof(sp_fdbg_info_t));
    1.28 +
    1.29  			if (sections[FS_DbgFile])
    1.30  			{
    1.31  				uint32_t idx;
    1.32 @@ -284,6 +291,7 @@
    1.33  					/* write to tab, then move to next */
    1.34  					memfile_write(dbgtab, _ptr->name, len + 1);
    1.35  					dbgptr += sizeof(AMX_DBG_FILE) + len;
    1.36 +					info.num_files++;
    1.37  				}
    1.38  				spfw_next_section(spf);
    1.39  			}
    1.40 @@ -303,6 +311,7 @@
    1.41  					sfwrite(&dbgline, sizeof(sp_fdbg_line_t), 1, spf);
    1.42  					/* move to next */
    1.43  					dbgptr += sizeof(AMX_DBG_LINE);
    1.44 +					info.num_lines++;
    1.45  				}
    1.46  				spfw_next_section(spf);
    1.47  			}
    1.48 @@ -337,6 +346,7 @@
    1.49  					/* move to next */
    1.50  					dbgptr += sizeof(AMX_DBG_SYMBOL) + len;
    1.51  					/* look for any dimensions */
    1.52 +					info.num_syms++;
    1.53  					for (dnum=0; dnum<dbgsym.dimcount; dnum++)
    1.54  					{
    1.55  						/* get entry info */
    1.56 @@ -347,11 +357,15 @@
    1.57  						sfwrite(&dbgdim, sizeof(sp_fdbg_arraydim_t), 1, spf);
    1.58  						/* move to next */
    1.59  						dbgptr += sizeof(AMX_DBG_SYMDIM);
    1.60 +						info.num_arrays++;
    1.61  					}
    1.62  				}
    1.63  				spfw_next_section(spf);
    1.64  			}
    1.65  
    1.66 +			sfwrite(&info, sizeof(sp_fdbg_info_t), 1, spf);
    1.67 +			spfw_next_section(spf);
    1.68 +
    1.69  			if (sections[FS_DbgStrings])
    1.70  			{
    1.71  				sfwrite(dbgtab->base, sizeof(char), dbgtab->usedoffs, spf);
     2.1 --- a/sourcepawn/include/sp_file_headers.h	Tue Aug 01 19:49:33 2006 +0000
     2.2 +++ b/sourcepawn/include/sp_file_headers.h	Tue Aug 01 23:17:13 2006 +0000
     2.3 @@ -108,6 +108,14 @@
     2.4  	#pragma pack(pop) /* reset previous packing */
     2.5  #endif
     2.6  
     2.7 +typedef struct sp_fdbg_info_s
     2.8 +{
     2.9 +	uint32_t	num_files;	/* number of files */
    2.10 +	uint32_t	num_lines;	/* number of lines */
    2.11 +	uint32_t	num_syms;	/* number of symbols */
    2.12 +	uint32_t	num_arrays;	/* number of symbols which are arrays */
    2.13 +} sp_fdbg_info_t;
    2.14 +
    2.15  /**
    2.16   * Debug information structures
    2.17   */