From owner-freebsd-hackers@FreeBSD.ORG Wed Jan 16 05:15:18 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9E7B27A4; Wed, 16 Jan 2013 05:15:18 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by mx1.freebsd.org (Postfix) with ESMTP id 1B76A87D; Wed, 16 Jan 2013 05:15:17 +0000 (UTC) Received: by mail-wg0-f52.google.com with SMTP id 12so597102wgh.19 for ; Tue, 15 Jan 2013 21:15:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:date:x-google-sender-auth:message-id :subject:from:to:cc:content-type; bh=nyffFEU7b1yKrcNQVeyY/zr3oNHAng2WWBWoLIwWU1g=; b=pzkfBq7yWVVGHBMvpIBm5RMXV5Y+cGkdaDOMH+iiV+SbCeuJNi1fxKgOxmGnxmtfAa QW3DAmY3WiUJczbzeAdEB40+/J1GnF1TeranCxZ3x8d/zpYfyDOo8tmKwdAJmbYW/Nb2 Loawm0JKrQ1gkm8d3aknt09rR8m3BoM8KPRwa5d2ZgOAD8+HWcPZb1dsR2mD2M/i/gjv fZb3H2vhwXQwYngj8EIrYz86hQH2PodPr06wGHQKRKlvkbgUcuyPUY8e8gVOEuOmzf6v PuP7+CoUybZjv7oBZNBV2HYGySMd0N5iJGUVZ6Z+OGoaZkadlLF4FkhZI9VI/u3KMX5C G6uw== MIME-Version: 1.0 X-Received: by 10.180.72.146 with SMTP id d18mr7420563wiv.33.1358313311570; Tue, 15 Jan 2013 21:15:11 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Tue, 15 Jan 2013 21:15:11 -0800 (PST) Date: Tue, 15 Jan 2013 21:15:11 -0800 X-Google-Sender-Auth: A98CtrDRxI-7miMqNDazmcNBKHg Message-ID: Subject: [RFC] support -b when starting gdb From: Adrian Chadd To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-current X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2013 05:15:18 -0000 Hi, There doesn't seem to be a blessed way to set the baudrate from inside gdb/kgdb. It seems to be set from '-b' on the command line. However kgdb doesn't have this support. This patch adds -b support so kgdb so I can override the default speed (9600 it seems) to speak kgdb over serial to a 115200 console MIPS device. The MIPS stuff has other issues; I'll talk about those later. Thanks, Adrian Index: gnu/usr.bin/gdb/kgdb/main.c =================================================================== --- gnu/usr.bin/gdb/kgdb/main.c (revision 245281) +++ gnu/usr.bin/gdb/kgdb/main.c (working copy) @@ -333,11 +333,24 @@ args.argv = malloc(sizeof(char *)); args.argv[0] = argv[0]; - while ((ch = getopt(argc, argv, "ac:d:fn:qr:vw")) != -1) { + while ((ch = getopt(argc, argv, "ab:c:d:fn:qr:vw")) != -1) { switch (ch) { case 'a': annotation_level++; break; + case 'b': + { + int i; + char *p; + + i = strtol (optarg, &p, 0); + if (i == 0 && p == optarg) + warnx("warning: could not set baud rate to `%s'.\n", + optarg); + else + baud_rate = i; + } + break; case 'c': /* use given core file. */ if (vmcore != NULL) { warnx("option %c: can only be specified once",