Re: Debug TRACE style output wihout leaving literal strings in binary

From: Pieter (msnews_at_insanegenius.com)
Date: 05/18/04


Date: Mon, 17 May 2004 17:32:29 -0700

Spacen

Thank you for the reply, but your solution (which is a typical
implementation of TRACE type macros) does not meet my requirements.
The binary that is compiled using your MY_TRACE macro will comtain the
literal string "err = %x\n", this is what I want to prevent.

Pieter

"Spacen Jasset" <spacenjasset@yahoo.co.uk> wrote in message
news:c8bjd5$jja$1@news7.svr.pol.co.uk...
>
> "Pieter" <msnews@insanegenius.com> wrote in message
> news:O3VEt7FPEHA.1644@TK2MSFTNGP09.phx.gbl...
> > I am researching any techniques to use simle TRACE type macros to output
> > debug strings from binaries at runtime, but, to do so without any
literal
> > strings remaining in the binary.
> >
> > E.g.
> > TRACE(_T("Some sensitive context text e.g. a function name %s\n"),
> > szSomeParameter);
> > But the resulting binary must not contain the _T("Some sensitive context
> > e.g. a function name %s\n") string literal.
> >
> > Requirements:
> > 1) The ideal system will not require stripping the strings from the PE
> file
> > after compilation, but will be transparent to compilation.
> > 2) The ideal system should not require developers to maintain cumbersome
> > message ids and string tables instead of directly using string literals.
> >
>
> how about this:
>
> #define MY_TRACE( a ) printf a
>
> but replace printf with your own variable arguments function that calls
> whatever its surpposed to.
>
> Usage is like this though:
>
> MY_TRACE( ("err = %x\n", err) );
>
> You can use variable argument lists in C99 to get rid of the double
> parenthesis, but I don't know if MS's C compiler supports this yet.
>
>



Relevant Pages

  • Re: how to replace a substring in a string using C?
    ... Well spotted - no one else caught that one (I only picked it up after Dave ... strlen on the entire original string where possible - I posted a similar ... are some typical results (using the same compilation options as you except ... The optimisation of not calling strlen on the entire string cuts about 7% ...
    (comp.lang.c)
  • Re: Performance RPG Figurative Constants versus Literals
    ... in compilation times between the two methods, ... I would suspect that the compiler would store *blanks as a single byte ... I would also suspect that comparing ... a 132 character string to a figurative constant would be quicker in the ...
    (comp.sys.ibm.as400.misc)
  • Re: STRING length
    ... Actually please disregard the previous post, I found I needed to with ... comment the call out compilation is successful. ... '#including', or, 'withing' rather unbounded string. ...
    (comp.lang.ada)
  • Re: what is different between <fstream.h> and <fstream>MS VC++
    ... i am writting 2 programs in VC++ 6.0, one for XML files the header is ... recover from previous error; stopping compilation ... // PutString -- Put a string value into the DynamicTable ... String GetString (String Key); ...
    (comp.lang.cpp)
  • Re: Debug TRACE style output wihout leaving literal strings in binary
    ... implementation of TRACE type macros) does not meet my requirements. ... >> debug strings from binaries at runtime, but, to do so without any ... >> after compilation, but will be transparent to compilation. ... >> message ids and string tables instead of directly using string literals. ...
    (microsoft.public.vsnet.debugging)