* [RFA] linux-nat.c, linux_thread_alive, user errno instead of err
@ 2011-03-01 23:55 Michael Snyder
2011-03-02 0:09 ` Mark Kettenis
0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2011-03-01 23:55 UTC (permalink / raw)
To: gdb-patches, Pedro Alves
[-- Attachment #1: Type: text/plain, Size: 32 bytes --]
kill_lwp doesn't return errno.
[-- Attachment #2: errno.txt --]
[-- Type: text/plain, Size: 694 bytes --]
2011-03-01 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
* linux-nat.c (linux_thread_alive): kill_lwp does not return
an errno.
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.197
diff -u -p -u -p -r1.197 linux-nat.c
--- linux-nat.c 1 Mar 2011 00:40:22 -0000 1.197
+++ linux-nat.c 1 Mar 2011 23:50:34 -0000
@@ -4045,7 +4045,7 @@ linux_thread_alive (ptid_t ptid)
fprintf_unfiltered (gdb_stdlog,
"LLTA: KILL(SIG0) %s (%s)\n",
target_pid_to_str (ptid),
- err ? safe_strerror (err) : "OK");
+ err ? safe_strerror (errno) : "OK");
if (err != 0)
return 0;
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [RFA] linux-nat.c, linux_thread_alive, user errno instead of err
2011-03-01 23:55 [RFA] linux-nat.c, linux_thread_alive, user errno instead of err Michael Snyder
@ 2011-03-02 0:09 ` Mark Kettenis
2011-03-02 1:18 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Mark Kettenis @ 2011-03-02 0:09 UTC (permalink / raw)
To: msnyder; +Cc: gdb-patches, pedro
> Date: Tue, 01 Mar 2011 15:55:32 -0800
> From: Michael Snyder <msnyder@vmware.com>
>
> kill_lwp doesn't return errno.
Makes sense to me.
> 2011-03-01 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
>
> * linux-nat.c (linux_thread_alive): kill_lwp does not return
> an errno.
>
> Index: linux-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/linux-nat.c,v
> retrieving revision 1.197
> diff -u -p -u -p -r1.197 linux-nat.c
> --- linux-nat.c 1 Mar 2011 00:40:22 -0000 1.197
> +++ linux-nat.c 1 Mar 2011 23:50:34 -0000
> @@ -4045,7 +4045,7 @@ linux_thread_alive (ptid_t ptid)
> fprintf_unfiltered (gdb_stdlog,
> "LLTA: KILL(SIG0) %s (%s)\n",
> target_pid_to_str (ptid),
> - err ? safe_strerror (err) : "OK");
> + err ? safe_strerror (errno) : "OK");
>
> if (err != 0)
> return 0;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] linux-nat.c, linux_thread_alive, user errno instead of err
2011-03-02 0:09 ` Mark Kettenis
@ 2011-03-02 1:18 ` Pedro Alves
2011-03-02 18:01 ` Michael Snyder
0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2011-03-02 1:18 UTC (permalink / raw)
To: gdb-patches; +Cc: Mark Kettenis, msnyder
> > --- linux-nat.c 1 Mar 2011 00:40:22 -0000 1.197
> > +++ linux-nat.c 1 Mar 2011 23:50:34 -0000
> > @@ -4045,7 +4045,7 @@ linux_thread_alive (ptid_t ptid)
> > fprintf_unfiltered (gdb_stdlog,
> > "LLTA: KILL(SIG0) %s (%s)\n",
> > target_pid_to_str (ptid),
> > - err ? safe_strerror (err) : "OK");
> > + err ? safe_strerror (errno) : "OK");
Not 100% correct. target_pid_to_str is allowed to
clobber errno (as any function call is).
> >
> > if (err != 0)
> > return 0;
>
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] linux-nat.c, linux_thread_alive, user errno instead of err
2011-03-02 1:18 ` Pedro Alves
@ 2011-03-02 18:01 ` Michael Snyder
2011-03-02 18:04 ` Pedro Alves
0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2011-03-02 18:01 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, Mark Kettenis
[-- Attachment #1: Type: text/plain, Size: 504 bytes --]
Pedro Alves wrote:
>>> --- linux-nat.c 1 Mar 2011 00:40:22 -0000 1.197
>>> +++ linux-nat.c 1 Mar 2011 23:50:34 -0000
>>> @@ -4045,7 +4045,7 @@ linux_thread_alive (ptid_t ptid)
>>> fprintf_unfiltered (gdb_stdlog,
>>> "LLTA: KILL(SIG0) %s (%s)\n",
>>> target_pid_to_str (ptid),
>>> - err ? safe_strerror (err) : "OK");
>>> + err ? safe_strerror (errno) : "OK");
>
> Not 100% correct. target_pid_to_str is allowed to
> clobber errno (as any function call is).
OK. How about this then?
[-- Attachment #2: errno2.txt --]
[-- Type: text/plain, Size: 908 bytes --]
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.197
diff -u -p -u -p -r1.197 linux-nat.c
--- linux-nat.c 1 Mar 2011 00:40:22 -0000 1.197
+++ linux-nat.c 2 Mar 2011 18:00:39 -0000
@@ -4032,7 +4032,7 @@ linux_nat_xfer_partial (struct target_op
static int
linux_thread_alive (ptid_t ptid)
{
- int err;
+ int err, tmp_errno;
gdb_assert (is_lwp (ptid));
@@ -4040,12 +4040,12 @@ linux_thread_alive (ptid_t ptid)
running thread errors out claiming that the thread doesn't
exist. */
err = kill_lwp (GET_LWP (ptid), 0);
-
+ tmp_errno = errno;
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLTA: KILL(SIG0) %s (%s)\n",
target_pid_to_str (ptid),
- err ? safe_strerror (err) : "OK");
+ err ? safe_strerror (tmp_errno) : "OK");
if (err != 0)
return 0;
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [RFA] linux-nat.c, linux_thread_alive, user errno instead of err
2011-03-02 18:01 ` Michael Snyder
@ 2011-03-02 18:04 ` Pedro Alves
2011-03-02 18:28 ` Michael Snyder
0 siblings, 1 reply; 6+ messages in thread
From: Pedro Alves @ 2011-03-02 18:04 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches, Mark Kettenis
On Wednesday 02 March 2011 18:01:18, Michael Snyder wrote:
> Pedro Alves wrote:
> >>> --- linux-nat.c 1 Mar 2011 00:40:22 -0000 1.197
> >>> +++ linux-nat.c 1 Mar 2011 23:50:34 -0000
> >>> @@ -4045,7 +4045,7 @@ linux_thread_alive (ptid_t ptid)
> >>> fprintf_unfiltered (gdb_stdlog,
> >>> "LLTA: KILL(SIG0) %s (%s)\n",
> >>> target_pid_to_str (ptid),
> >>> - err ? safe_strerror (err) : "OK");
> >>> + err ? safe_strerror (errno) : "OK");
> >
> > Not 100% correct. target_pid_to_str is allowed to
> > clobber errno (as any function call is).
>
> OK. How about this then?
That's it, thanks.
--
Pedro Alves
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] linux-nat.c, linux_thread_alive, user errno instead of err
2011-03-02 18:04 ` Pedro Alves
@ 2011-03-02 18:28 ` Michael Snyder
0 siblings, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2011-03-02 18:28 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches, Mark Kettenis
Pedro Alves wrote:
> On Wednesday 02 March 2011 18:01:18, Michael Snyder wrote:
>> Pedro Alves wrote:
>>>>> --- linux-nat.c 1 Mar 2011 00:40:22 -0000 1.197
>>>>> +++ linux-nat.c 1 Mar 2011 23:50:34 -0000
>>>>> @@ -4045,7 +4045,7 @@ linux_thread_alive (ptid_t ptid)
>>>>> fprintf_unfiltered (gdb_stdlog,
>>>>> "LLTA: KILL(SIG0) %s (%s)\n",
>>>>> target_pid_to_str (ptid),
>>>>> - err ? safe_strerror (err) : "OK");
>>>>> + err ? safe_strerror (errno) : "OK");
>>> Not 100% correct. target_pid_to_str is allowed to
>>> clobber errno (as any function call is).
>> OK. How about this then?
>
> That's it, thanks.
>
So committed. Thanks for the review.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-03-02 18:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01 23:55 [RFA] linux-nat.c, linux_thread_alive, user errno instead of err Michael Snyder
2011-03-02 0:09 ` Mark Kettenis
2011-03-02 1:18 ` Pedro Alves
2011-03-02 18:01 ` Michael Snyder
2011-03-02 18:04 ` Pedro Alves
2011-03-02 18:28 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox