This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/17981] New: gdb.breakpoints() returns None if there are no breakpoints; should return empty sequence


https://sourceware.org/bugzilla/show_bug.cgi?id=17981

            Bug ID: 17981
           Summary: gdb.breakpoints() returns None if there are no
                    breakpoints; should return empty sequence
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: jason.heeris at gmail dot com

The docs for 'gdb.breakpoints()' say:

> Return a sequence holding all of gdb's breakpoints.

If there are no breakpoints, I'd expect an empty sequence to be returned.
Instead, I get None. If you assume the return value is always a sequence, type
errors will ensue.

Workaround: add something like 'bps = bps if (bps is not None) else []' after
calling 'gdb.breakpoints()'.

Output of 'gdb --version':

GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1

Output of "pi" then "import sys; print(sys.version)" from inside GDB:

3.4.0 (default, Apr 11 2014, 13:08:40) 
[GCC 4.8.2]

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]