NetBSD Problem Report #54154

From gson@gson.org  Fri May  3 07:44:20 2019
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7F4BB7A177
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  3 May 2019 07:44:20 +0000 (UTC)
Message-Id: <20190503074415.6BCD5989F84@guava.gson.org>
Date: Fri,  3 May 2019 10:44:15 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: NetBSD gdb does not interoperate with qemu 4.0.0 gdb stub
X-Send-Pr-Version: 3.95

>Number:         54154
>Category:       bin
>Synopsis:       NetBSD gdb does not interoperate with qemu 4.0.0 gdb stub
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kamil
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 03 07:45:00 +0000 2019
>Closed-Date:    Mon Jun 03 18:12:27 +0000 2019
>Last-Modified:  Fri Jun 07 19:10:01 +0000 2019
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current
>Organization:

>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:

When I try to remotely debug NetBSD-current/i386 under qemu 4.0.0 from
pkgsrc, running gdb on a NetBSD-current/i386 system identical to the
target per https://wiki.netbsd.org/kernel_debugging_with_qemu/ 
debugging fails with the error "Remote 'g' packet reply is too long":

  (gdb) target remote guido.araneus.fi:1234
  Remote debugging using guido.araneus.fi:1234
  warning: Can not parse XML target description; XML support was disabled at compile time
  Remote 'g' packet reply is too long (expected 308 bytes, got 344 bytes): 00000000fc3e20adfc3e20ad004072add8af97c9e848470000000000887472ad604311c04600000008000000100000001f000

I have tested this with -current source dates 2019.04.07.08.14.20 and
2018.03.01.03.32.33, and both fail the same way.  Remote debugging of
-current worked for me around 2018.03, so the triggering factor
appears to be a recent qemu, not a recent -current.

I wonder if building gdb with XML support would fix this.

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54154: NetBSD gdb does not interoperate with qemu 4.0.0 gdb
 stub
Date: Fri, 3 May 2019 09:53:41 +0000

 This isn't netbsd specific, its because i386 vs. x86_64 remote
 debugging. Does this help
 "set architecture i386:x86-64:intel"

From: Andreas Gustafsson <gson@gson.org>
To: coypu@sdf.org
Cc: gnats-bugs@netbsd.org
Subject: Re: bin/54154: NetBSD gdb does not interoperate with qemu 4.0.0 gdb stub
Date: Fri, 3 May 2019 13:50:07 +0300

 coypu@sdf.org wrote:
 >  This isn't netbsd specific, its because i386 vs. x86_64 remote
 >  debugging.

 My working assumption is that gdb is confused about i386 vs x86_64
 because it is unable to parse the XML target description, which in
 turn is due to the XML support being disabled in the NetBSD build.
 That would count as "NetSBD specific" in my book.

 > Does this help "set architecture i386:x86-64:intel"

 No, it does not:

   # gdb /netbsd
   GNU gdb (GDB) 8.0.1
   [...]
   Reading symbols from /netbsd...done.
   (gdb) set architecture i386:x86-64:intel
   warning: A handler for the OS ABI "NetBSD" is not built into this configuration
   of GDB.  Attempting to continue with the default i386:x86-64:intel settings.

   The target architecture is assumed to be i386:x86-64:intel
   (gdb) target remote guido.araneus.fi:1234
   Remote debugging using guido.araneus.fi:1234
   warning: Can not parse XML target description; XML support was disabled at compile time
   Remote 'g' packet reply is too long (expected 308 bytes, got 344 bytes): 5cdf1cc20600000006000000000000001060
   (gdb) bt
   No stack.
   (gdb) 

 -- 
 Andreas Gustafsson, gson@gson.org

Responsible-Changed-From-To: bin-bug-people->kamil
Responsible-Changed-By: kamil@NetBSD.org
Responsible-Changed-When: Fri, 03 May 2019 21:16:07 +0200
Responsible-Changed-Why:
Take.


State-Changed-From-To: open->feedback
State-Changed-By: kamil@NetBSD.org
State-Changed-When: Fri, 03 May 2019 21:16:07 +0200
State-Changed-Why:
Please retry with:
src/external/gpl3/gdb/dist/gdb/infrun.c r1.3
src/external/gpl3/gdb/dist/gdb/nbsd-nat.c r1.9

Does it fix the problem for you?


From: Andreas Gustafsson <gson@gson.org>
To: kamil@NetBSD.org
Cc: gnats-bugs@netbsd.org
Subject: Re: bin/54154 (NetBSD gdb does not interoperate with qemu 4.0.0 gdb stub)
Date: Sat, 4 May 2019 22:56:15 +0300

 kamil@NetBSD.org wrote:
 > Please retry with:
 > src/external/gpl3/gdb/dist/gdb/infrun.c r1.3
 > src/external/gpl3/gdb/dist/gdb/nbsd-nat.c r1.9
 > 
 > Does it fix the problem for you?

 No, it does not: with sources from 2019.05.04.15.46.58, I get:

   (gdb) target remote guido.araneus.fi:1234
   Remote debugging using guido.araneus.fi:1234
   warning: Can not parse XML target description; XML support was disabled at compile time
   Remote 'g' packet reply is too long (expected 308 bytes, got 344 bytes): 20000000040000002[...]

 This is without any "set architecture" command; I have not tested
 this version with one.
 -- 
 Andreas Gustafsson, gson@gson.org

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: kamil@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 Andreas Gustafsson <gson@gson.org>
Subject: Re: bin/54154 (NetBSD gdb does not interoperate with qemu 4.0.0 gdb
 stub)
Date: Sat, 4 May 2019 18:50:53 -0400

 --Apple-Mail=_9842EDF0-14E5-416B-A499-5CEBDC1CDCD5
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii

 fgrep -r EXPAT .
 ./alpha/config.h:/* #undef HAVE_LIBEXPAT */
 ./arm/config.h:/* #undef HAVE_LIBEXPAT */
 ./armeb/config.h:/* #undef HAVE_LIBEXPAT */
 ./coldfire/config.h:/* #undef HAVE_LIBEXPAT */
 ./aarch64/config.h:/* #undef HAVE_LIBEXPAT */
 ./hppa/config.h:/* #undef HAVE_LIBEXPAT */
 ./i386/config.h:/* #undef HAVE_LIBEXPAT */
 ./m68000/config.h:/* #undef HAVE_LIBEXPAT */
 ./m68k/config.h:/* #undef HAVE_LIBEXPAT */
 ./mips64eb/config.h:/* #undef HAVE_LIBEXPAT */
 ./mips64el/config.h:/* #undef HAVE_LIBEXPAT */
 ./mipseb/config.h:/* #undef HAVE_LIBEXPAT */
 ./mipsel/config.h:/* #undef HAVE_LIBEXPAT */
 ./powerpc/config.h:/* #undef HAVE_LIBEXPAT */
 ./powerpc64/config.h:/* #undef HAVE_LIBEXPAT */
 ./sh3eb/config.h:/* #undef HAVE_LIBEXPAT */
 ./sh3el/config.h:/* #undef HAVE_LIBEXPAT */
 ./sparc/config.h:/* #undef HAVE_LIBEXPAT */
 ./sparc64/config.h:/* #undef HAVE_LIBEXPAT */
 ./vax/config.h:/* #undef HAVE_LIBEXPAT */
 ./x86_64/config.h:#define HAVE_LIBEXPAT 1

 Hmm... Perhaps we should enable it everywhere :-)

 christos

 > On May 4, 2019, at 4:00 PM, Andreas Gustafsson <gson@gson.org> wrote:
 > 
 > XML support was disabled at compile time


 --Apple-Mail=_9842EDF0-14E5-416B-A499-5CEBDC1CDCD5
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/html;
 	charset=us-ascii

 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
 charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
 -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><div =
 class=3D"">fgrep -r EXPAT .</div><div class=3D"">./alpha/config.h:/* =
 #undef HAVE_LIBEXPAT */</div><div class=3D"">./arm/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./armeb/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./coldfire/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./aarch64/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./hppa/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./i386/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./m68000/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./m68k/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./mips64eb/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./mips64el/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./mipseb/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./mipsel/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./powerpc/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./powerpc64/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./sh3eb/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./sh3el/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./sparc/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./sparc64/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./vax/config.h:/* #undef =
 HAVE_LIBEXPAT */</div><div class=3D"">./x86_64/config.h:#define =
 HAVE_LIBEXPAT 1</div><div class=3D""><br class=3D""></div><div =
 class=3D"">Hmm... Perhaps we should enable it everywhere :-)</div><div =
 class=3D""><br class=3D""></div><div class=3D"">christos</div><div><br =
 class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On May =
 4, 2019, at 4:00 PM, Andreas Gustafsson &lt;<a =
 href=3D"mailto:gson@gson.org" class=3D"">gson@gson.org</a>&gt; =
 wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><span =
 style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
 12px; font-style: normal; font-variant-caps: normal; font-weight: =
 normal; letter-spacing: normal; text-align: start; text-indent: 0px; =
 text-transform: none; white-space: normal; word-spacing: 0px; =
 -webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
 display: inline !important;" class=3D"">XML support was disabled at =
 compile time</span></div></blockquote></div><br class=3D""></body></html>=

 --Apple-Mail=_9842EDF0-14E5-416B-A499-5CEBDC1CDCD5--

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@netbsd.org
Cc: kamil@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    gson@gson.org (Andreas Gustafsson)
Subject: re: bin/54154 (NetBSD gdb does not interoperate with qemu 4.0.0 gdb stub)
Date: Mon, 06 May 2019 06:32:50 +1000

 >  > src/external/gpl3/gdb/dist/gdb/nbsd-nat.c r1.9
 >  > =

 >  > Does it fix the problem for you?
 >  =

 >  No, it does not: with sources from 2019.05.04.15.46.58, I get:
 >  =

 >    (gdb) target remote guido.araneus.fi:1234
 >    Remote debugging using guido.araneus.fi:1234
 >    warning: Can not parse XML target description; XML support was disabl=
 ed at compile time
 >    Remote 'g' packet reply is too long (expected 308 bytes, got 344 byte=
 s): 20000000040000002[...]
 >  =

 >  This is without any "set architecture" command; I have not tested
 >  this version with one.

 we may want to publish our xsrc libexpat into src and enable it,
 like christos posted about..

 you can get around this by using tools/gdb when expat is visible
 while building, and then it should work.


 .mrg.

State-Changed-From-To: feedback->open
State-Changed-By: gson@NetBSD.org
State-Changed-When: Thu, 09 May 2019 14:03:09 +0000
State-Changed-Why:
Feedback provided.


From: Andreas Gustafsson <gson@gson.org>
To: matthew green <mrg@eterna.com.au>, christos@NetBSD.org, gnats-bugs@netbsd.org
Cc: kamil@netbsd.org
Subject: re: bin/54154 (NetBSD gdb does not interoperate with qemu 4.0.0 gdb stub)
Date: Sun, 2 Jun 2019 18:06:02 +0300

 On May 6, matthew green wrote:
 > we may want to publish our xsrc libexpat into src and enable it,
 > like christos posted about..

 There is a libexpat in src, in src/external/mit/expat.

 Christos, I see that you enabled HAVE_LIBEXPAT in
 src/external/gpl3/gdb/lib/libgdb/arch/i386/config.h 1.9 on 2019-05-05,
 and then disabled it again in 1.10 on 2019-05-29.  Was this intentional?
 -- 
 Andreas Gustafsson, gson@gson.org

From: Christos Zoulas <christos@zoulas.com>
To: gnats-bugs@netbsd.org
Cc: kamil@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org,
 Andreas Gustafsson <gson@gson.org>
Subject: Re: bin/54154 (NetBSD gdb does not interoperate with qemu 4.0.0 gdb
 stub)
Date: Sun, 2 Jun 2019 11:14:22 -0400

 No, it is not intentional. I just ran mknative. I think that it found it =
 the first time from pkgsrc,
 and the second time it did not because I removed my pkgsrc.I will =
 examine some more.

 christos

 > On Jun 2, 2019, at 11:10 AM, Andreas Gustafsson <gson@gson.org> wrote:
 >=20
 > The following reply was made to PR bin/54154; it has been noted by =
 GNATS.
 >=20
 > From: Andreas Gustafsson <gson@gson.org>
 > To: matthew green <mrg@eterna.com.au>, christos@NetBSD.org, =
 gnats-bugs@netbsd.org
 > Cc: kamil@netbsd.org
 > Subject: re: bin/54154 (NetBSD gdb does not interoperate with qemu =
 4.0.0 gdb stub)
 > Date: Sun, 2 Jun 2019 18:06:02 +0300
 >=20
 > On May 6, matthew green wrote:
 >> we may want to publish our xsrc libexpat into src and enable it,
 >> like christos posted about..
 >=20
 > There is a libexpat in src, in src/external/mit/expat.
 >=20
 > Christos, I see that you enabled HAVE_LIBEXPAT in
 > src/external/gpl3/gdb/lib/libgdb/arch/i386/config.h 1.9 on 2019-05-05,
 > and then disabled it again in 1.10 on 2019-05-29.  Was this =
 intentional?
 > --=20
 > Andreas Gustafsson, gson@gson.org
 >=20

From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54154 (NetBSD gdb does not interoperate with qemu 4.0.0 gdb stub)
Date: Mon, 3 Jun 2019 21:06:49 +0300

 It's working again after these commits:

   2019.06.02.23.27.19 christos src/external/gpl3/gdb/lib/libgdb/arch/aarch64/config.h 1.4
   2019.06.02.23.27.19 christos src/external/gpl3/gdb/lib/libgdb/arch/alpha/config.h 1.11
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/arm/config.h 1.12
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/armeb/config.h 1.11
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/hppa/config.h 1.10
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/i386/config.h 1.11
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/m68000/config.h 1.10
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/m68k/config.h 1.11
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/m68k/defs.mk 1.13
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/mips64eb/config.h 1.15
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/mips64el/config.h 1.15
   2019.06.02.23.27.20 christos src/external/gpl3/gdb/lib/libgdb/arch/mipseb/config.h 1.13
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/mipsel/config.h 1.13
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/powerpc/config.h 1.10
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/powerpc64/config.h 1.10
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/sh3eb/config.h 1.10
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/sh3el/config.h 1.10
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/sparc/config.h 1.11
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/sparc64/config.h 1.11
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/sparc64/init.c 1.13
   2019.06.02.23.27.21 christos src/external/gpl3/gdb/lib/libgdb/arch/vax/config.h 1.12
   2019.06.02.23.28.32 christos src/tools/gdb/Makefile 1.38

 -- 
 Andreas Gustafsson, gson@gson.org

State-Changed-From-To: open->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Mon, 03 Jun 2019 18:12:27 +0000
State-Changed-Why:
Fixed by christos, thanks!


From: "Andreas Gustafsson" <gson@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54154 CVS commit: src/tests/usr.bin/gdb
Date: Fri, 7 Jun 2019 19:05:15 +0000

 Module Name:	src
 Committed By:	gson
 Date:		Fri Jun  7 19:05:15 UTC 2019

 Modified Files:
 	src/tests/usr.bin/gdb: t_regress.sh

 Log Message:
 Add a regression test for PR bin/54154, or in other words, make sure
 we get notified in a timely manner if gdb's XML support disappears
 again.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/gdb/t_regress.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.