linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: Dibyendu Majumdar <mobile@majumdar.org.uk>
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: Best way to inspect the parse tree from Sparse
Date: Thu, 10 Aug 2017 15:59:56 -0400	[thread overview]
Message-ID: <CANeU7QmDs0Dbdd=-ceD55rD9fHuz53Vy2=a==8J1OjV1d7RVHg@mail.gmail.com> (raw)
In-Reply-To: <CACXZuxcBaNb40zNh1FgAbJP5nhxEU8pf09_ejnOwWWhjWS3Jwg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]

On Wed, Aug 9, 2017 at 4:03 PM, Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> On 9 August 2017 at 12:57, Christopher Li <sparse@chrisli.org> 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

[-- Attachment #2: 0001-switch-to-gtk3.patch --]
[-- Type: text/x-patch, Size: 1763 bytes --]

From 002cb50499ca64539d677e46f035a0d62ab981e1 Mon Sep 17 00:00:00 2001
From: Chris Li <chris@cool>
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


      parent reply	other threads:[~2017-08-10 19:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07 15:11 Best way to inspect the parse tree from Sparse Dibyendu Majumdar
2017-08-07 15:19 ` Christopher Li
2017-08-07 18:46 ` Luc Van Oostenryck
2017-08-07 23:35   ` Christopher Li
2017-08-09 17:14     ` Dibyendu Majumdar
2017-08-09 17:42       ` Dibyendu Majumdar
2017-08-09 18:41         ` Christopher Li
2017-08-09 18:47           ` Dibyendu Majumdar
2017-08-09 19:22             ` Christopher Li
2017-08-09 19:46               ` Dibyendu Majumdar
2017-08-09 19:57                 ` Christopher Li
2017-08-09 20:03                   ` Dibyendu Majumdar
2017-08-09 20:21                     ` Christopher Li
2017-08-10 19:59                     ` Christopher Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANeU7QmDs0Dbdd=-ceD55rD9fHuz53Vy2=a==8J1OjV1d7RVHg@mail.gmail.com' \
    --to=sparse@chrisli.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mobile@majumdar.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).