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

gdb.Value syntax issue #1

Open
CatCodeMe opened this issue Sep 18, 2021 · 9 comments
Open

gdb.Value syntax issue #1

CatCodeMe opened this issue Sep 18, 2021 · 9 comments

Comments

@CatCodeMe
Copy link

你好,我在使用您这个printer脚本时,有个问题
问题如图
image

.gdbinit 配置, 我把printer.py clone到本地了
image


补充
ClickHouse/ClickHouse#18861 这个issue里提到的这几种printer都尝试过了。都不太行

  1. llvm 版本的printer , 不知道为什么没注册上

    • 在 gdb 环境下,info pretty-print 没有显示注册成功的可用类型,比如std::basic_string等
  2. libcxx-pretty-printers 也有OOM的问题

  3. 您这个版本的因为语法错误,我还没成功


我这里的环境是clion(win10) + wsl2(clickhouse), 期望在使用remote-gdb-server的时候,可以在debug界面看到每个变量的具体的值, 现在还是这种
image

@hexiaoting
Copy link
Owner

Install gdb and verify that it supports Python scripting (invoke gdb --version and check for --with-python=... lines).
我的gdb版本是9.2,你的是多少?另外gdb有--with-python路径吗?

@CatCodeMe
Copy link
Author

sorry , not this repository... it works

@hexiaoting
Copy link
Owner

好。用起来有什么问题,再留言

@CatCodeMe
Copy link
Author

好。用起来有什么问题,再留言

我的也是gdb 9.2,目前看还有一些警告,没其他问题
image

@CatCodeMe
Copy link
Author

没有--with-python

@hexiaoting
Copy link
Owner

没有--with-python
那你info pretty-printer显示注册成功了吗?
或者你随便打印一个AST,看看成功了吗?有没有显示sql内容。

@CatCodeMe
Copy link
Author

没有--with-python
那你info pretty-printer显示注册成功了吗?
或者你随便打印一个AST,看看成功了吗?有没有显示sql内容。

  1. info pretty-printer 注册成功了
  2. demo,
    image

@CatCodeMe
Copy link
Author

还有2个问题

  1. ast,我使用 p *ast 有错误
  • clickhouse 版本为 v21.9.2.17-stable (master分支手动编译的)
  • 这段代码在executeQuery.cpp:934
gdb) p *ast
$2 = [New Thread 32123.1442]
[Switching to Thread 32123.32357]
warning: RTTI symbol not found for class 'std::__1::__shared_ptr_pointer<DB::Context*, std::__1::shared_ptr<DB::Context>::__shared_ptr_default_delete<DB::Context, DB::Context>, std::__1::allocator<DB::Context> >'
warning: RTTI symbol not found for class 'std::__1::__shared_ptr_pointer<DB::Context*, std::__1::shared_ptr<DB::Context>::__shared_ptr_default_delete<DB::Context, DB::Context>, std::__1::allocator<DB::Context> >'

Thread 2 "TCPHandler" hit Breakpoint 16, DB::executeQueryImpl (begin=0x7fff080137b0 "SELECT message FROM system.warnings", end=0x7fff080137d3 "", context=warning: RTTI symbol not found for class 'std::__1::__shared_ptr_pointer<DB::Context*, std::__1::shared_ptr<DB::Context>::__shared_ptr_default_delete<DB::Context, DB::Context>, std::__1::allocator<DB::Context> >'
warning: RTTI symbol not found for class 'std::__1::__shared_ptr_pointer<DB::Context*, std::__1::shared_ptr<DB::Context>::__shared_ptr_default_delete<DB::Context, DB::Context>, std::__1::allocator<DB::Context> >'
std::shared_ptr<DB::Context> count 3, weak 4 containing = {...}, internal=false, stage=DB::QueryProcessingStage::Complete, has_query_tail=false, istr=0x0) at ../src/Interpreters/executeQuery.cpp:414
414	                const auto * last_select = select_with_union_query->list_of_selects->children.back()->as<ASTSelectQuery>();
Traceback (most recent call last):
  File "/home/hulj/workspace/ClickHouse-pretty-printer/clickhouse/IAST.py", line 15, in to_string
    sql_string=gdb.parse_and_eval(eval_string);
gdb.error: The program stopped in another thread while making a function call from GDB.
Evaluation of the expression containing the function
(DB::serializeAST(DB::IAST const&, bool)) will be abandoned.
When the function is done executing, GDB will silently stop.

[Switching to thread 2 (Thread 32123.32357)]
#0  DB::executeQueryImpl (begin=0x7fff080137b0 "SELECT message FROM system.warnings", end=0x7fff080137d3 "", context=warning: RTTI symbol not found for class 'std::__1::__shared_ptr_pointer<DB::Context*, std::__1::shared_ptr<DB::Context>::__shared_ptr_default_delete<DB::Context, DB::Context>, std::__1::allocator<DB::Context> >'
warning: RTTI symbol not found for class 'std::__1::__shared_ptr_pointer<DB::Context*, std::__1::shared_ptr<DB::Context>::__shared_ptr_default_delete<DB::Context, DB::Context>, std::__1::allocator<DB::Context> >'
std::shared_ptr<DB::Context> count 3, weak 4 containing = {...}, internal=false, stage=DB::QueryProcessingStage::Complete, has_query_tail=false, istr=0x0) at ../src/Interpreters/executeQuery.cpp:414
414	                const auto * last_select = select_with_union_query->list_of_selects->children.back()->as<ASTSelectQuery>();
warning: RTTI symbol not found for class 'std::__1::__shared_ptr_pointer<DB::Context*, std::__1::shared_ptr<DB::Context>::__shared_ptr_default_delete<DB::Context, DB::Context>, std::__1::allocator<DB::Context> >'
warning: RTTI symbol not found for class 'std::__1::__shared_ptr_pointer<DB::Context*, std::__1::shared_ptr<DB::Context>::__shared_ptr_default_delete<DB::Context, DB::Context>, std::__1::allocator<DB::Context> >'


  1. 按照readme的说明(Gdb useful commands related),没有能实现info vtbl ast的效果
    image

@CatCodeMe CatCodeMe reopened this Sep 18, 2021
@hexiaoting
Copy link
Owner

p ast能成功吗?ast是什么类型?

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

No branches or pull requests

2 participants