Last active
December 14, 2015 07:18
-
-
Save labeneator/5049168 to your computer and use it in GitHub Desktop.
Playing around with variables in gdb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo gdb -p $(pgrep leaky) | |
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 | |
Copyright (C) 2012 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-linux-gnu". | |
For bug reporting instructions, please see: | |
<http://bugs.launchpad.net/gdb-linaro/>. | |
Attaching to process 16095 | |
Reading symbols from /home/laban/devel/private/learning/c/leak_descriptors/leaky...done. | |
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.15.so...done. | |
done. | |
Loaded symbols for /lib/x86_64-linux-gnu/libc.so.6 | |
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.15.so...done. | |
done. | |
Loaded symbols for /lib64/ld-linux-x86-64.so.2 | |
0x00007f253e7cf820 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:82 | |
82 ../sysdeps/unix/syscall-template.S: No such file or directory. | |
(gdb) | |
(gdb) bt | |
#0 0x00007f253e7cf820 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:82 | |
#1 0x00007f253e7cf6dc in __sleep (seconds=0) at ../sysdeps/unix/sysv/linux/sleep.c:138 | |
#2 0x0000000000400620 in main () at leaky.c:21 | |
(gdb) up | |
#1 0x00007f253e7cf6dc in __sleep (seconds=0) at ../sysdeps/unix/sysv/linux/sleep.c:138 | |
138 ../sysdeps/unix/sysv/linux/sleep.c: No such file or directory. | |
(gdb) up | |
#2 0x0000000000400620 in main () at leaky.c:21 | |
21 sleep(60); | |
(gdb) set filename="/etc/group" | |
... | |
... Awhile later | |
... | |
(gdb) set iteration=4 | |
... | |
... Awhile later | |
... | |
(gdb) set iteration=2147483646 | |
(gdb) p iteration | |
$1 = 2147483646 | |
(gdb) quit | |
A debugging session is active. | |
Inferior 1 [process 16095] will be detached. | |
Quit anyway? (y or n) y | |
Detaching from program: /home/laban/devel/private/learning/c/leak_descriptors/leaky, process 16095 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment