* PATCH: S/390: don't try to read zero bytes
@ 2001-12-20 0:56 Jim Blandy
2001-12-20 3:10 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2001-12-20 0:56 UTC (permalink / raw)
To: gdb-patches
2001-12-20 Jim Blandy <jimb@redhat.com>
* s390-tdep.c (s390_readinstruction): Don't call
info->read_memory_func to read zero bytes. Some targets'
xfer_memory functions can't cope with that.
Index: gdb/s390-tdep.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/s390-tdep.c,v
retrieving revision 2.33
diff -c -r2.33 s390-tdep.c
*** gdb/s390-tdep.c 2001/12/20 03:25:51 2.33
--- gdb/s390-tdep.c 2001/12/20 07:41:37
***************
*** 132,139 ****
if ((*info->read_memory_func) (at, &instr[0], 2, info))
return -1;
instrlen = s390_instrlen[instr[0] >> 6];
! if ((*info->read_memory_func) (at + 2, &instr[2], instrlen - 2, info))
! return -1;
return instrlen;
}
--- 132,142 ----
if ((*info->read_memory_func) (at, &instr[0], 2, info))
return -1;
instrlen = s390_instrlen[instr[0] >> 6];
! if (instrlen > 2)
! {
! if ((*info->read_memory_func) (at + 2, &instr[2], instrlen - 2, info))
! return -1;
! }
return instrlen;
}
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: PATCH: S/390: don't try to read zero bytes
2001-12-20 0:56 PATCH: S/390: don't try to read zero bytes Jim Blandy
@ 2001-12-20 3:10 ` Andrew Cagney
2001-12-20 12:53 ` Jim Blandy
2001-12-20 12:57 ` Jim Blandy
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cagney @ 2001-12-20 3:10 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
> 2001-12-20 Jim Blandy <jimb@redhat.com>
>
> * s390-tdep.c (s390_readinstruction): Don't call
> info->read_memory_func to read zero bytes. Some targets'
> xfer_memory functions can't cope with that.
>
Jim, which?
While slightly stupid, the target should be able to handle that.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: S/390: don't try to read zero bytes
2001-12-20 3:10 ` Andrew Cagney
@ 2001-12-20 12:53 ` Jim Blandy
2001-12-20 12:57 ` Jim Blandy
1 sibling, 0 replies; 5+ messages in thread
From: Jim Blandy @ 2001-12-20 12:53 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew Cagney <ac131313@cygnus.com> writes:
> > 2001-12-20 Jim Blandy <jimb@redhat.com>
> >
> > * s390-tdep.c (s390_readinstruction): Don't call
> > info->read_memory_func to read zero bytes. Some targets'
> > xfer_memory functions can't cope with that.
>
> Jim, which?
>
> While slightly stupid, the target should be able to handle that.
That was my feeling, as well. xfer_memory, in exec.c, says:
if (len <= 0)
internal_error (__FILE__, __LINE__, "failed internal consistency check");
In my opinion, the test is wrong, the error message is lousy, and it
should be an assert anyway.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: PATCH: S/390: don't try to read zero bytes
2001-12-20 3:10 ` Andrew Cagney
2001-12-20 12:53 ` Jim Blandy
@ 2001-12-20 12:57 ` Jim Blandy
2001-12-23 1:44 ` Andrew Cagney
1 sibling, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2001-12-20 12:57 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew Cagney <ac131313@cygnus.com> writes:
> > 2001-12-20 Jim Blandy <jimb@redhat.com>
> >
> > * s390-tdep.c (s390_readinstruction): Don't call
> > info->read_memory_func to read zero bytes. Some targets'
> > xfer_memory functions can't cope with that.
> >
>
>
> Jim, which?
>
> While slightly stupid, the target should be able to handle that.
Oh, wait, I understand now.
A target's to_xfer_memory function is supposed to return the number of
bytes transferred, or zero if it can't transfer the bytes. If you
make a zero-length request, there's no way for it to indicate success.
D'oh!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: S/390: don't try to read zero bytes
2001-12-20 12:57 ` Jim Blandy
@ 2001-12-23 1:44 ` Andrew Cagney
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2001-12-23 1:44 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
> Andrew Cagney <ac131313@cygnus.com> writes:
>
>> > 2001-12-20 Jim Blandy <jimb@redhat.com>
>> >
>> > * s390-tdep.c (s390_readinstruction): Don't call
>> > info->read_memory_func to read zero bytes. Some targets'
>> > xfer_memory functions can't cope with that.
>> >
>
>>
>>
>> Jim, which?
>>
>> While slightly stupid, the target should be able to handle that.
>
>
> Oh, wait, I understand now.
>
> A target's to_xfer_memory function is supposed to return the number of
> bytes transferred, or zero if it can't transfer the bytes. If you
> make a zero-length request, there's no way for it to indicate success.
> D'oh!
Can you file a CR against this stupidity? I'll add it to my list of
things to untangle.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-12-23 9:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-20 0:56 PATCH: S/390: don't try to read zero bytes Jim Blandy
2001-12-20 3:10 ` Andrew Cagney
2001-12-20 12:53 ` Jim Blandy
2001-12-20 12:57 ` Jim Blandy
2001-12-23 1:44 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox