From patchwork Thu Aug 10 19:59:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 9894565 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 A3C4160384 for ; Thu, 10 Aug 2017 20:00:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E5DA28B83 for ; Thu, 10 Aug 2017 20:00:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ACCF28B82; Thu, 10 Aug 2017 20:00: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,T_TVD_MIME_EPI 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 7089528B80 for ; Thu, 10 Aug 2017 20:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816AbdHJT77 (ORCPT ); Thu, 10 Aug 2017 15:59:59 -0400 Received: from mail-yw0-f176.google.com ([209.85.161.176]:34096 "EHLO mail-yw0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752807AbdHJT75 (ORCPT ); Thu, 10 Aug 2017 15:59:57 -0400 Received: by mail-yw0-f176.google.com with SMTP id s143so11280887ywg.1 for ; Thu, 10 Aug 2017 12:59:57 -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=UAt31PjrjzqGojVNjNVRkq6mKwxzg174YlL2mAxGXd4=; b=SGNNYaXhSeEYtURh2GrQkxzzGOn9Ihl6Q1Dh2KFO05hXII+pG+A9Fd8ChEM54lYHaX TNsiVK7On+PlvHOIXHe0Iilm8ndzGNOfft0VetxZJdHQxwztif2ZWSEv6K4MHQLbO9I+ +q2KluHHB2h+fQEHqOuGoz+fS6WHqO00+c+OaGTiGw22AwwQs/+3ufi0n77M6s/OWTLB GBrb6HM5TE3fCZcBdjDldXef7GGD74X12gv1Pv16zLInuQfixhaBMJo2H8Xuuto3m9q+ eBhnVO/AmgCvbHAFu9nbsrK3t4UZewKyVr2Km1kcBhj1S/AD+tHkWhKvWELUYAg67nws ZtDA== 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=UAt31PjrjzqGojVNjNVRkq6mKwxzg174YlL2mAxGXd4=; b=Q4F76HrUomonHym408xjV8SGe08DbnsI0/L8ehH7Xb6H5T0uK4hvPIkZjGFB4qeI0Y Qq5svN3lK/zM0lDy/ngwlAU6xWXIMaDZ4Phlg6yliuFVBxnyQUaJRQ+mF8AQk4YYrHeN MNxBYTVOy6J6qUd0VwvbfzUIvfbJblzawFKiSzN5V44Q+iW/anSdOIgI2fvMLKS5UGSo 6gCxJz+NgdjBZKMDmdpDeAPzk76BhIUqf1JGJ5ET/d8neaNfcH5LWD4yS6x0zoh7X1KM 7nrmoFqD43xD2DvHoY/829rbLvcD+xD/T8BNR9mQ7W0DaISUuzewBhyfqC21bF/UtfuG eheA== X-Gm-Message-State: AHYfb5jRCedH89VQTc3XEFp1NYG9KhdJFV7mqvDFETZ2qVWjsbFvhmx/ Q98HJ7W4uh6GI3+6I5CzHIaGoiaqLg== X-Received: by 10.37.113.212 with SMTP id m203mr10664064ybc.165.1502395197276; Thu, 10 Aug 2017 12:59:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.68.39 with HTTP; Thu, 10 Aug 2017 12:59:56 -0700 (PDT) In-Reply-To: References: <20170807184653.a6xtjfbutnsnecnf@ltop.local> From: Christopher Li Date: Thu, 10 Aug 2017 15:59:56 -0400 X-Google-Sender-Auth: hatiDtI2OnriNW8SrSFQkn9vlsM 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 4:03 PM, Dibyendu Majumdar wrote: > On 9 August 2017 at 12:57, Christopher Li wrote: >> Can you do a "ldd test-inspect"? >> >> Which version of Ubuntu are you using? I think I need to get one of those to >> test it. >> > > I am using ubuntu 16.04 LTS. > OK. I have install ubuntu 16.04 LTS and writing this email on ubuntu now. The first patch I send you should be correct. But I think there is a bug in the updated version of ubuntu 16.04 libgtk2.0-dev. I am not able to reproduce it with the fresh install libgtk2 but I can't go back now. I can duplicate the crash with update to latest version. It seems to me that, when I click on one sub item, it is passing iter == NULL. That seems wrong. It shouldn't pass iter == NULL for sub list item. Again, I am not GUI developer at all. This test-inspect is all my GUI skill at best already. With the patch I send earlier, this cause the gtk go into infinity loop of asking about the child of the child. It is asking for child with iter==NULL. So I get it the root node, gtk seems get confused after that. The patch I send out before obvious should be applied. The good news is that, in Ubuntu 16.04. GTK3.0 does not have this problem. I am able to run gtk3 and test-inspect will not crash. I attach the patch here. You can try it out. Please let me know how it work out for you. I am writing a patch for RC5 to compile with gtk3 if available. Chris From 002cb50499ca64539d677e46f035a0d62ab981e1 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Thu, 10 Aug 2017 15:34:14 -0400 Subject: [PATCH] switch to gtk3 --- Makefile | 6 +++--- ast-model.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 96e81c4..db410eb 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ HAVE_LIBXML:=$(shell $(PKG_CONFIG) --exists libxml-2.0 2>/dev/null && echo 'yes' HAVE_GCC_DEP:=$(shell touch .gcc-test.c && \ $(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \ echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c) -HAVE_GTK2:=$(shell $(PKG_CONFIG) --exists gtk+-2.0 2>/dev/null && echo 'yes') +HAVE_GTK2:=$(shell $(PKG_CONFIG) --exists gtk+-3.0 2>/dev/null && echo 'yes') LLVM_CONFIG:=llvm-config HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes') @@ -67,8 +67,8 @@ $(warning Your system does not have libxml, disabling c2xml) endif ifeq ($(HAVE_GTK2),yes) -GTK2_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-2.0) -GTK2_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0) +GTK2_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-3.0) +GTK2_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-3.0) PROGRAMS += test-inspect INST_PROGRAMS += test-inspect test-inspect_EXTRA_DEPS := ast-model.o ast-view.o ast-inspect.o diff --git a/ast-model.c b/ast-model.c index 704c487..d7f0c3a 100644 --- a/ast-model.c +++ b/ast-model.c @@ -401,7 +401,8 @@ 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; -- 2.7.4