Switching architectures from a remote target

Jan Kiszka jan.kiszka@siemens.com
Fri Feb 5 12:29:00 GMT 2010

Hui Zhu wrote:
> Try "set architecture"
> But I don't have a inferior that can change bit when it's debug. I
> don't sure if it works or not.

qemu's gdbstub is an example for such a scenario. It currently switches
the arch dynamically when the guest moves from 32 to 64 bit mode and
vice versa. Not nice, but the best we can do until someone (us included)
finds the time to fix x86 gdb.


> On Fri, Feb 5, 2010 at 03:38, Robert Barnes <robcb85@gmail.com> wrote:
>> I am using GDB to interface with a remote target over serial. The
>> target architecture changes during execution (e.g. 32-bit to 64-bit).
>> When the architecture changes I need gdb to change its internal
>> representation of the remote architecture at the same time. The
>> primary problem is the remote 'g' command, it's return packet size is
>> determined by the initial call. When the architecture changes, the
>> size and number of registers may change, thus the size of the 'g'
>> packet changes. Yet gdb is still expecting the old size.
>> This problem is addressed in section 7 of "Multi-arching Insights and
>> GDB" by Andrew Cagney
>> (http://www.gnu.org/software/gdb/papers/multi-arch/real-multi-arch/).
>> As far as I can tell the recommendations haven't been implemented.
>> Are there any workarounds or solutions to the general problem of
>> handling changing architectures on a remote target?
>> Thanks!
>> -Rob

Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

More information about the Gdb mailing list