From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30096 invoked by alias); 10 Aug 2010 16:01:10 -0000 Received: (qmail 30074 invoked by uid 48); 10 Aug 2010 16:01:09 -0000 Date: Tue, 10 Aug 2010 16:01:00 -0000 From: "xdegaye at gmail dot com" To: gdb-prs@sourceware.org Message-ID: <20100810160109.11900.xdegaye@gmail.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug python/11900] New: OSError exception when running 'python help(gdb)' X-Bugzilla-Reason: CC Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2010-q3/txt/msg00190.txt.bz2 When sourcing 'gdb-help.py' (see below), python throws OSError when running 'help(gdb)', see the output in 'logfile' below. This does not occur after deleting gdb.__path__. Run the following command to reproduce the bug: gdb -batch-silent -x cmd.gdb I am not sure if gdb is a package. If gdb is a package, then __path__[0] should be an existing directory. If gdb is a module and not a package, it must not have a __path__ attribute. Applying the 'gdb-help.diff' patch (see below) fixes the bug. === cmd.gdb ======================================================= set logging file logfile set logging overwrite on set logging on source gdb-help.py === gdb-help.py =================================================== print 'gdb.__path__: ', gdb.__path__ try: help(gdb) except OSError, error: print OSError, error print '***retry after deleting the __path__ attribute***' del gdb.__path__ help(gdb) import sys sys.exit() === gdb-help.diff ================================================= diff --git a/gdb/python/python.c b/gdb/python/python.c index 7346fba..943efb5 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -763,7 +763,6 @@ sys.path.insert(0, gdb.PYTHONDIR)\n\ # The gdb module is implemented in C rather than in Python. As a result,\n\ # the associated __init.py__ script is not not executed by default when\n\ # the gdb module gets imported. Execute that script manually if it exists.\n\ -gdb.__path__ = [gdb.PYTHONDIR + '/gdb']\n\ from os.path import exists\n\ ipy = gdb.PYTHONDIR + '/gdb/__init__.py'\n\ if exists (ipy):\n\ === logfile ======================================================= gdb.__path__: ['/home/xavier/src/packages/gdb/gdb-git/gdb/install/share/gdb/python/gdb'] exceptions.OSError [Errno 2] No such file or directory: '/home/xavier/src/packages/gdb/gdb-git/gdb/install/share/gdb/python/gdb' ***retry after deleting the __path__ attribute*** Help on module gdb: NAME gdb FILE (built-in) CLASSES __builtin__.object Block BlockIterator Breakpoint Command Field Frame Function Inferior InferiorThread Membuf Objfile Parameter Progspace Symbol Symtab Symtab_and_line Type Value exceptions.Exception GdbError class Block(__builtin__.object) | GDB block object | | Methods defined here: | | __iter__(...) | x.__iter__() <==> iter(x) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T | | end = | End address of the block. | | function = | Symbol that names the block, or None. | | start = | Start address of the block. | | superblock = | Block containing the block, or None. class BlockIterator(__builtin__.object) | GDB block syms iterator object | | Methods defined here: | | __iter__(...) | x.__iter__() <==> iter(x) | | next(...) | x.next() -> the next value, or raise StopIteration | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T class Breakpoint(__builtin__.object) | GDB breakpoint object | | Methods defined here: | | is_valid(...) | Return true if this breakpoint is valid, false if not. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T | | commands = | Commands of the breakpoint, as specified by the user. | | condition = | Condition of the breakpoint, as specified by the user,or None if no condition set. | | enabled = | Boolean telling whether the breakpoint is enabled. | | expression = | Expression of the breakpoint, as specified by the user. | | hit_count = | Number of times the breakpoint has been hit. | Can be set to zero to clear the count. No other value is valid | when setting this property. | | ignore_count = | Number of times this breakpoint should be automatically continued. | | location = | Location of the breakpoint, as specified by the user. | | number = | Breakpoint's number assigned by GDB. | | silent = | Boolean telling whether the breakpoint is silent. | | task = | Thread ID for the breakpoint. | If the value is a task ID (integer), then this is an Ada task-specific breakpoint. | If the value is None, then this breakpoint is not task-specific. | No other type of value can be used. | | thread = | Thread ID for the breakpoint. | If the value is a thread ID (integer), then this is a thread-specific breakpoint. | If the value is None, then this breakpoint is not thread-specific. | No other type of value can be used. | | type = | Type of breakpoint. class Command(__builtin__.object) | GDB command object | | Methods defined here: | | __init__(...) | x.__init__(...) initializes x; see x.__class__.__doc__ for signature | | dont_repeat(...) | Prevent command repetition when user enters empty line. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T class Field(__builtin__.object) | GDB field object class Frame(__builtin__.object) | GDB frame object | | Methods defined here: | | __eq__(...) | x.__eq__(y) <==> x==y | | __ge__(...) | x.__ge__(y) <==> x>=y | | __gt__(...) | x.__gt__(y) <==> x>y | | __le__(...) | x.__le__(y) <==> x<=y | | __lt__(...) | x.__lt__(y) <==> x x!=y | | __str__(...) | x.__str__() <==> str(x) | | block(...) | block () -> gdb.Block. | Return the frame's code block. | | find_sal(...) | find_sal () -> gdb.Symtab_and_line. | Return the frame's symtab and line. | | function(...) | function () -> gdb.Symbol. | Returns the symbol for the function corresponding to this frame. | | is_valid(...) | is_valid () -> Boolean. | Return true if this frame is valid, false if not. | | name(...) | name () -> String. | Return the function name of the frame, or None if it can't be determined. | | newer(...) | newer () -> gdb.Frame. | Return the frame called by this frame. | | older(...) | older () -> gdb.Frame. | Return the frame that called this frame. | | pc(...) | pc () -> Long. | Return the frame's resume address. | | read_var(...) | read_var (variable) -> gdb.Value. | Return the value of the variable in this frame. | | select(...) | Select this frame as the user's current frame. | | type(...) | type () -> Integer. | Return the type of the frame. | | unwind_stop_reason(...) | unwind_stop_reason () -> Integer. | Return the reason why it's not possible to find frames older than this. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T class Function(__builtin__.object) | GDB function object | | Methods defined here: | | __init__(...) | x.__init__(...) initializes x; see x.__class__.__doc__ for signature | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T class GdbError(exceptions.Exception) | Methods inherited from exceptions.Exception: | | __getitem__(...) | | __init__(...) | | __str__(...) class Inferior(__builtin__.object) | GDB inferior object | | Methods defined here: | | read_memory(...) | read_memory (address, length) -> buffer | Return a buffer object for reading from the inferior's memory. | | search_memory(...) | search_memory (address, length, pattern) -> long | Return a long with the address of a match, or None. | | threads(...) | Return all the threads of this inferior. | | write_memory(...) | write_memory (address, buffer [, length]) | Write the given buffer object to the inferior's memory. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | num = | ID of inferior, as assigned by GDB. | | pid = | PID of inferior, as assigned by the OS. | | was_attached = | True if the inferior was created using 'attach'. class InferiorThread(__builtin__.object) | GDB thread object | | Methods defined here: | | is_exited(...) | is_exited () -> Boolean | Return whether the thread is exited. | | is_running(...) | is_running () -> Boolean | Return whether the thread is running. | | is_stopped(...) | is_stopped () -> Boolean | Return whether the thread is stopped. | | switch(...) | switch () | Makes this the GDB selected thread. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | num = | ID of the thread, as assigned by GDB. | | ptid = | ID of the thread, as assigned by the OS. class Membuf(__builtin__.object) | GDB memory buffer object | | Methods defined here: | | __str__(...) | x.__str__() <==> str(x) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T class Objfile(__builtin__.object) | GDB objfile object | | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T | | filename = | The objfile's filename, or None. | | pretty_printers = del x.name | | __getattribute__(...) | x.__getattribute__('name') <==> x.name | | __init__(...) | x.__init__(...) initializes x; see x.__class__.__doc__ for signature | | __setattr__(...) | x.__setattr__('name', value) <==> x.name = value | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T class Progspace(__builtin__.object) | GDB progspace object | | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T | | filename = | The progspace's main filename, or None. | | pretty_printers = str(x) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | addr_class = | Address class of the symbol. | | is_argument = | True if the symbol is an argument of a function. | | is_constant = | True if the symbol is a constant. | | is_function = | True if the symbol is a function or method. | | is_variable = | True if the symbol is a variable. | | linkage_name = | Name of the symbol, as used by the linker (i.e., may be mangled). | | name = | Name of the symbol, as it appears in the source code. | | print_name = | Name of the symbol in a form suitable for output. | This is either name or linkage_name, depending on whether the user asked GDB | to display demangled or mangled names. | | symtab = | Symbol table in which the symbol appears. class Symtab(__builtin__.object) | GDB symtab object | | Methods defined here: | | __str__(...) | x.__str__() <==> str(x) | | fullname(...) | fullname () -> String. | Return the symtab's full source filename. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T | | filename = | The symbol table's source filename. | | objfile = | The symtab's objfile. class Symtab_and_line(__builtin__.object) | GDB symtab_and_line object | | Methods defined here: | | __str__(...) | x.__str__() <==> str(x) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T | | line = | Return the symtab_and_line's line. | | pc = | Return the symtab_and_line's pc. | | symtab = | Symtab object. class Type(__builtin__.object) | GDB type object | | Methods defined here: | | __str__(...) | x.__str__() <==> str(x) | | const(...) | const () -> Type | Return a const variant of this type. | | fields(...) | field () -> list | Return a sequence holding all the fields of this type. | Each field is a dictionary. | | pointer(...) | pointer () -> Type | Return a type of pointer to this type. | | range(...) | range () -> tuple | Return a tuple containing the lower and upper range for this type. | | reference(...) | reference () -> Type | Return a type of reference to this type. | | strip_typedefs(...) | strip_typedefs () -> Type | Return a type formed by stripping this type of all typedefs. | | target(...) | target () -> Type | Return the target type of this type. | | template_argument(...) | template_argument (arg, [block]) -> Type | Return the type of a template argument. | | unqualified(...) | unqualified () -> Type | Return a variant of this type without const or volatile attributes. | | volatile(...) | volatile () -> Type | Return a volatile variant of this type | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | code = | The code for this type. | | sizeof = | The size of this type, in bytes. | | tag = | The tag name for this type, or None. class Value(__builtin__.object) | GDB value object | | Methods defined here: | | __abs__(...) | x.__abs__() <==> abs(x) | | __add__(...) | x.__add__(y) <==> x+y | | __and__(...) | x.__and__(y) <==> x&y | | __call__(...) | x.__call__(...) <==> x(...) | | __delitem__(...) | x.__delitem__(y) <==> del x[y] | | __div__(...) | x.__div__(y) <==> x/y | | __eq__(...) | x.__eq__(y) <==> x==y | | __float__(...) | x.__float__() <==> float(x) | | __ge__(...) | x.__ge__(y) <==> x>=y | | __getitem__(...) | x.__getitem__(y) <==> x[y] | | __gt__(...) | x.__gt__(y) <==> x>y | | __hash__(...) | x.__hash__() <==> hash(x) | | __int__(...) | x.__int__() <==> int(x) | | __invert__(...) | x.__invert__() <==> ~x | | __le__(...) | x.__le__(y) <==> x<=y | | __len__(...) | x.__len__() <==> len(x) | | __long__(...) | x.__long__() <==> long(x) | | __lshift__(...) | x.__lshift__(y) <==> x< x x%y | | __mul__(...) | x.__mul__(y) <==> x*y | | __ne__(...) | x.__ne__(y) <==> x!=y | | __neg__(...) | x.__neg__() <==> -x | | __nonzero__(...) | x.__nonzero__() <==> x != 0 | | __or__(...) | x.__or__(y) <==> x|y | | __pos__(...) | x.__pos__() <==> +x | | __pow__(...) | x.__pow__(y[, z]) <==> pow(x, y[, z]) | | __radd__(...) | x.__radd__(y) <==> y+x | | __rand__(...) | x.__rand__(y) <==> y&x | | __rdiv__(...) | x.__rdiv__(y) <==> y/x | | __rlshift__(...) | x.__rlshift__(y) <==> y< y%x | | __rmul__(...) | x.__rmul__(y) <==> y*x | | __ror__(...) | x.__ror__(y) <==> y|x | | __rpow__(...) | y.__rpow__(x[, z]) <==> pow(x, y[, z]) | | __rrshift__(...) | x.__rrshift__(y) <==> y>>x | | __rshift__(...) | x.__rshift__(y) <==> x>>y | | __rsub__(...) | x.__rsub__(y) <==> y-x | | __rxor__(...) | x.__rxor__(y) <==> y^x | | __setitem__(...) | x.__setitem__(i, y) <==> x[i]=y | | __str__(...) | x.__str__() <==> str(x) | | __sub__(...) | x.__sub__(y) <==> x-y | | __xor__(...) | x.__xor__(y) <==> x^y | | cast(...) | Cast the value to the supplied type. | | dereference(...) | Dereferences the value. | | lazy_string(...) | lazy_string ([encoding] [, length]) -> lazy_string | Return a lazy string representation of the value. | | string(...) | string ([encoding] [, errors] [, length]) -> string | Return Unicode string representation of the value. | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __new__ = | T.__new__(S, ...) -> a new object with type S, a subtype of T | | address = | The address of the value. | | is_optimized_out = | Type of the value. FUNCTIONS block_for_pc(...) Return the block containing the given pc value, or None. breakpoints(...) Return a tuple of all breakpoint objects current_objfile(...) Return the current Objfile being loaded, or None. current_progspace(...) Return the current Progspace. default_visualizer(...) Find the default visualizer for a Value. execute(...) Execute a gdb command flush(...) Flush gdb's filtered stdout stream. frame_stop_reason_string(...) stop_reason_string (Integer) -> String. Return a string explaining unwind stop reason. history(...) Get a value from history inferiors(...) inferiors () -> (gdb.Inferior, ...). Return a tuple containing all inferiors. lookup_symbol(...) lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this) Return a tuple with the symbol corresponding to the given name (or None) and a boolean indicating if name is a field of the current implied argument `this' (when the current language is object-oriented). lookup_type(...) lookup_type (name [, block]) -> type Return a Type corresponding to the given name. objfiles(...) Return a sequence of all loaded objfiles. parameter(...) Return a gdb parameter's value parse_and_eval(...) parse_and_eval (String) -> Value. Parse String as an expression, evaluate it, and return the result as a Value. progspaces(...) Return a sequence of all progspaces. selected_frame(...) selected_frame () -> gdb.Frame. Return the selected frame object. selected_thread(...) selected_thread () -> gdb.InferiorThread. Return the selected thread object. string_to_argv(...) string_to_argv (String) -> Array. Parse String and return an argv-like array. Arguments are separate by spaces and may be quoted. target_charset(...) target_charset () -> string. Return the name of the current target charset. target_wide_charset(...) target_wide_charset () -> string. Return the name of the current target wide charset. write(...) Write a string using gdb's filtered stream. DATA BP_ACCESS_WATCHPOINT = 8 BP_BREAKPOINT = 1 BP_HARDWARE_WATCHPOINT = 6 BP_NONE = 0 BP_READ_WATCHPOINT = 7 BP_WATCHPOINT = 5 COMMAND_BREAKPOINTS = 6 COMMAND_DATA = 1 COMMAND_FILES = 3 COMMAND_MAINTENANCE = 11 COMMAND_NONE = -1 COMMAND_OBSCURE = 10 COMMAND_RUNNING = 0 COMMAND_STACK = 2 COMMAND_STATUS = 5 COMMAND_SUPPORT = 4 COMMAND_TRACEPOINTS = 7 COMPLETE_COMMAND = 3 COMPLETE_FILENAME = 1 COMPLETE_LOCATION = 2 COMPLETE_NONE = 0 COMPLETE_SYMBOL = 4 DUMMY_FRAME = 1 FRAME_UNWIND_FIRST_ERROR = 2 FRAME_UNWIND_INNER_ID = 3 FRAME_UNWIND_NO_REASON = 0 FRAME_UNWIND_NO_SAVED_PC = 5 FRAME_UNWIND_NULL_ID = 1 FRAME_UNWIND_SAME_ID = 4 HOST_CONFIG = 'x86_64-unknown-linux-gnu' NORMAL_FRAME = 0 PARAM_AUTO_BOOLEAN = 1 PARAM_BOOLEAN = 0 PARAM_ENUM = 10 PARAM_FILENAME = 7 PARAM_INTEGER = 3 PARAM_OPTIONAL_FILENAME = 6 PARAM_STRING = 4 PARAM_STRING_NOESCAPE = 5 PARAM_UINTEGER = 2 PARAM_ZINTEGER = 8 PYTHONDIR = '/home/xavier/src/packages/gdb/gdb-git/gdb/install/share/g... SENTINEL_FRAME = 5 SIGTRAMP_FRAME = 3 SYMBOL_FUNCTIONS_DOMAIN = 5 SYMBOL_LABEL_DOMAIN = 3 SYMBOL_LOC_ARG = 4 SYMBOL_LOC_BLOCK = 10 SYMBOL_LOC_COMPUTED = 14 SYMBOL_LOC_CONST = 1 SYMBOL_LOC_CONST_BYTES = 11 SYMBOL_LOC_LABEL = 9 SYMBOL_LOC_LOCAL = 7 SYMBOL_LOC_OPTIMIZED_OUT = 13 SYMBOL_LOC_REF_ARG = 5 SYMBOL_LOC_REGISTER = 3 SYMBOL_LOC_REGPARM_ADDR = 6 SYMBOL_LOC_STATIC = 2 SYMBOL_LOC_TYPEDEF = 8 SYMBOL_LOC_UNDEF = 0 SYMBOL_LOC_UNRESOLVED = 12 SYMBOL_STRUCT_DOMAIN = 2 SYMBOL_TYPES_DOMAIN = 6 SYMBOL_UNDEF_DOMAIN = 0 SYMBOL_VARIABLES_DOMAIN = 4 SYMBOL_VAR_DOMAIN = 1 TARGET_CONFIG = 'x86_64-unknown-linux-gnu' TYPE_CODE_ARRAY = 2 TYPE_CODE_BITSTRING = 14 TYPE_CODE_BOOL = 21 TYPE_CODE_CHAR = 20 TYPE_CODE_COMPLEX = 22 TYPE_CODE_DECFLOAT = 25 TYPE_CODE_ENUM = 5 TYPE_CODE_ERROR = 15 TYPE_CODE_FLAGS = 6 TYPE_CODE_FLT = 9 TYPE_CODE_FUNC = 7 TYPE_CODE_INT = 8 TYPE_CODE_INTERNAL_FUNCTION = 27 TYPE_CODE_MEMBERPTR = 18 TYPE_CODE_METHOD = 16 TYPE_CODE_METHODPTR = 17 TYPE_CODE_NAMESPACE = 24 TYPE_CODE_PTR = 1 TYPE_CODE_RANGE = 12 TYPE_CODE_REF = 19 TYPE_CODE_SET = 11 TYPE_CODE_STRING = 13 TYPE_CODE_STRUCT = 3 TYPE_CODE_TYPEDEF = 23 TYPE_CODE_UNION = 4 TYPE_CODE_VOID = 10 VERSION = '7.2.50.20100810-cvs' WP_ACCESS = 2 WP_READ = 1 WP_WRITE = 0 pretty_printers = [] ======================================================================= -- Summary: OSError exception when running 'python help(gdb)' Product: gdb Version: 7.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: python AssignedTo: unassigned at sourceware dot org ReportedBy: xdegaye at gmail dot com CC: gdb-prs at sourceware dot org GCC build triplet: GNU gdb (GDB) 7.2.50.20100810-cvs http://sourceware.org/bugzilla/show_bug.cgi?id=11900 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.