This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi,
I got and test the multiprocess branch. And can't find a interface to
switch the process.
So I make this example patch make multiprocess be switched in
linux-nat. It still have a lot of bugs.
I will make it better if you guys like it.
Example:
(gdb) list
During symbol reading, DW_AT_name missing from DW_TAG_base_type.
5 #include <unistd.h>
6 #include <errno.h>
7 #include <sys/stat.h>
8 #include <fcntl.h>
9 #include <stdint.h>
10
11 int
12 main(int argc,char *argv[],char *envp[])
13 {
14 pid_t pid = fork ();
(gdb)
15
16 if (pid == 0) {
17 while (1) {
18 printf ("%d: C\n", getpid ());
19 sleep (2);
20 }
21 }
22 else {
23 while (1) {
24 printf ("%d: F\n", getpid ());
(gdb)
25 sleep (2);
26 }
27 }
28
29 return (0);
30 }
31
(gdb) set detach-on-fork off
(gdb) set follow-fork-mode child
(gdb) r
Starting program: /home/teawater/multiprocess/a.out
9004: C
9001: F
9004: C
9001: F
9004: C
9001: F
Program received signal SIGINT, Interrupt.
0xb7fe3410 in __kernel_vsyscall ()
(gdb) info inferiors
3 9004 a.out
* 2 9001 a.out
1 0 #a.out# /home/teawater/multiprocess/a.out
(gdb) b 18
Breakpoint 1 at 0x8048433: file 1.c, line 18.
(gdb) c
Continuing.
9004: C
9001: F
9004: C
9001: F
Program received signal SIGINT, Interrupt.
0xb7fe3410 in __kernel_vsyscall ()
(gdb) switch-inferior 3
(gdb) c
Continuing.
9001: F
Breakpoint 1, main (argc=<value optimized out>, argv=<value optimized out>,
envp=<value optimized out>) at 1.c:18
18 printf ("%d: C\n", getpid ());
Thanks,
Hui
Attachment:
inferior-switch.txt
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |