Skip to content

Conversation

@tsingbx
Copy link
Contributor

@tsingbx tsingbx commented Apr 10, 2025

No description provided.

@tsingbx tsingbx changed the title add dbg flag for llcppsigfetch, llcppsymg, gogensig to control log ou… add dbg flag for llcppsigfetch, llcppsymg, gogensig to control log Apr 10, 2025
Comment on lines 8 to 15
DbgSymbol dbgFlags = 1 << iota
DbgParseIsMethod //print parse.go isMethod debug log info
DbgFlagAll = DbgSymbol | DbgParseIsMethod
DbgEditSymMap //print user edit sym map info
DbgVisitTop //print visitTop
DbgCollectFuncInfo
DbgNewSymbol
DbgFileType
DbgFlagAll = DbgSymbol | DbgParseIsMethod
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前的DbgFlagAll = DbgSymbol | DbgParseIsMethod 是因为只有两个flag,现在的DbgFlagAll其实就不应该这么写了,而是应该组合前面所有的Flag。

https://github.com/goplus/gogen/blob/ba6f4f0b5b8a936aac433e2b202a9de05ab0915a/package.go#L30C1-L40C2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前的DbgFlagAll = DbgSymbol | DbgParseIsMethod 是因为只有两个flag,现在的DbgFlagAll其实就不应该这么写了,而是应该组合前面所有的Flag。

https://github.com/goplus/gogen/blob/ba6f4f0b5b8a936aac433e2b202a9de05ab0915a/package.go#L30C1-L40C2

这个在开发调试的时候可以修改。对于产品发布,或者对于测试输出就禁止了吧。否则log太多对排查问题来说很不方便。这是故意这样做的。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DbgFlagAll的语义就会不明确

Copy link
Contributor Author

@tsingbx tsingbx Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DbgFlagAll的语义就会不明确

怎么不明确了,这个DbgFlagAll是由你控制的一个flag,如果是0,就是不输出log,如果是DbgVisitTop|DbgFileType,就是输出其他,这个DbgFlagAll的意思就是所有要输出的log的意思。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
根据最新的这个提交,在位标志中,0表示“没有标志被设置”。如果 DbgAll 定义为0,就意味着没有一个调试标志被启用,这与“所有标志都开启”的意思完全相反。因此,为了表示所有调试标志都被激活,DbgAll 必须由所有标志的非零值按位“或”得到,而不能简单地用0表示。

Copy link
Contributor Author

@tsingbx tsingbx Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image 根据最新的这个提交,在位标志中,0表示“没有标志被设置”。如果 DbgAll 定义为0,就意味着没有一个调试标志被启用,这与“所有标志都开启”的意思完全相反。因此,为了表示所有调试标志都被激活,DbgAll 必须由所有标志的非零值按位“或”得到,而不能简单地用0表示。

纠结这种小问题没有意义,我也没有那么多时间,被这些小问题困扰,不停的修改。现在的问题是_llcppgtest目录下的demo输出了大量的log,有几千行的log,里面有个demo错误,你需要查找很久,必须下载log文件才能排查出那个demo出错了。而且除非你去调试,没有必要输出这么多log。

Copy link
Contributor Author

@tsingbx tsingbx Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据最新的这个提交,在位标志中,0表示“没有标志被设置”。如果 DbgAll 定义为0,就意味着没有一个调试标志被启用,这与“所有标志都开启”的意思完全相反。因此,为了表示所有调试标志都被激活,DbgAll 必须由所有标志的非零值按位“或”得到,而不能简单地用0表示。

这个是故意这样做的,只有在调试的时候,才需要输出log,按照你想输出什么log,DbgFlagAll=flagA|flagB,只输出A和B的log。然后运行的时候添加-v标志,只输出你想要的log。

DbgNew
DbgWrite
DbgUnmarshalling
DbgFlagAll = 0 | DbgError | DbgLog
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#245 (comment) 相同的问题

DbgLog // print log info
DbgFlagAll = 0 | DbgError | DbgLog
DbgSetCurFile
DbgNew
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的New是预期输出哪部分的log

DbgGetCurFile
DbgMacro
DbgFileType
DbgFlagAll = DbgParse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

相同的问题需要处理~ #245 (comment)

@tsingbx tsingbx force-pushed the dbg branch 5 times, most recently from 375284d to 333ba03 Compare April 11, 2025 02:41
@codecov
Copy link

codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 77.52%. Comparing base (047c15a) to head (333ba03).

Files with missing lines Patch % Lines
cmd/gogensig/unmarshal/unmarshal.go 25.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
- Coverage   78.84%   77.52%   -1.32%     
==========================================
  Files          31       31              
  Lines        2940     2959      +19     
==========================================
- Hits         2318     2294      -24     
- Misses        604      630      +26     
- Partials       18       35      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants