* gdb x86_64 ERESTARTNOHAND
@ 2005-06-14 13:56 Rich Coe
2005-06-14 14:33 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Rich Coe @ 2005-06-14 13:56 UTC (permalink / raw)
To: gdb
Run the program below in gdb on x86_64, compiled either -m32 or 64 bit,
stop the execution with control-C
call a function, in this case doNothing(), but sleep(1) works as well
continue
gdb passes errno 514 to the program. 514=ERESTARTNOHAND
I see that strace prints out information about ERESTARTNOHAND, so it knows
about it. I was wondering if gdb should know about this, is this an
x86_64 kernel error, or what?
Even though strace knows about ERESTARTNOHAND on i386, and prints it,
gdb does not print or cause the program to receive this errno on a 32bit kernel.
--
Rich Coe richard.coe@med.ge.com
General Electric Healthcare Technologies
Global Software Platforms, Computer Technology Team
#include <stdio.h>
#include <sys/select.h>
#include <errno.h>
#include <signal.h>
int myselect(int fd, void* ptr)
{
printf("myselect\n");
fd_set in;
AGAIN:
FD_ZERO(&in);
FD_SET(fd, &in);
if(select(32, &in, 0, 0, 0) == -1)
{
printf("select error=%d: %s\n", errno, strerror(errno));
}
goto AGAIN;
return 0;
}
int func_two(int fd, void* ptr)
{
printf("func_two\n");
return myselect(fd, ptr);
}
int func_one(int fd, void*ptr)
{
printf("func_one\n");
return func_two(fd, ptr);
}
void catch(int sig)
{
char buf[218];
sprintf(buf, "caught %d\n", sig);
write(fileno(stdout), buf, strlen(buf));
}
void docatch()
{
struct sigaction act = { 0 } ;
act.sa_handler = catch;
//act.sa_mask = 0;
act.sa_flags = 0;
/* auto restart interrupted system calls */
act.sa_flags = SA_RESTART;
if(sigaction(SIGINT, &act, NULL) < 0) {
perror(__FILE__ ": sigaction");
exit(1);
}
if(sigaction(SIGHUP, &act, NULL) < 0) {
perror(__FILE__ ": sigaction");
exit(1);
}
if(sigaction(SIGTERM, &act, NULL) < 0) {
perror(__FILE__ ": sigaction");
exit(1);
}
}
int a = 0;
void
doNothing()
{
a += 5;
}
int main(int argc, char*argv[])
{
doNothing();
docatch();
printf("main\n");
return func_one(fileno(stdin), myselect);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb x86_64 ERESTARTNOHAND
2005-06-14 13:56 gdb x86_64 ERESTARTNOHAND Rich Coe
@ 2005-06-14 14:33 ` Daniel Jacobowitz
2005-06-14 20:21 ` Rich Coe
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-06-14 14:33 UTC (permalink / raw)
To: Rich Coe; +Cc: gdb
On Tue, Jun 14, 2005 at 08:54:25AM -0500, Rich Coe wrote:
> Run the program below in gdb on x86_64, compiled either -m32 or 64 bit,
> stop the execution with control-C
> call a function, in this case doNothing(), but sleep(1) works as well
> continue
> gdb passes errno 514 to the program. 514=ERESTARTNOHAND
>
> I see that strace prints out information about ERESTARTNOHAND, so it knows
> about it. I was wondering if gdb should know about this, is this an
> x86_64 kernel error, or what?
>
> Even though strace knows about ERESTARTNOHAND on i386, and prints it,
> gdb does not print or cause the program to receive this errno on a 32bit kernel.
amd64-linux-tdep.c requires a write_pc method, just like the one in
i386-linux-tdep.c. Nice catch.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb x86_64 ERESTARTNOHAND
2005-06-14 14:33 ` Daniel Jacobowitz
@ 2005-06-14 20:21 ` Rich Coe
2005-06-14 20:25 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Rich Coe @ 2005-06-14 20:21 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb
when running 32bit apps on a 64bit system, doesn't gdb use
i386-linux-tdep ?
On Tue, 14 Jun 2005 10:32:52 -0400
Daniel Jacobowitz <drow@false.org> wrote:
> On Tue, Jun 14, 2005 at 08:54:25AM -0500, Rich Coe wrote:
> > Run the program below in gdb on x86_64, compiled either -m32 or 64 bit,
> > stop the execution with control-C
> > call a function, in this case doNothing(), but sleep(1) works as well
> > continue
> > gdb passes errno 514 to the program. 514=ERESTARTNOHAND
> >
> > I see that strace prints out information about ERESTARTNOHAND, so it knows
> > about it. I was wondering if gdb should know about this, is this an
> > x86_64 kernel error, or what?
> >
> > Even though strace knows about ERESTARTNOHAND on i386, and prints it,
> > gdb does not print or cause the program to receive this errno on a 32bit kernel.
>
> amd64-linux-tdep.c requires a write_pc method, just like the one in
> i386-linux-tdep.c. Nice catch.
>
> --
> Daniel Jacobowitz
> CodeSourcery, LLC
>
--
Rich Coe richard.coe@med.ge.com
General Electric Healthcare Technologies
Global Software Platforms, Computer Technology Team
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gdb x86_64 ERESTARTNOHAND
2005-06-14 20:21 ` Rich Coe
@ 2005-06-14 20:25 ` Daniel Jacobowitz
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-06-14 20:25 UTC (permalink / raw)
To: Rich Coe; +Cc: gdb
On Tue, Jun 14, 2005 at 03:19:27PM -0500, Rich Coe wrote:
> when running 32bit apps on a 64bit system, doesn't gdb use
> i386-linux-tdep ?
It ought to. I hadn't stopped to think about that; it's odd that you
see the problem for -m32. I'm afraid I can't guess why without time to
reproduce it myself.
The 64-bit file probably wants a fix for this, anyway.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-14 20:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-14 13:56 gdb x86_64 ERESTARTNOHAND Rich Coe
2005-06-14 14:33 ` Daniel Jacobowitz
2005-06-14 20:21 ` Rich Coe
2005-06-14 20:25 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox