File tree 3 files changed +19
-8
lines changed
3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 8
8
# run watch.out
9
9
10
10
f=" ${1% .* } "
11
- gdb -batch -x " ${f} .gdb" " ${f} .out"
11
+ gdb -batch -nh - x " ${f} .gdb" " ${f} .out"
Original file line number Diff line number Diff line change 3
3
http://stackoverflow.com/questions/1538463/how-can-i-put-a-breakpoint-on-something-is-printed-to-the-terminal-in-gdb
4
4
*/
5
5
6
+ #define _XOPEN_SOURCE 700
6
7
#include <stdio.h>
7
8
#include <stdlib.h>
9
+ #include <unistd.h>
8
10
9
11
int main () {
10
- puts ("a" );
11
- puts ("b" );
12
+ write (STDOUT_FILENO , "asdf1" , 5 );
13
+ write (STDOUT_FILENO , "qwer1" , 5 );
14
+ write (STDOUT_FILENO , "zxcv1" , 5 );
15
+ write (STDOUT_FILENO , "qwer2" , 5 );
16
+ printf ("as" );
17
+ printf ("df" );
18
+ printf ("qw" );
19
+ printf ("er" );
20
+ printf ("zx" );
21
+ printf ("cv" );
22
+ fflush (stdout );
12
23
return EXIT_SUCCESS ;
13
24
}
Original file line number Diff line number Diff line change 2
2
define stdout
3
3
catch syscall write
4
4
commands
5
- x /s $rsi
6
- backtrace
5
+ printf " rsi = %s \n " , $rsi
6
+ bt
7
7
continue
8
8
end
9
- # Stop if it contains arg0.
10
- condition 2 $rdi == 1 && strstr((char *)$rsi , " $arg0" ) != NULL
9
+ condition $bpnum $rdi == 1 && strstr((char *)$rsi , " $arg0" ) != NULL
11
10
end
12
- stdout b
11
+ stdout qwer
12
+ i b
13
13
continue
You can’t perform that action at this time.
0 commit comments