Executing a function based on an event where a function returns in c, is this possible in runtime?

178 views Asked by At

the issue I'm experiencing , is certain applications make use of a library that has been created to include logging , we cannot recompile the code for the running applications as they are legacy applications.

so I need to add functionality in the library file and relink the source code with the library files.

a function defined in the library file called DEBUG_DATA()

-> returns function name line etc. -> this function is already used in the application , what I am required to do is on execution of this function DEBUG_DATA I need to add an event and trigger an event once the function that calls debug_data returns.

is it possible to create a trigger on an event in c where the trigger isn't called ? can this be done in runtime ? as in tweaking the stack?

EDIT: this is added to DEBUG_DATA():

void Dynatrace_Method_START(
   const char *ms_FunctionName, const char *ms_FileName, int ms_LineNO)
{
#ifdef DT_USE /*a global variable needs to be initiated for stack trace lets call it int Dyna_M_SERIAL*/
    DT_Current_Stack++;
    if (DT_Current_Stack<=DT_STACK) {
        // FILE_NAME_STRIPPER(ms_FileName);
        Dyna_M_SERIAL++;
        fprintf(pfile,"%d,mstart,%s,%s,%d,%s,%d\r\n",
            Dyna_UID, ms_FunctionName, FILE_NAME_STRIPPER(ms_FileName), ms_LineNO,
            sProgram_‌​name, Dyna_M_SERIAL);
        Line_Reference[Dyna_M_SERIAL]=ms_LineNO;
    }
#endif
}

OS is Guardian H Series TNS\E, compiler is Compaq ETK -NSE.

0

There are 0 answers