NetBSD Problem Report #59419

From www@netbsd.org  Tue May 13 19:53:01 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 82D1E1A923E
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 13 May 2025 19:53:01 +0000 (UTC)
Message-Id: <20250513195300.3977C1A9241@mollari.NetBSD.org>
Date: Tue, 13 May 2025 19:53:00 +0000 (UTC)
From: jamesbrowning137@gmail.com
Reply-To: jamesbrowning137@gmail.com
To: gnats-bugs@NetBSD.org
Subject: KGDB build fails for evbarm
X-Send-Pr-Version: www-1.0

>Number:         59419
>Category:       port-evbarm
>Synopsis:       KGDB build fails for evbarm
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 13 19:55:00 +0000 2025
>Originator:     James Browning
>Release:        hg src-draft trunk tip (as of April 7th 2025)
>Organization:
>Environment:
Linux phobos 6.12.21-gentoo #1 SMP PREEMPT_DYNAMIC Sun Apr 27 20:43:52
PDT 2025 x86_64 AMD Ryzen 5 PRO 4650U with Radeon Graphics
AuthenticAMD GNU/Linux
>Description:
When attempting to enable kgdb support for evbarm, I run into a couple of build failures:

1. conflicting definitions of "db_active"
2. unrecognized symbol "db_error"

Here is the output for error 1:
  --- db_interface.o ---
  /home/james/NetBSD/src-draft/sys/arch/arm/arm32/db_interface.c:77:9:
  error: conflicting type qualifiers for 'db_active'
     77 | int     db_active = 0;
        |         ^~~~~~~~~
  In file included from
  /home/james/NetBSD/src-draft/sys/arch/arm/arm32/db_interface.c:59:
  /home/james/NetBSD/src-draft/sys/ddb/db_active.h:41:18: note: previous
  definition of 'db_active' with type 'int'
     41 | static const int db_active __unused = 0;
        |     

And after adding a work around for error 1, here is error 2:
  /home/james/NetBSD/tools/bin/armv7--netbsdelf-eabihf-ld: db_access.o:
  in function `db_get_qvalue':
  /home/james/NetBSD/src-draft/sys/ddb/db_access.c:99:(.text+0xd8):
  undefined reference to `db_error'
  + exit 1

Not sure if it matters, but I'm cross compiling from gentoo. I've never encountered any other issues with my build environment besides this.

>How-To-Repeat:
In your GENERIC.local, add the following to enable KGDB in the build:

  no options		DDB
  no options		DDB_ONPANIC
  no options      DDB_HISTORY_SIZE

  options    KGDB
  options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x48022000,KGDB_DEVRATE=115200,KGDB_DEV=123 #DEVADDR is UART1 on AM335x  
  makeoptions DEBUG="-g"

Compile the GENERIC kernel with "evbarm" as the machine and "earmv7hf" for the architecture.
>Fix:
Temporary work around:

diff -r d708c4dcdd7d sys/arch/arm/arm32/db_interface.c
--- a/sys/arch/arm/arm32/db_interface.c	Sun Apr 27 23:30:39 2025 +0000
+++ b/sys/arch/arm/arm32/db_interface.c	Tue May 13 12:08:07 2025 -0700
@@ -74,7 +74,7 @@

 int db_trapper(u_int, u_int, trapframe_t *, int);

-int	db_active = 0;
+//int	db_active = 0;
 db_regs_t ddb_regs;	/* register state */
 db_regs_t *ddb_regp;
diff -r d708c4dcdd7d sys/ddb/db_access.c
--- a/sys/ddb/db_access.c	Sun Apr 27 23:30:39 2025 +0000
+++ b/sys/ddb/db_access.c	Tue May 13 12:08:07 2025 -0700
@@ -93,10 +93,12 @@
 		return (uint32_t)db_get_value(addr, size, false);
 	}

-	if (size != sizeof(data)) {
-		db_error("unsupported size\n");
-		/*NOTREACHED*/
-	}
+
+//	if (size != sizeof(data)) {
+//
+//		db_error("unsupported size\n");
+//		/*NOTREACHED*/
+//	}

 	db_read_bytes(addr, sizeof(data), (char *)&data);
 	return data;

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.