From owner-freebsd-hackers@FreeBSD.ORG Sat Sep 18 20:35:49 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CA0E106566C; Sat, 18 Sep 2010 20:35:49 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 04D6A8FC0C; Sat, 18 Sep 2010 20:35:48 +0000 (UTC) Received: by qyk31 with SMTP id 31so1950493qyk.13 for ; Sat, 18 Sep 2010 13:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=5RFx50P4F4C6tu0HojTsa89DCFh42GPVILYc75KuQHs=; b=w0/0x/ih92CRV8qeHO/45gBHwYKV2pYhhJJ3LpADcjsvIbDgZaDcEtDcTPR8kPZ1fK /1MTA+oMozoFjA0v5K9bLB4jh8uHWG7iN6S9axbuobAKPmcbTuQ3/brsZsQ4eUDq4KrK HqDZ1npW4n6y3xafOb1VbUyHmVx5JRLu8V4m8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=lmnBJERnwcmnZKtNrXuUbt7+0eYlVQ6WqFQnVFJOohi9Ic4OkxNpeFpDlzBhdmXxLx +Yho5469QPb5nxmHjaisxsjxrM+hudJVqZ89q4wAEMcogp/LLfKwnxyLStakl3zk1eAL kTIu+U7U2coTp4YUuG9HijZrcSshWPEWEDHUk= MIME-Version: 1.0 Received: by 10.224.54.13 with SMTP id o13mr4609286qag.9.1284842148123; Sat, 18 Sep 2010 13:35:48 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.235.143 with HTTP; Sat, 18 Sep 2010 13:35:48 -0700 (PDT) In-Reply-To: <4C95214A.3070600@freebsd.org> References: <4C94A138.8050905@icyb.net.ua> <4C9507D1.3010008@icyb.net.ua> <4C950C48.6020600@freebsd.org> <4C95214A.3070600@freebsd.org> Date: Sat, 18 Sep 2010 22:35:48 +0200 X-Google-Sender-Auth: IZi5OPjEjC5t-Tks2jaEQwJa2gI Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: KDB_TRACE and no backend X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2010 20:35:49 -0000 2010/9/18 Andriy Gapon : > on 18/09/2010 22:00 Andriy Gapon said the following: >> Oh, wow, and I totally overlooked stack_print(). >> Should have read stack(9) from the start. > > New patch. =C2=A0Hope this is better. > I don't like that the printf is duplicated, but couldn't figure out a way= to > combine pre-processor and C conditions. > > --- a/sys/kern/subr_kdb.c > +++ b/sys/kern/subr_kdb.c > @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); > =C2=A0#include > =C2=A0#include > =C2=A0#include > +#include > =C2=A0#include > > =C2=A0#include > @@ -300,6 +301,15 @@ kdb_backtrace(void) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("KDB: stack= backtrace:\n"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kdb_dbbe->dbbe_tra= ce(); > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > +#ifdef STACK > + =C2=A0 =C2=A0 =C2=A0 else { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct stack st; > + > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printf("KDB: stack bac= ktrace:\n"); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stack_save(&st); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stack_print(&st); > + =C2=A0 =C2=A0 =C2=A0 } > +#endif > =C2=A0} > > =C2=A0/* > It is still missing checking on opt_stack.h Besides, I'd reconsider having KDB_TRACE explanation in ddb(4) manpage (right now it is rightly there because it is DDB specific only, as long as it offers the backend, but with your change it is a global functionality. Not sure if it worths changing it but however you may have more opinions). Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein