This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: remote/1836: Memory access error while loading section xxx
- From: Ivan Djelic <ivan dot djelic at parrot dot fr>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 4 Apr 2005 16:48:03 -0000
- Subject: Re: remote/1836: Memory access error while loading section xxx
- Reply-to: Ivan Djelic <ivan dot djelic at parrot dot fr>
The following reply was made to PR remote/1836; it has been noted by GNATS.
From: Ivan Djelic <ivan.djelic@parrot.fr>
To: gdb-gnats@sources.redhat.com, sbalasubramanian@ra.rockwell.com
Cc:
Subject: Re: remote/1836: Memory access error while loading section xxx
Date: Mon, 4 Apr 2005 18:56:43 +0200
--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi All,
While the suggested fix works, it may be safer to correct the problem by
setting 'err' in function 'target_write_memory_partial()' itself, as it may be
called from some other place in the code, with the same nasty effect. BTW, the
same problem also appears in 'target_read_memory_partial()'.
I attached a small patch that fixes both functions.
Regards,
Ivan Djelic
--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="uninitialized_err_patch_gdb-6.3.diff"
diff -c -N -r gdb-6.3_orig/gdb/target.c gdb-6.3/gdb/target.c
*** gdb-6.3_orig/gdb/target.c 2004-10-08 22:29:55.000000000 +0200
--- gdb-6.3/gdb/target.c 2005-04-04 17:33:12.370259856 +0200
***************
*** 1232,1240 ****
int
target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
{
! if (target_xfer_partial_p ())
return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
buf, NULL, memaddr, len);
else
return target_xfer_memory_partial (memaddr, buf, len, 0, err);
}
--- 1232,1242 ----
int
target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
{
! if (target_xfer_partial_p ()) {
! *err = 0;
return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
buf, NULL, memaddr, len);
+ }
else
return target_xfer_memory_partial (memaddr, buf, len, 0, err);
}
***************
*** 1242,1250 ****
int
target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
{
! if (target_xfer_partial_p ())
return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
NULL, buf, memaddr, len);
else
return target_xfer_memory_partial (memaddr, buf, len, 1, err);
}
--- 1244,1254 ----
int
target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
{
! if (target_xfer_partial_p ()) {
! *err = 0;
return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
NULL, buf, memaddr, len);
+ }
else
return target_xfer_memory_partial (memaddr, buf, len, 1, err);
}
--X1bOJ3K7DJ5YkBrT--