* Problem in gdbtk-cmds.c
@ 1999-11-06 12:12 Staggs, Kevin P (AZ75)
1999-11-06 22:50 ` Andrew Cagney
1999-11-08 20:57 ` Andrew Cagney
0 siblings, 2 replies; 4+ messages in thread
From: Staggs, Kevin P (AZ75) @ 1999-11-06 12:12 UTC (permalink / raw)
To: 'insight@sourceware.cygnus.com'
Hello,
I have found a problem in gdbtk-cmds.c in the 19991018 version. Line 3262
of gdbtk-cmds.c is as follows:
rnum = target_read_memory_partial (addr, mbuf, nbytes, NULL);
The target_read_memory_partion function is in target.c at line 943 and looks
like:
int
target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
{
return target_xfer_memory_partial (memaddr, buf, len, 0, err);
}
Immediately above in target.c is the target_xfer_memory_partial function.
Most of the successful paths will write a 0 to *err and *err is set to NULL.
This results in a segmentation violation in insight and a crash.
Thanks
Kevin Staggs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem in gdbtk-cmds.c
1999-11-06 12:12 Problem in gdbtk-cmds.c Staggs, Kevin P (AZ75)
@ 1999-11-06 22:50 ` Andrew Cagney
1999-11-08 20:57 ` Andrew Cagney
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 1999-11-06 22:50 UTC (permalink / raw)
To: Staggs, Kevin P (AZ75); +Cc: 'insight@sourceware.cygnus.com'
"Staggs, Kevin P (AZ75)" wrote:
>
> Hello,
> I have found a problem in gdbtk-cmds.c in the 19991018 version. Line 3262
> of gdbtk-cmds.c is as follows:
> rnum = target_read_memory_partial (addr, mbuf, nbytes, NULL);
> The target_read_memory_partion function is in target.c at line 943 and looks
> like:
> int
> target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
> {
> return target_xfer_memory_partial (memaddr, buf, len, 0, err);
> }
> Immediately above in target.c is the target_xfer_memory_partial function.
> Most of the successful paths will write a 0 to *err and *err is set to NULL.
> This results in a segmentation violation in insight and a crash.
>
> Thanks
> Kevin Staggs
Er, yes. My fault. I'll check in a change in the next day.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem in gdbtk-cmds.c
1999-11-06 12:12 Problem in gdbtk-cmds.c Staggs, Kevin P (AZ75)
1999-11-06 22:50 ` Andrew Cagney
@ 1999-11-08 20:57 ` Andrew Cagney
1999-11-09 9:30 ` James Ingham
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 1999-11-08 20:57 UTC (permalink / raw)
To: Staggs, Kevin P (AZ75); +Cc: 'insight@sourceware.cygnus.com'
Hello,
The attatched should fix the problem. It updates the code to match the
new semantics of target_read_memory_partial.
JimI, Ok?
Andrew
"Staggs, Kevin P (AZ75)" wrote:
>
> Hello,
> I have found a problem in gdbtk-cmds.c in the 19991018 version. Line 3262
> of gdbtk-cmds.c is as follows:
> rnum = target_read_memory_partial (addr, mbuf, nbytes, NULL);
> The target_read_memory_partion function is in target.c at line 943 and looks
> like:
> int
> target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
> {
> return target_xfer_memory_partial (memaddr, buf, len, 0, err);
> }
> Immediately above in target.c is the target_xfer_memory_partial function.
> Most of the successful paths will write a 0 to *err and *err is set to NULL.
> This results in a segmentation violation in insight and a crash.
>
> Thanks
> Kevin Staggs
Tue Nov 9 15:40:51 1999 Andrew Cagney <cagney@b1.cygnus.com>
* gdbtk-cmds.c (gdb_get_mem): Keep calling
target_read_memory_partial until all the data is read.
Index: gdbtk-cmds.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtk-cmds.c,v
retrieving revision 2.62
diff -p -r2.62 gdbtk-cmds.c
*** gdbtk-cmds.c 1999/11/02 00:27:40 2.62
--- gdbtk-cmds.c 1999/11/09 04:52:20
*************** gdb_get_mem (clientData, interp, objc, o
*** 3259,3265 ****
memset (mbuf, 0, nbytes + 32);
mptr = cptr = mbuf;
! rnum = target_read_memory_partial (addr, mbuf, nbytes, NULL);
if (objc == 7)
aschar = *(Tcl_GetStringFromObj (objv[6], NULL));
--- 3259,3274 ----
memset (mbuf, 0, nbytes + 32);
mptr = cptr = mbuf;
! rnum = 0;
! while (rnum < nbytes)
! {
! int error;
! int num = target_read_memory_partial (addr + rnum, mbuf + rnum,
! nbytes - rnum, &error);
! if (num <= 0)
! break;
! rnum += num;
! }
if (objc == 7)
aschar = *(Tcl_GetStringFromObj (objv[6], NULL));
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem in gdbtk-cmds.c
1999-11-08 20:57 ` Andrew Cagney
@ 1999-11-09 9:30 ` James Ingham
0 siblings, 0 replies; 4+ messages in thread
From: James Ingham @ 1999-11-09 9:30 UTC (permalink / raw)
To: Andrew Cagney
Cc: Staggs, Kevin P (AZ75), 'insight@sourceware.cygnus.com'
Andrew,
Looks okay to me.
Jim
> Hello,
>
> The attatched should fix the problem. It updates the code to match the
> new semantics of target_read_memory_partial.
>
> JimI, Ok?
>
> Andrew
>
> "Staggs, Kevin P (AZ75)" wrote:
> >
> > Hello,
> > I have found a problem in gdbtk-cmds.c in the 19991018 version. Line 3262
> > of gdbtk-cmds.c is as follows:
> > rnum = target_read_memory_partial (addr, mbuf, nbytes, NULL);
> > The target_read_memory_partion function is in target.c at line 943 and looks
> > like:
> > int
> > target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
> > {
> > return target_xfer_memory_partial (memaddr, buf, len, 0, err);
> > }
> > Immediately above in target.c is the target_xfer_memory_partial function.
> > Most of the successful paths will write a 0 to *err and *err is set to NULL.
> > This results in a segmentation violation in insight and a crash.
> >
> > Thanks
> > Kevin StaggsTue Nov 9 15:40:51 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * gdbtk-cmds.c (gdb_get_mem): Keep calling
> target_read_memory_partial until all the data is read.
>
> Index: gdbtk-cmds.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/gdbtk-cmds.c,v
> retrieving revision 2.62
> diff -p -r2.62 gdbtk-cmds.c
> *** gdbtk-cmds.c 1999/11/02 00:27:40 2.62
> --- gdbtk-cmds.c 1999/11/09 04:52:20
> *************** gdb_get_mem (clientData, interp, objc, o
> *** 3259,3265 ****
> memset (mbuf, 0, nbytes + 32);
> mptr = cptr = mbuf;
>
> ! rnum = target_read_memory_partial (addr, mbuf, nbytes, NULL);
>
> if (objc == 7)
> aschar = *(Tcl_GetStringFromObj (objv[6], NULL));
> --- 3259,3274 ----
> memset (mbuf, 0, nbytes + 32);
> mptr = cptr = mbuf;
>
> ! rnum = 0;
> ! while (rnum < nbytes)
> ! {
> ! int error;
> ! int num = target_read_memory_partial (addr + rnum, mbuf + rnum,
> ! nbytes - rnum, &error);
> ! if (num <= 0)
> ! break;
> ! rnum += num;
> ! }
>
> if (objc == 7)
> aschar = *(Tcl_GetStringFromObj (objv[6], NULL));
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-11-09 9:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-06 12:12 Problem in gdbtk-cmds.c Staggs, Kevin P (AZ75)
1999-11-06 22:50 ` Andrew Cagney
1999-11-08 20:57 ` Andrew Cagney
1999-11-09 9:30 ` James Ingham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).