diff options
Diffstat (limited to 'src/include/usr/trace')
-rw-r--r-- | src/include/usr/trace/interface.H | 69 | ||||
-rw-r--r-- | src/include/usr/trace/trace.H | 21 |
2 files changed, 65 insertions, 25 deletions
diff --git a/src/include/usr/trace/interface.H b/src/include/usr/trace/interface.H index 3fc72646d..6b7dee2f7 100644 --- a/src/include/usr/trace/interface.H +++ b/src/include/usr/trace/interface.H @@ -84,6 +84,17 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field #define __ALL_HASH(printf_string,num) trace_adal_hash(printf_string,num),printf_string #endif +#define __TRACE_HASH_STRUCTURES(str) \ + static TRACE::traceCodeInfo __traceData_codeInfo \ + __attribute((used)) = \ + { NULL, 1 }; \ + static TRACE::traceParseInfo __traceData_parseInfo \ + __attribute((used)) = \ + { sizeof(TRACE::traceParseInfo::string), \ + sizeof(TRACE::traceParseInfo::file), 0, \ + str, __FILE__, &__traceData_codeInfo } + + /******************************************************************************/ // Macros /******************************************************************************/ @@ -123,11 +134,14 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field /* a macro w/o the param number suffix. number is calculated from printf string */ #define TRACDCOMP(des,printf_string,args...) \ + { \ + __TRACE_HASH_STRUCTURES(printf_string); \ TRACE::trace_adal_write_all((des), \ - __ALL_HASH(printf_string,-1), \ + &__traceData_codeInfo, \ __LINE__, \ TRACE_DEBUG, \ - ##args) + ##args); \ + } /** @@ -145,13 +159,17 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field * @return void */ -#define TRACDBIN(des,printf_string,address,len) \ +#define TRACDBIN(des,printf_string,address,len) \ + { \ + __TRACE_HASH_STRUCTURES(printf_string); \ TRACE::trace_adal_write_bin((des), \ - __ALL_HASH(printf_string,0), \ - __LINE__, \ - address, \ - len, \ - TRACE_DEBUG) + __traceData_codeInfo.hash, \ + __LINE__, \ + address, \ + len, \ + TRACE_DEBUG); \ + } + #endif /* HOSTBOOT_DEBUG */ #endif /* TRAC_DEBUG_OUT */ @@ -172,11 +190,14 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field /* a macro w/o the param number suffix. number is calculated from printf string */ #define TRACFCOMP(des,printf_string,args...) \ + { \ + __TRACE_HASH_STRUCTURES(printf_string); \ TRACE::trace_adal_write_all((des), \ - __ALL_HASH(printf_string,-1), \ + &__traceData_codeInfo, \ __LINE__, \ TRACE_FIELD, \ - ##args) + ##args); \ + } /** @@ -194,13 +215,15 @@ const uint32_t TRACE_FIELD = 0; //Indicates trace is field * @return void */ #define TRACFBIN(des,printf_string,address,len) \ + { \ + __TRACE_HASH_STRUCTURES(printf_string); \ TRACE::trace_adal_write_bin((des), \ - __ALL_HASH(printf_string,0), \ - __LINE__, \ - address, \ - len, \ - TRACE_FIELD) - + __traceData_codeInfo.hash, \ + __LINE__, \ + address, \ + len, \ + TRACE_FIELD); \ + } /** @fn void TRACSCOMP(des, printf_string, args...) @@ -223,11 +246,14 @@ tracepp replaces trace_adal_hash() with hash value and reduced format string /* a macro w/o the param number suffix. number is calculated from printf string */ #define TRACSCOMP(des,printf_string,args...) \ - TRACE::trace_adal_write_all((des), \ - __ALL_HASH(printf_string,-1), \ - __LINE__, \ - TRACE_DEBUG, \ - ##args) + { \ + __TRACE_HASH_STRUCTURES(printf_string); \ + TRACE::trace_adal_write_all((des), \ + &__traceData_codeInfo, \ + __LINE__, \ + TRACE_DEBUG, \ + ##args); \ + } /** @@ -369,6 +395,7 @@ class TracInit }; + } diff --git a/src/include/usr/trace/trace.H b/src/include/usr/trace/trace.H index 7db581dd3..ffbf3a5cb 100644 --- a/src/include/usr/trace/trace.H +++ b/src/include/usr/trace/trace.H @@ -61,6 +61,21 @@ namespace TRACE { class ComponentDesc; // Forward declaration. + struct traceCodeInfo + { + const char* format; + trace_hash_val hash; + } __attribute__((packed)); + + struct traceParseInfo + { + uint16_t len_string; + uint16_t len_file; + uint32_t __padding; + const char string[512]; + const char file[256]; + traceCodeInfo* code; + }; /** @brief Buffer type that a component is directed to. */ enum BUFFER_TYPES @@ -97,16 +112,14 @@ namespace TRACE * name of this function as is. * * @param [in,out] io_td Trace descriptor of buffer to write to. - * @param [in] i_hash Descriptive string hash value - * @param [in] i_fmt Formatting string + * @param [in] i_info Info struct for the hash and format string. * @param [in] i_line Line number trace was done at * @param [in] i_type Type of trace (TRACE_DEBUG, TRACE_FIELD) * * @return void */ void trace_adal_write_all(ComponentDesc *io_td, - const trace_hash_val i_hash, - const char * i_fmt, + const traceCodeInfo* i_info, const uint32_t i_line, const uint32_t i_type, ...); |