Bug 638653 - gdb-heap commands should not give a Python traceback when inferior process is not running
gdb-heap commands should not give a Python traceback when inferior process is...
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: gdb-heap (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Dave Malcolm
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-29 11:24 EDT by William Cohen
Modified: 2012-08-16 14:02 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-16 14:02:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description William Cohen 2010-09-29 11:24:11 EDT
Description of problem:

A number of the gdb-heap commands including "heap" and "heap all" produce a python traceback if there is not inferior process running in gdb. Something like the following:

(gdb) heap 
all     diff    label   log     select  sizes   used    
(gdb) heap
Traceback (most recent call last):
  File "/usr/share/gdb-heap/heap/commands.py", line 34, in g
    return f(self, args, from_tty)
  File "/usr/share/gdb-heap/heap/commands.py", line 56, in invoke
    usage_list = list(iter_usage_with_progress())
  File "/usr/share/gdb-heap/heap/__init__.py", line 526, in next
    return self.inner.next()
  File "/usr/share/gdb-heap/heap/__init__.py", line 539, in iter_usage
    for i, chunk in enumerate(ms.iter_mmap_chunks()):
  File "/usr/share/gdb-heap/heap/glibc.py", line 196, in iter_mmap_chunks
    for (start, end) in iter_mmap_heap_chunks(inf.pid):
  File "/usr/share/gdb-heap/heap/glibc.py", line 387, in iter_mmap_heap_chunks
    for line in open('/proc/%i/maps' % pid):
IOError: [Errno 2] No such file or directory: '/proc/0/maps'
Error occurred in Python command: [Errno 2] No such file or directory: '/proc/0/maps'

Version-Release number of selected component (if applicable):

gdb-7.2-15.fc14.x86_64
gdb-heap-0.5-1.fc14.x86_64


How reproducible:

Every time


Steps to Reproduce:
1. PYTHONPATH=/usr/share/gdb-heap gdb /bin/ls
   python import heap
2. run the /bin/ls in gdb
3. Now try the "heap" command in gdb
  
Actual results:

(gdb) heap
Traceback (most recent call last):
  File "/usr/share/gdb-heap/heap/commands.py", line 34, in g
    return f(self, args, from_tty)
  File "/usr/share/gdb-heap/heap/commands.py", line 56, in invoke
    usage_list = list(iter_usage_with_progress())
  File "/usr/share/gdb-heap/heap/__init__.py", line 526, in next
    return self.inner.next()
  File "/usr/share/gdb-heap/heap/__init__.py", line 539, in iter_usage
    for i, chunk in enumerate(ms.iter_mmap_chunks()):
  File "/usr/share/gdb-heap/heap/glibc.py", line 196, in iter_mmap_chunks
    for (start, end) in iter_mmap_heap_chunks(inf.pid):
  File "/usr/share/gdb-heap/heap/glibc.py", line 387, in iter_mmap_heap_chunks
    for line in open('/proc/%i/maps' % pid):
IOError: [Errno 2] No such file or directory: '/proc/0/maps'
Error occurred in Python command: [Errno 2] No such file or directory: '/proc/0/maps'

Expected results:

There should be a messages saying that there is no heap information available or that no inferior process is running. There shouldn't be a python traceback


Additional info:
Comment 1 Dave Malcolm 2010-09-29 12:28:39 EDT
Thanks.

This seems to be a gdb bug: gdb.inferiors() is non-empty after the inferior process quits.  Is this intentional?

With gdb-7.1-34.fc13.x86_64, gdb.inferiors() returns an empty tuple:
  Program exited normally.
  (gdb) python print gdb.inferiors()
  ()

With gdb-7.2-7.fc14.x86_64, gdb.inferiors() returns a non-empty tuple:
  Program exited normally.
  (gdb) python print gdb.inferiors()
  (<gdb.Inferior object at 0x1f55a30>,)
  (gdb) python print gdb.inferiors()[0].pid
  0
  (gdb) python print gdb.inferiors()[0].threads()
  ()

Reassigning to gdb
Comment 2 Jan Kratochvil 2010-09-30 11:21:43 EDT
From the C GDB point of view:
 * gdb-heap does not check anywhere GDB runs a local process, it can be also
   a MIPS remote process.
 * inferior does not need to have any process, neither living nor core file.
   (gdb) add-inferior
   (gdb) inferior 2
   There is nothing now.
 * Even listed threads and existing inferior.pid may come just from a core file.

There should be at least a Python interface to `target_has_execution'.  Multi-inferior has still various issues anyway so it will not reflect execution of the current inferior, just of any inferior.
Re: [patch] regression: Quit should not ask with core (PR 12071)
http://sourceware.org/ml/gdb-patches/2010-09/msg00484.html
Comment 3 Fedora End Of Life 2012-08-16 14:02:21 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Note You need to log in before you can comment on or make changes to this bug.