Document Type | Technical Information
Category | Utility
Applicable Product Versions | 7FS02, 7FS02PS
Document Number | TUTTI005
Overview
This guide explains how to obtain the callstack using gdb when it is not possible to perform a callstack dump in tbsql.
Notegdb: A portable debugger that runs on Unix-based systems
This method can be applied in situations where it is difficult to capture the timing using TBCLI logs or pstack, as shown in the example below.
$ tbsql sys/tibero
tbSQL 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
TBR-2004: DSN (Database Source Name) file format is invalid.
at line 12, column 24:
)
^^^^^^
Driver can not be initialized.
DSN file is not found or corrupted.
Method
By using gdb's --args option, you can obtain the callstack (backtrace) information of the tibero client tool when it is difficult to capture the timing.
$ gdb --args tbsql sys/tibero
... omitted ...
(gdb) # tbsql command is paused
(gdb) run # Execute tbsql command
Starting program: /root/tibero7/client/bin/tbsql sys/tibero
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
tbSQL 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
TBR-2004: DSN (Database Source Name) file format is invalid.
at line 12, column 24:
)
^^^^^^
Driver can not be initialized.
DSN file is not found or corrupted.
... stopped ... # Stop by pressing Ctrl + C
Program received signal SIGINT, Interrupt.
0x00007ffff3f00d45 in read () from /lib64/libc.so.6
Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-236.el8_9.7.x86_64 libaio-0.3.105-2.x86_64 ncurses-compat-libs-6.1-10.20180224.el8.x86_64
(gdb) bt # Print backtrace
#0 0x00007ffff3f00d45 in read () from /lib64/libc.so.6
#1 0x00007ffff3e73bf8 in __GI__IO_file_underflow () from /lib64/libc.so.6
#2 0x00007ffff3e74d56 in _IO_default_uflow () from /lib64/libc.so.6
#3 0x00007ffff3e685fa in _IO_getline_info () from /lib64/libc.so.6
#4 0x00007ffff3e675ff in fgets () from /lib64/libc.so.6
#5 0x00000000004116fa in tbsql_stdio_read (buf=buf@entry=0x6c6b40 "bt\n", buf_size=buf_size@entry=2048)
at /home/chef/workspace/Build_centos_7-3/tibero7/src/client/tbsql/tbsql_io.c:405
#6 0x00000000004117b4 in tbsql_io_read (buf=0x6c6b40 "bt\n", buf_size=2048,
prompt=0x6bf4fc <env_+28> "SQL> ")
at /home/chef/workspace/Build_centos_7-3/tibero7/src/client/tbsql/tbsql_io.c:66
#7 0x000000000040fe0a in tbsql_stmt_read_cmd (stmt=stmt@entry=0x7fffffffe1b0, fp=fp@entry=0x0,
lno=lno@entry=1, need_prompt=need_prompt@entry=1 '\001')
at /home/chef/workspace/Build_centos_7-3/tibero7/src/client/tbsql/tbsql_stmt.c:264
#8 0x0000000000410446 in tbsql_stmt_get_cmd (stmt=stmt@entry=0x7fffffffe1b0, fp=fp@entry=0x0)
at /home/chef/workspace/Build_centos_7-3/tibero7/src/client/tbsql/tbsql_stmt.c:303
#9 0x0000000000405bb3 in main (argc=<optimized out>, argv=<optimized out>)
at /home/chef/workspace/Build_centos_7-3/tibero7/src/client/tbsql/tbsql.c:70