ClickHouse-pretty-printer
ClickHouse-pretty-printer copied to clipboard
gdb.Value syntax issue
你好,我在使用您这个printer脚本时,有个问题
问题如图
.gdbinit 配置, 我把printer.py clone到本地了
补充 https://github.com/ClickHouse/ClickHouse/issues/18861 这个issue里提到的这几种printer都尝试过了。都不太行
-
llvm 版本的printer , 不知道为什么没注册上
- 在 gdb 环境下,
info pretty-print
没有显示注册成功的可用类型,比如std::basic_string等
- 在 gdb 环境下,
-
libcxx-pretty-printers 也有OOM的问题
-
您这个版本的因为语法错误,我还没成功
我这里的环境是clion(win10) + wsl2(clickhouse), 期望在使用remote-gdb-server的时候,可以在debug界面看到每个变量的具体的值, 现在还是这种
Install gdb and verify that it supports Python scripting (invoke gdb --version and check for --with-python=... lines). 我的gdb版本是9.2,你的是多少?另外gdb有--with-python路径吗?
sorry , not this repository... it works
好。用起来有什么问题,再留言
好。用起来有什么问题,再留言
我的也是gdb 9.2,目前看还有一些警告,没其他问题
没有--with-python
没有--with-python 那你info pretty-printer显示注册成功了吗? 或者你随便打印一个AST,看看成功了吗?有没有显示sql内容。
没有--with-python 那你info pretty-printer显示注册成功了吗? 或者你随便打印一个AST,看看成功了吗?有没有显示sql内容。
-
info pretty-printer
注册成功了 - demo,
还有2个问题
- 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> >'
- 按照readme的说明(Gdb useful commands related),没有能实现
info vtbl ast
的效果
p ast能成功吗?ast是什么类型?