---
title: "Glusterfs调试"
author: "lancelotwjq"
date: "2012-09-03T15:13:44Z"
tags: []
categories: ["开源软件"]
slug: "glusterfs"
draft: false
lastmod: "2012-10-17T11:39:24Z"
id: 1670503
url: "https://glusterfs.iteye.com/blog/1670503"
---

直接attach到相关进程

 

&gt; gdb

(gdb) attach \[pid of the glusterfs]

....

(gdb) detach

 

 

\-----------------------------------------------------------------------------------------------------------------------------------

或者使用gdb启动glusterfs：

 

 

&gt; gdb -x  script.txt

 

script.txt 文件内容

 

 

```
file /usr/sbin/glusterfs
set breakpoint pending on
b <function>
run --volfile-id <volume name> -s <server name> /mnt --debug
```

 

 

遇到某断点进入gdb终端后，可以输入bt（查看调用栈），可以清晰的看到glustefs xlator的层次结构。