View on GitHub

raspberry_class

Lecture Notes for Raspberry PI and Linux Class

개발 도구 실습

실습 업로드

실습 내용

jyheo@JYHEO-LAPTOP:~/devtools$ gdb stack
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
...중간 생략...
(gdb) break push
Breakpoint 1 at 0x40060d: file stack.c, line 41.
(gdb) run
Starting program: /home/jyheo/devtools/stack

Breakpoint 1, push (data=3) at stack.c:41
41         if(!isfull()) {
(gdb) print top
$1 = -1
(gdb) next
42            top = top + 1;
(gdb) next
43            stack[top] = data;
(gdb) next
47      }
(gdb) print top
$2 = 0
(gdb) print stack
$3 = {3, 0, 0, 0, 0, 0, 0, 0}
(gdb) clear push
Deleted breakpoint 1
(gdb) next
main () at stack.c:52
52         push(5);
(gdb) next
53         push(9);
(gdb) print stack
$4 = {3, 5, 0, 0, 0, 0, 0, 0}
(gdb) step
push (data=9) at stack.c:41
41         if(!isfull()) {
(gdb) print top
$5 = 1
(gdb) continue
Continuing.
Element at top of the stack: 15
Elements:
15
12
1
9
5
3
Stack full: false
Stack empty: true
[Inferior 1 (process 569) exited normally]
(gdb) quit