From patchwork Wed Aug 9 19:22:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 9891717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4248260363 for ; Wed, 9 Aug 2017 19:22:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3408628A7B for ; Wed, 9 Aug 2017 19:22:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2837B28A84; Wed, 9 Aug 2017 19:22:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9517C28A7B for ; Wed, 9 Aug 2017 19:22:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751906AbdHITWk (ORCPT ); Wed, 9 Aug 2017 15:22:40 -0400 Received: from mail-yw0-f175.google.com ([209.85.161.175]:34631 "EHLO mail-yw0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751891AbdHITWj (ORCPT ); Wed, 9 Aug 2017 15:22:39 -0400 Received: by mail-yw0-f175.google.com with SMTP id s143so46005171ywg.1 for ; Wed, 09 Aug 2017 12:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Q/paOwGSSWO/njCOkvonlakXTd5XtYw2clMRQVBe7P4=; b=DrBiK8iPieb6hIfRM5f2xM1i/H9LX8l6m8Qtwg8zoJeKPRBUqPADUVWEFAYNgPc5XD SQkyW04u2ZKWUEaK3Zs51IfeSpvuOVz5d1bJ+Onq+jotVite8SS+vd83LNRPOGYYOWsa iCvuVpCA9cxaODYrgVuELt+NAuhZhI9IwmLBwjBeLhR3OySrwR8QixWMh/5thYGZzVr3 1IXuj6tFwRgIoDYFhDqn/02vFR6Aw6oYEmhf9URCnJBMA/oqVVdWxeiXrBQvFhsBmt9F ql2dFXITMR5A148EDvLkUr0Ixgiy6JGQ60tUDvsVdbInC1kgKcQGmNiZE6laFO9SwNGN tKFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Q/paOwGSSWO/njCOkvonlakXTd5XtYw2clMRQVBe7P4=; b=APvhxQKG8L8w4Whit/MNagY7BQT1JBTnQ2ct5IFQELaMalIq+gAzSlf2KJErhRErtq 9u6kZwE3/cRxLlDZou3KFYQ+fNs5H/JEIL9LZ356OTR4DkIQnQnGKU/1OAD+Qg6JZ6hc 6n4FvvsX2S+ls+dgY1bUKPl/85MlfFjsWJ4RqjblQ+5LxYVZloSEaL1JKEl7mFbdj86l P0KuOuQib0YNGXuiA4J8IlT9R2tNJviXa4E/NbPwAD66VqFRMC+KoDF/SexClbavGynV WY4BnQ6k5bmiNUs35q1dVeCW2Z5XT5CUB9+UgFj9X3f++QtWy2Smot+gVOuZ0v4uSqB0 QUJA== X-Gm-Message-State: AHYfb5iZYPiHQS0qeCVYVQc2sAyTIqUre+rCNUS3qrCCemmeG4KcstpU +UBTW93dZLDFUTpIf8rOk/+ADdvYGQ== X-Received: by 10.37.89.85 with SMTP id n82mr7536372ybb.112.1502306559124; Wed, 09 Aug 2017 12:22:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.68.39 with HTTP; Wed, 9 Aug 2017 12:22:38 -0700 (PDT) In-Reply-To: References: <20170807184653.a6xtjfbutnsnecnf@ltop.local> From: Christopher Li Date: Wed, 9 Aug 2017 15:22:38 -0400 X-Google-Sender-Auth: tYQWDlyMoJCCpjEmB_lFsrO84Mc Message-ID: Subject: Re: Best way to inspect the parse tree from Sparse To: Dibyendu Majumdar Cc: Luc Van Oostenryck , Linux-Sparse Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Aug 9, 2017 at 2:47 PM, Dibyendu Majumdar wrote: > > Thread 1 "test-inspect" received signal SIGSEGV, Segmentation fault. > ast_iter_n_children (tree_model=0x725400, iter=0x0) at ast-model.c:404 Err, iter == NULL. The function comment said it all. if iter == NULL, should return the root node's children number. Can you try the following one line change? I can only verify it compiles. But I have no way to test it. I also totally forget how this tree view model works now. Let's hope that fix it. Thanks Chris --- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/ast-model.c b/ast-model.c index 704c487..cbfdc1f 100644 --- a/ast-model.c +++ b/ast-model.c @@ -401,7 +401,7 @@ static gint ast_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *iter) { - AstNode *node = iter->user_data; + AstNode *node = iter ? iter->user_data : AST_NODE(tree_model); inspect_child_node(node); return node->childnodes->len;