You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,7 @@ Tools for evaluating your queue code
83
83
* Makefile : Builds the evaluation program `qtest`
84
84
* README.md : This file
85
85
* scripts/driver.py : The driver program, runs `qtest` on a standard set of traces
86
+
* scripts/debug.py : The helper program for GDB, executes qtest without SIGALRM and/or analyzes generated core dump file.
86
87
87
88
Helper files
88
89
* console.{c,h} : Implements command-line interpreter for qtest
@@ -97,6 +98,49 @@ Trace files
97
98
* XX is the trace number (1-15). CAT describes the general nature of the test.
98
99
* traces/trace-eg.cmd : A simple, documented trace file to demonstrate the operation of `qtest`
99
100
101
+
## Debugging Facilities
102
+
103
+
Before using GDB debug `qtest`, there are some routine instructions need to do. The script `scripts/debug.py` covers these instructions and provides basic debug function.
104
+
```
105
+
$ scripts/debug.py -h
106
+
usage: debug.py [-h] [-d | -a]
107
+
108
+
optional arguments:
109
+
-h, --help show this help message and exit
110
+
-d, --debug Enter gdb shell
111
+
-a, --analyze Analyze the core dump file
112
+
```
113
+
* Enter GDB without interruption by **SIGALRM**.
114
+
```
115
+
$ scripts/debug.py -d
116
+
Reading symbols from lab0-c/qtest...done.
117
+
Signal Stop Print Pass to program Description
118
+
SIGALRM No No No Alarm clock
119
+
Starting program: lab0-c/qtest
120
+
cmd>
121
+
```
122
+
* When `qtest` encountered **Segmentation fault** while it ran outside GDB, we could invoke GDB in the post-mortem debugging mode to figure out the bug.
123
+
124
+
The core dump file was created in the working directory of the `qtest`.
125
+
* Allow the core dumps by using shell built-in command **ulimit** to set core file size.
126
+
```
127
+
$ ulimit -c unlimited
128
+
$ ulimit -c
129
+
unlimited
130
+
```
131
+
* Enter GDB and analyze
132
+
```
133
+
$ scripts/debug.py -a
134
+
Reading symbols from lab0-c/qtest...done.
135
+
[New LWP 9424]
136
+
Core was generated by `lab0-c/qtest'.
137
+
Program terminated with signal SIGSEGV, Segmentation fault.
138
+
#0 ...
139
+
#1 ... (backtrace information)
140
+
#2 ...
141
+
(gdb)
142
+
```
143
+
100
144
## License
101
145
102
146
`lab0-c`is released under the BSD 2 clause license. Use of this source code is governed by
0 commit comments