gdb调试之---当commit时碰到的第一个等待事件是什么?

简介: 还是接着上一篇文章的实验:gdb调试之---当update时第一个持有的Latch是什么Latch锁?commit在MySQL中用二阶段提交实现,那在ORACLE中commit是什么样的呢?会出现什么等待事件?

1、退出gdb

(gdb) q
The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /u01/app/oracle/product/11.2.0/bin/oracle, process 7376

2、通过系统进程号7376打开gdb程序


[oracle@mydb ~]$ gdb $ORACLE_HOME/bin/oracle 7376
GNU gdb Fedora (6.8-27.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(no debugging symbols found)
Attaching to program: /u01/app/oracle/product/11.2.0/bin/oracle, process 7376
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libodm11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libodm11.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libcell11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libcell11.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libskgxp11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libskgxp11.so
Reading symbols from /lib64/librt.so.1...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libnnz11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libnnz11.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libclsra11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libclsra11.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libdbcfg11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libdbcfg11.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libhasgen11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libhasgen11.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libskgxn2.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libskgxn2.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libocr11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocr11.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libocrb11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocrb11.so
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libocrutl11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libocrutl11.so
Reading symbols from /usr/lib64/libaio.so.1...done.
Loaded symbols for /usr/lib64/libaio.so.1
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]
[New Thread 0x2b0b8fef0910 (LWP 7376)]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/libnsl.so.1...done.
Loaded symbols for /lib64/libnsl.so.1
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/lib64/libnuma.so.1...done.
Loaded symbols for /usr/lib64/libnuma.so.1
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib64/libnss_files.so.2
Reading symbols from /u01/app/oracle/product/11.2.0/lib/libnque11.so...done.
Loaded symbols for /u01/app/oracle/product/11.2.0/lib/libnque11.so
0x0000003f0d40d290 in __read_nocancel () from /lib64/libpthread.so.0
(gdb)

3、执行commit,commit被阻塞了。

gyj@OCM> commit;

4、设断点(预先知道待等事件的函数kslwtbctx),并运行。

(gdb) b kslwtbctx
Breakpoint 1 at 0x8f9a5c2
(gdb) c
Continuing.

Breakpoint 1, 0x0000000008f9a5c2 in kslwtbctx ()
(gdb)

5、查等待事件kslwtbctx函数的第一个参数,用命令info all-register显示寄存器

(gdb) info all-register
rax            0x8f     143
rbx            0x1      1
rcx            0x11263  70243
rdx            0x11974  72052
rsi            0x2acf2e 2805550
rdi            0x7fff1c577028   140733668880424
rbp            0x7fff1c576ed0   0x7fff1c576ed0
rsp            0x7fff1c576ed0   0x7fff1c576ed0
r8             0x0      0
r9             0x7a59   31321
r10            0x9b0abcb8       2601172152
r11            0x0      0
r12            0x1      1
r13            0x0      0
r14            0xbb132a4        196162212
r15            0x1      1
rip            0x8f9a5c2        0x8f9a5c2 <kslwtbctx+4>
eflags         0x246    [ PF ZF IF ]
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0
st0            0        (raw 0x00000000000000000000)
---Type <return> to continue, or q <return> to quit---
st1            0        (raw 0x00000000000000000000)
st2            0        (raw 0x00000000000000000000)
st3            0        (raw 0x00000000000000000000)
st4            0        (raw 0x00000000000000000000)
st5            0        (raw 0x00000000000000000000)
st6            333296   (raw 0x4011a2be000000000000)
st7            300384   (raw 0x401192ac000000000000)
fctrl          0x27f    639
fstat          0x0      0
ftag           0xffff   65535
fiseg          0x0      0
fioff          0x9394e95        154750613
foseg          0x7fff   32767
fooff          0x1c573f50       475479888
fop            0x0      0
xmm0           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm1           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm2           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm3           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x8000000000000000, 0x8000000000000000}, v16_int8 = {0xfe, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, v8_int16 = {0xfffe, 0xffff, 0xffff, 0xffff, 0xfffe, 0xffff,
    0xffff, 0xffff}, v4_int32 = {0xfffffffe, 0xffffffff, 0xfffffffe, 0xffffffff}, v2_int64 = {0xfffffffffffffffe, 0xfffffffffffffffe},
  uint128 = 0xfffffffffffffffefffffffffffffffe}
---Type <return> to continue, or q <return> to quit---
xmm4           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm5           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x32, 0xa3, 0xd7, 0x2, 0x0 <repeats 12 times>},
  v8_int16 = {0xa332, 0x2d7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x2d7a332, 0x0, 0x0, 0x0}, v2_int64 = {0x2d7a332, 0x0},
  uint128 = 0x00000000000000000000000002d7a332}
xmm6           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm7           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0xda, 0x87, 0xd7, 0x2, 0x0 <repeats 12 times>},
  v8_int16 = {0x87da, 0x2d7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x2d787da, 0x0, 0x0, 0x0}, v2_int64 = {0x2d787da, 0x0},
  uint128 = 0x00000000000000000000000002d787da}
xmm8           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm9           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm10          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm11          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm12          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x18, 0xe, 0x73, 0x90, 0xb, 0x2b, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xe18, 0x9073, 0x2b0b, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x90730e18, 0x2b0b, 0x0, 0x0},
  v2_int64 = {0x2b0b90730e18, 0x0}, uint128 = 0x000000000000000000002b0b90730e18}
xmm13          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
xmm14          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
---Type <return> to continue, or q <return> to quit---
xmm15          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
mxcsr          0x1fa1   [ IE PE IM DM ZM OM UM PM ]

6、rdi/edi是第一个参数, rsi/esi是第二个参数,贴出info all-register命令所显示函数kslwtbctx()的两个参数,如下

rsi            0x2acf2e 2805550                    ----第二个参数
rdi            0x7fff1c577028   140733668880424    ----第一个参数

7、利用第一个参数rdi=0x7fff1c577028,显示内存中32个字节。

(gdb) x/32 0x7fff1c577028
0x7fff1c577028: 0x00007a59      0x00000000      0x1c577110      0x00007fff
0x7fff1c577038: 0x01b5e250      0x00000000      0x00000000      0x00000000
0x7fff1c577048: 0x00000000      0x00000000      0x00000000      0x00000001
0x7fff1c577058: 0x00000000      0x00000000      0x00000000      0x00000000
0x7fff1c577068: 0x00000000      0x00000000      0x00000000      0x00000000
0x7fff1c577078: 0x00000000      0x00000000      0x00000001      0x00000000
0x7fff1c577088: 0x0a12110c      0x00000000      0x0000008f      0x00011974
0x7fff1c577098: 0x7fffffff      0x00000000      0x00011263      0x00000000
(gdb)

8、找到等待事件的编号是0x0000008f,转化为十进制为143,即0x0000008f ===>143号

9、找出commit的等待事件

sys@OCM> select  name from v$event_name where event#=143;

NAME
----------------------------------------------------------------
log file sync

10、commit时的第一个等待事件就是log file sync.

相关实践学习
阿里云图数据库GDB入门与应用
图数据库(Graph Database,简称GDB)是一种支持Property Graph图模型、用于处理高度连接数据查询与存储的实时、可靠的在线数据库服务。它支持Apache TinkerPop Gremlin查询语言,可以帮您快速构建基于高度连接的数据集的应用程序。GDB非常适合社交网络、欺诈检测、推荐引擎、实时图谱、网络/IT运营这类高度互连数据集的场景。 GDB由阿里云自主研发,具备如下优势: 标准图查询语言:支持属性图,高度兼容Gremlin图查询语言。 高度优化的自研引擎:高度优化的自研图计算层和存储层,云盘多副本保障数据超高可靠,支持ACID事务。 服务高可用:支持高可用实例,节点故障迅速转移,保障业务连续性。 易运维:提供备份恢复、自动升级、监控告警、故障切换等丰富的运维功能,大幅降低运维成本。 产品主页:https://www.aliyun.com/product/gdb
相关文章
|
3月前
|
NoSQL Linux C语言
Linux GDB 调试
Linux GDB 调试
62 10
|
3月前
|
NoSQL Linux C语言
嵌入式GDB调试Linux C程序或交叉编译(开发板)
【8月更文挑战第24天】本文档介绍了如何在嵌入式环境下使用GDB调试Linux C程序及进行交叉编译。调试步骤包括:编译程序时加入`-g`选项以生成调试信息;启动GDB并加载程序;设置断点;运行程序至断点;单步执行代码;查看变量值;继续执行或退出GDB。对于交叉编译,需安装对应架构的交叉编译工具链,配置编译环境,使用工具链编译程序,并将程序传输到开发板进行调试。过程中可能遇到工具链不匹配等问题,需针对性解决。
|
3月前
|
NoSQL
技术分享:如何使用GDB调试不带调试信息的可执行程序
【8月更文挑战第27天】在软件开发和调试过程中,我们有时会遇到需要调试没有调试信息的可执行程序的情况。这可能是由于程序在编译时没有加入调试信息,或者调试信息被剥离了。然而,即使面对这样的挑战,GDB(GNU Debugger)仍然提供了一些方法和技术来帮助我们进行调试。以下将详细介绍如何使用GDB调试不带调试信息的可执行程序。
99 0
|
5月前
|
NoSQL Linux C语言
Linux gdb调试的时候没有对应的c调试信息库怎么办?
Linux gdb调试的时候没有对应的c调试信息库怎么办?
42 1
|
5月前
|
NoSQL Linux C语言
Linux gdb调试的时候没有对应的c调试信息库怎么办?
Linux gdb调试的时候没有对应的c调试信息库怎么办?
31 0
|
5月前
|
NoSQL Linux C++
Linux C/C++ gdb调试正在运行的程序
Linux C/C++ gdb调试正在运行的程序
|
5月前
|
NoSQL Linux C++
Linux C/C++ gdb调试core文件
Linux C/C++ gdb调试core文件
|
5月前
|
NoSQL Linux C++
Linux C/C++ gdb调试
Linux C/C++ gdb调试
|
6月前
|
NoSQL Ubuntu 测试技术
【GDB自定义指令】core analyzer结合gdb的调试及自定义gdb指令详情
【GDB自定义指令】core analyzer结合gdb的调试及自定义gdb指令详情
94 1
|
6月前
|
NoSQL 编译器 C语言
【GDB调试技巧】提高gdb的调试效率
【GDB调试技巧】提高gdb的调试效率
81 1