From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12199 invoked by alias); 13 Aug 2010 06:41:19 -0000 Received: (qmail 12190 invoked by uid 22791); 13 Aug 2010 06:41:18 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_50 X-Spam-Check-By: sourceware.org Received: from ahmler2.mail.eds.com (HELO ahmler2.mail.eds.com) (192.85.154.72) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Aug 2010 06:41:13 +0000 Received: from ahmlir5.mail.eds.com (ahmlir5-2.mail.eds.com [192.85.154.135]) by ahmler2.mail.eds.com (8.14.4/8.13.8) with ESMTP id o7D6fAAF005729 for ; Fri, 13 Aug 2010 02:41:10 -0400 Received: from ahmlir5.mail.eds.com (localhost [127.0.0.1]) by ahmlir5.mail.eds.com (8.14.4/8.12.10) with ESMTP id o7D6f7RM013718 for ; Fri, 13 Aug 2010 02:41:07 -0400 Received: from usplmvpfe001.ent.rt.verigy.net ([192.100.40.4]) by ahmlir5.mail.eds.com (8.14.4/8.12.10) with ESMTP id o7D6f7bB013710 for ; Fri, 13 Aug 2010 02:41:07 -0400 X-EDSINT-Source-Ip: 192.100.40.4 Received: from usplmvpbe001.ent.rt.verigy.net ([10.16.58.34]) by usplmvpfe001.ent.rt.verigy.net with Microsoft SMTPSVC(6.0.3790.4675); Fri, 13 Aug 2010 01:41:07 -0500 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: [Pretty printers] Can the name or type of a child value change? Date: Fri, 13 Aug 2010 06:41:00 -0000 Message-ID: <58596C4646708B4BB990C4483997333002F403D9@usplmvpbe001.ent.rt.verigy.net> From: "Elmenthaler, Jens" To: X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00077.txt.bz2 Consider the following code example: struct JAny { union { char *text; int number; } val; // 1 -> text, 2 -> number int type; }; And the following pretty printer: class AnyPrinter: class _iterator: def __init__ (self, name, value): self.count =3D 0 self.name =3D name self.value =3D value def __iter__(self): return self def next(self): if self.count !=3D 0: raise StopIteration =20=20=20=20=20=20=20=20=20=20=20=20 self.count =3D self.count + 1 return (self.name, self.value)=20=20=20=20 def __init__(self, val): self.type =3D val['type'] =20=20=20=20=20=20=20=20 if self.type =3D=3D 1: self.value =3D val['val']['text'] self.name =3D "text" =20=20=20=20=20=20=20=20=20=20=20=20 if self.type =3D=3D 2: self.value =3D val['val']['number'] self.name =3D "number" =20=20=20=20=20=20=20=20=20=20=20=20 def children(self): return self._iterator(self.name, self.value) def to_string(self): return "JAny" When stepping in the debugger over a line that changes JAny.type, the name = and the type of the child value returned by the pretty printer change. Are the MI variable objects meant to handle this? Greetings, Jens.