public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/11036] New: Python: provide access to "hidden" variables
@ 2009-11-30 17:33 andre dot poenitz at nokia dot com
  2010-01-19 14:16 ` [Bug python/11036] " pmuldoon at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: andre dot poenitz at nokia dot com @ 2009-11-30 17:33 UTC (permalink / raw)
  To: gdb-prs

It is possible to iterate over most local variables that are in scope using

 while not block.function is None: 
    for symbol in block:  
       value = frame.read_var(symbol.print_name)  [...] 
    block = block.superblock       

but that misses "hidden" variables (i.e. that are defined in multiple scopes)
as "read_var" always finds the innermost.

-- 
           Summary: Python: provide access to "hidden" variables
           Product: gdb
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: andre dot poenitz at nokia dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11036

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug python/11036] Python: provide access to "hidden" variables
  2009-11-30 17:33 [Bug python/11036] New: Python: provide access to "hidden" variables andre dot poenitz at nokia dot com
@ 2010-01-19 14:16 ` pmuldoon at redhat dot com
  2010-01-19 14:29 ` pmuldoon at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pmuldoon at redhat dot com @ 2010-01-19 14:16 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pmuldoon at redhat dot com  2010-01-19 14:16 -------
I chatted with andre on irc and we came up with this reproducer:

simple.c ----------

#include <stdio.h>

int main() 
{ 
  int i = 0; 
  { 
    double i = 1.0; 
    double f = 2.0;
    { 
      const char *i = "stuff";
      const char *f = "foo";
      const char *b = "bar";
      printf ("break");
    } 
  } 

  return 0;
}

symbol.py -----------------

frame = gdb.selected_frame()
block = frame.block()
count = 0

while True:
    if block is None:
        warn("UNEXPECTED 'None' BLOCK")
        break
    
    print "Block: ",  count
    for symbol in block:
        name = symbol.print_name        
        try:
            item = frame.read_var(name)
        except RuntimeError:
            continue
        print name," (",item.type,") =",item
    if not block.function is None:
        break
        
    block = block.superblock
    count = count + 1

GDB output:

./gdb ./simple -ex 'b 13' -ex 'run' -ex 'python execfile("./symbol.py")'

Breakpoint 1 at 0x400507: file ../../frame/simple.c, line 13.

Breakpoint 1, main () at ../../frame/simple.c:13
13	      printf ("break");

Block:  0
i  ( const char * ) = 0x400618 "stuff"
f  ( const char * ) = 0x40061e "foo"
b  ( const char * ) = 0x400622 "bar"
Block:  1
i  ( const char * ) = 0x400618 "stuff"
f  ( const char * ) = 0x40061e "foo"
Block:  2
i  ( const char * ) = 0x400618 "stuff"


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1


http://sourceware.org/bugzilla/show_bug.cgi?id=11036

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug python/11036] Python: provide access to "hidden" variables
  2009-11-30 17:33 [Bug python/11036] New: Python: provide access to "hidden" variables andre dot poenitz at nokia dot com
  2010-01-19 14:16 ` [Bug python/11036] " pmuldoon at redhat dot com
@ 2010-01-19 14:29 ` pmuldoon at redhat dot com
  2010-01-20 13:20 ` pmuldoon at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pmuldoon at redhat dot com @ 2010-01-19 14:29 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|pmuldoon at redhat dot com
                   |org                         |
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=11036

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug python/11036] Python: provide access to "hidden" variables
  2009-11-30 17:33 [Bug python/11036] New: Python: provide access to "hidden" variables andre dot poenitz at nokia dot com
  2010-01-19 14:16 ` [Bug python/11036] " pmuldoon at redhat dot com
  2010-01-19 14:29 ` pmuldoon at redhat dot com
@ 2010-01-20 13:20 ` pmuldoon at redhat dot com
  2010-02-24 22:07 ` pmuldoon at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pmuldoon at redhat dot com @ 2010-01-20 13:20 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |11069


http://sourceware.org/bugzilla/show_bug.cgi?id=11036

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug python/11036] Python: provide access to "hidden" variables
  2009-11-30 17:33 [Bug python/11036] New: Python: provide access to "hidden" variables andre dot poenitz at nokia dot com
                   ` (2 preceding siblings ...)
  2010-01-20 13:20 ` pmuldoon at redhat dot com
@ 2010-02-24 22:07 ` pmuldoon at redhat dot com
  2010-02-28 21:57 ` cvs-commit at gcc dot gnu dot org
  2010-02-28 21:59 ` pmuldoon at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pmuldoon at redhat dot com @ 2010-02-24 22:07 UTC (permalink / raw)
  To: gdb-prs



-- 
Bug 11036 depends on bug 11069, which changed state.

Bug 11069 Summary: Port gdb.Block and gdb.Symbol and gdb.Symtab_and_line from archer-tromey-python
http://sourceware.org/bugzilla/show_bug.cgi?id=11069

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

http://sourceware.org/bugzilla/show_bug.cgi?id=11036

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug python/11036] Python: provide access to "hidden" variables
  2009-11-30 17:33 [Bug python/11036] New: Python: provide access to "hidden" variables andre dot poenitz at nokia dot com
                   ` (3 preceding siblings ...)
  2010-02-24 22:07 ` pmuldoon at redhat dot com
@ 2010-02-28 21:57 ` cvs-commit at gcc dot gnu dot org
  2010-02-28 21:59 ` pmuldoon at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2010-02-28 21:57 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2010-02-28 21:57 -------
Subject: Bug 11036

CVSROOT:	/cvs/src
Module name:	src
Changes by:	pmuldoon@sourceware.org	2010-02-28 21:56:51

Modified files:
	gdb            : ChangeLog 
	gdb/doc        : ChangeLog gdb.texinfo 
	gdb/python     : py-frame.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.python: py-frame.c py-frame.exp 

Log message:
	2010-02-28  Phil Muldoon  <pmuldoon@redhat.com>
	
	PR python/11036
	* python/py-frame.c (frapy_read_var): Add block argument and logic
	to cope with user provided blocks.
	
	2010-02-28  Phil Muldoon  <pmuldoon@redhat.com>
	
	* gdb.texinfo (Frames In Python): Add block parameter and
	description to read_var text.
	
	2010-02-28  Phil Muldoon  <pmuldoon@redhat.com>
	
	* gdb.python/py-frame.exp: Add read_var block tests.
	* gdb.python/py-frame.c (block): New function.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11407&r2=1.11408
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/doc/ChangeLog.diff?cvsroot=src&r1=1.1015&r2=1.1016
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/doc/gdb.texinfo.diff?cvsroot=src&r1=1.674&r2=1.675
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/python/py-frame.c.diff?cvsroot=src&r1=1.3&r2=1.4
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2155&r2=1.2156
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-frame.c.diff?cvsroot=src&r1=1.1&r2=1.2
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-frame.exp.diff?cvsroot=src&r1=1.3&r2=1.4



-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11036

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug python/11036] Python: provide access to "hidden" variables
  2009-11-30 17:33 [Bug python/11036] New: Python: provide access to "hidden" variables andre dot poenitz at nokia dot com
                   ` (4 preceding siblings ...)
  2010-02-28 21:57 ` cvs-commit at gcc dot gnu dot org
@ 2010-02-28 21:59 ` pmuldoon at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pmuldoon at redhat dot com @ 2010-02-28 21:59 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pmuldoon at redhat dot com  2010-02-28 21:59 -------
Fixed by the commit in comment #2

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=11036

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-02-28 21:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-30 17:33 [Bug python/11036] New: Python: provide access to "hidden" variables andre dot poenitz at nokia dot com
2010-01-19 14:16 ` [Bug python/11036] " pmuldoon at redhat dot com
2010-01-19 14:29 ` pmuldoon at redhat dot com
2010-01-20 13:20 ` pmuldoon at redhat dot com
2010-02-24 22:07 ` pmuldoon at redhat dot com
2010-02-28 21:57 ` cvs-commit at gcc dot gnu dot org
2010-02-28 21:59 ` pmuldoon at redhat dot com

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 read-only IMAP folder(s) and NNTP newsgroup(s).