Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBGMSG debug flag on cause compiling error when TRACE_DBG used in source file #2

Closed
vincentmli opened this issue Aug 24, 2016 · 4 comments

Comments

@vincentmli
Copy link

Hi Asim,

I turned on the debug flag on in core/src/Makefile and run into compiling error below:

DBG_OPT = -DDBGMSG -DDBGFUNC -DSTREAM -DSTATE -DTSTAT -DAPP -DEPOLL

DBG_OPT = -DDBGMSG -DDBGFUNC -DSTREAM -DSTATE

DBG_OPT += -DPKTDUMP

DBG_OPT += -DDUMP_STREAM

GCC_OPT += -g -DNETSTAT -DINFO -DDBGERR -DDBGCERR

GCC_OPT += -DNDEBUG -O3 -g -DNETSTAT -DINFO -DDBGERR -DDBGCERR
GCC_OPT += $(DBG_OPT)

CC tcp_stream.c
In file included from tcp_stream.c:14:0:
tcp_stream.c: In function ‘DisableBuf’:
./include/debug.h:50:16: error: ‘mtcp’ undeclared (first use in this function)
thread_printf(mtcp, mtcp->log_fp, "[%10s:%4d] "
^
tcp_stream.c:267:4: note: in expansion of macro ‘TRACE_DBG’
TRACE_DBG("Invalid side!\n");
^
./include/debug.h:50:16: note: each undeclared identifier is reported only once for each function it appears in
thread_printf(mtcp, mtcp->log_fp, "[%10s:%4d] "
^
tcp_stream.c:267:4: note: in expansion of macro ‘TRACE_DBG’
TRACE_DBG("Invalid side!\n");
^
tcp_stream.c: In function ‘GetLastTimestamp’:
./include/debug.h:50:16: error: ‘mtcp’ undeclared (first use in this function)
thread_printf(mtcp, mtcp->log_fp, "[%10s:%4d] "
^
tcp_stream.c:291:3: note: in expansion of macro ‘TRACE_DBG’
TRACE_DBG("Size passed is not >= sizeof(uint32_t)!\n");
^
make: *** [tcp_stream.o] Error 1

it seems TRACE_DGB used in quite a few sources need to be cleaned up properly?

@ajamshed
Copy link
Member

Hi Vincent,

I have committed some changes to the mOS core files. With these changes, you will be able to compile the stack with debug macros.

@vincentmli
Copy link
Author

thanks Asim, I see you made some changes in debug.h

+#define __PREPARE_DGBLOGGING() \

  •   struct mtcp_context mctx = {            \
    
  •           .cpu = sched_getcpu(),          \
    
  •   };                                              \
    
  •                                                   \
    
  •   mtcp_manager_t mtcp = GetMTCPManager(&mctx);
    

#define TRACE_DBG(f, m...) {
thread_printf(mtcp, mtcp->log_fp, "[%10s:%4d] "
f, FUNCTION, LINE, ##m);
}

so I tested by commenting out core/src/Makefile.in as below
DBG_OPT = -DDBGMSG -DDBGFUNC -DSTREAM -DSTATE -DTSTAT -DAPP

then run ./setup --compile-dpdk. i still got error

CC tcp_stream.c
tcp_stream.c: In function ‘DisableBuf’:
tcp_stream.c:223:2: warning: implicit declaration of function ‘__PREPARE_DBGLOGGING’ [-Wimplicit-function-declaration]
__PREPARE_DBGLOGGING();
^
In file included from tcp_stream.c:1:0:
./include/debug.h:60:16: error: ‘mtcp’ undeclared (first use in this function)
thread_printf(mtcp, mtcp->log_fp, "[%10s:%4d] "
^
tcp_stream.c:236:4: note: in expansion of macro ‘TRACE_DBG’
TRACE_DBG("Invalid side!\n");
^
./include/debug.h:60:16: note: each undeclared identifier is reported only once for each function it appears in
thread_printf(mtcp, mtcp->log_fp, "[%10s:%4d] "
^
tcp_stream.c:236:4: note: in expansion of macro ‘TRACE_DBG’
TRACE_DBG("Invalid side!\n");
^
tcp_stream.c: In function ‘GetLastTimestamp’:
./include/debug.h:60:16: error: ‘mtcp’ undeclared (first use in this function)
thread_printf(mtcp, mtcp->log_fp, "[%10s:%4d] "
^
tcp_stream.c:263:3: note: in expansion of macro ‘TRACE_DBG’
TRACE_DBG("Size passed is not >= sizeof(uint32_t)!\n");
^
make: *** [tcp_stream.o] Error 1

it appears the mtcp you added in __PREPARE_DBGLOGGING did not take effect, maybe some syntax error?

@ajamshed
Copy link
Member

Apologies for the typo mess. This took place when I was synching files from my local version to the github version. There was a typo (DGB --> DBG). The latest commit should remove the problem. I checked :).

@vincentmli
Copy link
Author

typo happens :) great it compiles fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants