1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2009, 2010 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 Do not use threads as we need to exploit a bug in LWP code masked by the
19 threads code otherwise.
21 INFERIOR_PTID must point to exited LWP. Here we use the initial LWP as it
22 is automatically INFERIOR_PTID for GDB.
24 Finally we need to call target_resume (RESUME_ALL, ...) which we invoke by
25 NEW_THREAD_EVENT (called from the new LWP as initial LWP is exited now). */
33 #define STACK_SIZE 0x1000
36 fn_return (void *unused
)
38 return 0; /* at-fn_return */
51 stack
= malloc (STACK_SIZE
);
52 assert (stack
!= NULL
);
54 new_pid
= clone (fn_return
, stack
+ STACK_SIZE
, CLONE_FILES
| CLONE_VM
, NULL
,
62 main (int argc
, char **argv
)
67 stack
= malloc (STACK_SIZE
);
68 assert (stack
!= NULL
);
70 new_pid
= clone (fn
, stack
+ STACK_SIZE
, CLONE_FILES
| CLONE_VM
, NULL
, NULL
,
This page took 0.032484 seconds and 4 git commands to generate.