打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
DEBUGMSG
userphoto

2013.12.19

关注

If you want to add Debugging output statements to your own code, you can use the following conventions:

DEBUGMSGTL

Note the double (( ))s in these statements!

DEBUGMSGTL(("token", "statement of some kind: %s\n", "with printf arguments"));

This actually outputs two lines:

  • A "trace" line showing where in the source it came from (that's what the T stands for)
  • Your debugging line (when -Dtoken is turned on)

This should be the most common debugging statement used. It should be used for complete debugging lines.

DEBUGMSG

For creating lines a piece at a time, start with DEBUGMSGTL followed by DEBUGMSG macros until you hit the newline ("\n"). This is a stupid example but shows how it works:

 int total = 0; DEBUGMSGTL(("token", "Calculating running total: ")); for(int i = 0; i < 5; i++) {    total = total + i;    DEBUGMSG(("token", " %d", total)); } DEBUGMSG(("token", "\n"));

DEBUGMSGOID

For printing OIDs you can use the DEBUGOID macro:

 oid my_oid[] = { 1, 3, 6, 1} size_t my_oid_len = 4;  DEBUGMSGTL(("token", "this is my oid: ")); DEBUGMSGOID(("token", my_oid, my_oid_len)); DEBUGMSG(("token", "\n"));
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
根据不通条件求和生成列
SNMP监控一些常用OID的总结
China sets 2011 rare earth output quota - Peo...
How to debug python script
Debug MQL4 MQL5 | One Step Removed
view | bill gatliff.com
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服