simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Simulavr-devel] Crash after entering 'target remote localhost:1212'


From: Joerg Wunsch
Subject: Re: [Simulavr-devel] Crash after entering 'target remote localhost:1212' in avr-gdb
Date: Mon, 1 Feb 2016 23:40:01 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

As Christian Taedcke wrote:

> Why does gdb try to read that address?

Depending on the GDB build, it might or might not access the XML
description.  My GDB version tells me:

(gdb) targ rem :1212
Remote debugging using :1212
warning: Can not parse XML target description; XML support was disabled at 
compile time

In that case, GDB simply doesn't have a notion of the target's flash
size, because it doesn't have any information about the device type
being debugged.

> Can you give me a hint where to
> look?

I don't think it's appropriate to completely bail out in that
situation.  IMHO, simulavr should return an error to GDB.

This is the respective code in AVaRICE:

    case 'm':   // mAA..AA,LLLL  Read LLLL bytes at address AA..AA
    {
        uchar *jtagBuffer;

        if((hexToInt(&ptr, &addr)) &&
           (*(ptr++) == ',') &&
           (hexToInt(&ptr, &length)))
        {
            debugOut("\nGDB: Read %d bytes from 0x%X\n", length, addr);
            try
            {
                jtagBuffer = theJtagICE->jtagRead(addr, length);
                mem2hex(jtagBuffer, remcomOutBuffer, length);
                delete [] jtagBuffer;
            }
            catch (jtag_exception&)
            {
                error(1);
            }
        }
        break;
    }

And error() is defined as:

/** Set remcomOutBuffer to error 'n' response */
static void error(int n)
{
    char *ptr = remcomOutBuffer;

    *ptr++ = 'E';
    ptr = byteToHex(n, ptr);
    *ptr = '\0';
}

Thus, an attempt to read beyond the target's memory presumably would
yield the response E01.
-- 
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]