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]

Re: [patch] Fix Linux attach to signalled/stopped processes


Daniel Jacobowitz <drow@false.org> writes:

> +# Start the program running and then wait for a bit, to be sure
> +# that it can be attached to.
> +
> +set testpid [eval exec $binfile &]
> +
> +# No race
> +sleep 2
> +
> +# Do not: set testpid2 [expr $testpid + 1]
> +# as it will not exist on Red Hat 2.6.9-34.0.2.ELsmp
> +set testpid2 [expr $testpid + 2]
> +
> +set status2 /proc/${testpid}/task/${testpid2}/status
> +if {[expr ! [file exists $status2]]} {
> +  # kernel-2.4
> +  set status2 /proc/${testpid2}/status
> +}

There is no reason that this is required to work.  Even if pids are
allocated in increasing order there can be arbitrary other processes
created between the start of the process and the creation of its
threads.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]