From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12904 invoked by alias); 26 Sep 2006 15:27:23 -0000 Received: (qmail 12896 invoked by uid 22791); 26 Sep 2006 15:27:22 -0000 X-Spam-Check-By: sourceware.org Received: from 195.22.55.53.adsl.nextra.cz (HELO host0.dyn.jankratochvil.net) (195.22.55.53) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 26 Sep 2006 15:27:19 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.13.8/8.13.8) with ESMTP id k8QFRGpB006858 for ; Tue, 26 Sep 2006 17:27:16 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.13.8/8.13.8/Submit) id k8QFRFB3006857 for gdb-patches@sourceware.org; Tue, 26 Sep 2006 17:27:15 +0200 Date: Tue, 26 Sep 2006 15:27:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Suggest fixing your target for gdbserver(1) Message-ID: <20060926152715.GA5860@host0.dyn.jankratochvil.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00187.txt.bz2 --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1045 Hi, x86_64 defaults (by bfd matching) to target "i386" instead of its native "i386:x86_64". Therefore if you connect to gdbserver(1) without any `file' or `set architecture' command before the communication will crash on a different expected register sizes. As implementing architecture negotiation is complicated due to gdbserver(1) not being aware of bfd-compatible name of its target and also it may be also unclear to automatically change the target while working remotely it is just suggesting to double-check which architecture you are using. (gdb) target remote localhost:1234 Remote debugging using localhost:1234 Remote debugging from host 127.0.0.1 Remote register badly formatted: T0506:0000000000000000;07:40daffbf7f000000;10:506b55952a000000; readchar: Got EOF here: 0000000;07:40daffbf7f000000;10:506b55952a000000; Try to load the executable by `file' first, you may also check `set/show architecture'. (gdb) Remote side has terminated connection. GDBserver will reopen the connection. Listening on port 1234 Regards, Jan --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-6.5-gdbserver-arch-advice.patch" Content-length: 1566 2006-09-26 Jan Kratochvil * remote.c (remote_wait): Suggestion on crash due to nonmatching target. (remote_async_wait): Likewise. Index: gdb/remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.230 diff -u -p -r1.230 remote.c --- gdb/remote.c 22 Sep 2006 13:50:36 -0000 1.230 +++ gdb/remote.c 26 Sep 2006 15:15:32 -0000 @@ -3103,8 +3103,13 @@ Packet: '%s'\n"), reg->regnum, regs); } + /* It may also occur on amd64 which defaults to 32-bit i386 + target. gdbserver(1) is not aware of the `set architecture' + name itself as it is not using libbfd. */ if (*p++ != ';') - error (_("Remote register badly formatted: %s\nhere: %s"), + error (_("Remote register badly formatted: %s\nhere: %s" + "\nTry to load the executable by `file' first," + "\nyou may also check `set/show architecture'."), buf, p); } } @@ -3299,8 +3304,13 @@ Packet: '%s'\n"), regcache_raw_supply (current_regcache, reg->regnum, regs); } + /* It may also occur on amd64 which defaults to 32-bit i386 + target. gdbserver(1) is not aware of the `set architecture' + name itself as it is not using libbfd. */ if (*p++ != ';') - error (_("Remote register badly formatted: %s\nhere: %s"), + error (_("Remote register badly formatted: %s\nhere: %s" + "\nTry to load the executable by `file' first," + "\nyou may also check `set/show architecture'."), buf, p); } } --M9NhX3UHpAaciwkO--