remote/2158: Memory access error while loading section .text, Escape characters

ronald.hecht@gmx.de ronald.hecht@gmx.de
Thu Aug 17 13:28:00 GMT 2006


>Number:         2158
>Category:       remote
>Synopsis:       Memory access error while loading section .text, Escape characters
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 17 13:28:01 UTC 2006
>Closed-Date:
>Last-Modified:
>Originator:     Ronald Hecht
>Release:        6.5.50.20060817-cvs
>Organization:
>Environment:
Linux Fedora Core 4
>Description:
While porting to a new target, I found a problem downloading the executable into the SID simulator. I'm getting the following error message:

Loading section .text, size 0x45 lma 0x0
Memory access error while loading section .text.
>How-To-Repeat:
Difficult, as I'm working on a new target.
>Fix:
I tracked down the problem to a possible bug in remote.c/remote_write_bytes(). When sending characters to be escaped the following code is in my opinion wrongly executed:

      /* If not all TODO bytes fit, then we'll need another packet.  Make
	 a second try to keep the end of the packet aligned.  */
      if (nr_bytes < todo)
	{
	  int new_nr_bytes;

	  new_nr_bytes = (((memaddr + nr_bytes) & ~(REMOTE_ALIGN_WRITES - 1))
			  - memaddr);
	  if (new_nr_bytes != nr_bytes)
	    payload_length = remote_escape_output (myaddr, new_nr_bytes,
						   p, &nr_bytes,
						   payload_size);
	}

I just commented it out, which fixed the problem for me. The executable is downloaded correctly. If I'm not mistaken, the subsequent code solves the length problem with escape characters. Attached is the file with the commented-out region.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="remote.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="remote.c"

LyogUmVtb3RlIHRhcmdldCBjb21tdW5pY2F0aW9ucyBmb3Igc2VyaWFsLWxpbmUgdGFyZ2V0cyBp
biBjdXN0b20gR0RCIHByb3RvY29sCgogICBDb3B5cmlnaHQgKEMpIDE5ODgsIDE5ODksIDE5OTAs
IDE5OTEsIDE5OTIsIDE5OTMsIDE5OTQsIDE5OTUsI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ewogICAgICAqdmFsID0gY2ggLSAnYScgKyAxMDsKICAg
ICAgcmV0dXJuIDE7CiAgICB9CiAgaWYgKChjaCA+PSAnQScpICYmIChjaCA8PSAnRicpKQogICAg
ewogICAgICAqdmFsID0gY2ggLSAnQScgKyAxMDsKICAgICAgcmV0dXJuIDE7CiAgICB9CiAgaWYg
KChjaCA+PSAnMCcpICYmIChjaCA8PSAnOScpKQogICAgewogICAgICAqdmFsID0gY2ggLSAnMCc7
CiAgICAgIHJldHVybiAxOwogICAgfQogIHJldHVybiAwOwp9CgpzdGF0aWMgaW50CnN0dWJoZXgg
KGludCBjaCkKewogIGlmIChjaCA+PSAnYScgJiYgY2ggPD0gJ2YnKQogICAgcmV0dXJuIGNoIC0g
J2EnICsgMTA7CiAgaWYgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpCiAgICByZXR1cm4gY2ggLSAn
MCc7CiAgaWYgKGNoID49ICdBJyAmJiBjaCA8PSAnRicpCiAgICByZXR1cm4gY2ggLSAnQScgKyAx
MDsKICByZXR1cm4gLTE7Cn0KCnN0YXRpYyBpbnQKc3R1Yl91bnBhY2tfaW50IChjaGFyICpidWZm
LCBpbnQgZmllbGRsZW5ndGgpCnsKICBpbnQgbmliYmxlOwogIGludCByZXR2YWwgPSAwOwoKICB3
aGlsZSAoZmllbGRsZW5ndGgpCiAgICB7CiAgICAgIG5pYmJsZSA9IHN0dWJoZXggKCpidWZmKysp
OwogICAgICByZXR2YWwgfD0gbmliYmxlOwogICAgICBmaWVsZGxlbmd0aC0tOwogICAgICBpZiAo
ZmllbGRsZW5ndGgpCglyZXR2YWwgPSByZXR2YWwgPDwgNDsKICAgIH0KICByZXR1cm4gcmV0dmFs
Owp9CgpjaGFyICoKdW5wYWNrX3Zhcmxlbl9oZXggKGNoYXIgKmJ1ZmYsCS8qIHBhY2tldCB0byBw
YXJzZSAqLwoJCSAgIFVMT05HRVNUICpyZXN1bHQpCnsKICBpbnQgbmliYmxlOwogIFVMT05HRVNU
IHJldH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