hi-angel at yandex dot ru
2017-11-23 11:54:45 UTC
https://sourceware.org/bugzilla/show_bug.cgi?id=22481
Bug ID: 22481
Summary: Python Exception <class 'gdb.error'> Trying to read
string with inappropriate type `int'.:
Product: gdb
Version: 8.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: hi-angel at yandex dot ru
Target Milestone: ---
#Steps to reproduce:
1. Write the following code to ~/gdb.py
class my_print:
def __init__(self, val):
self.val = val
def to_string(self):
return self.val.string()
def lookup_type_my_int (val):
if str(val.type) == 'int':
return my_print(val)
return None
gdb.pretty_printers.append(lookup_type_my_int)
2. Run `gdb -nh`
3. type `source ~/gdb.py`
4. type `print 1`
Expected result: the value of "val" is printed
Actual results: error "$1 = Python Exception <class 'gdb.error'> Trying to read
string with inappropriate type `int'.:".
#Additional info:
python version 3.6.3
Some more results because this issue might be useful for someone coming from
google in attempt to use pretty printers:
Using "return str(self.val)" results in "$1 = Python Exception <class
'RecursionError'> maximum recursion depth exceeded in comparison:
1"
And using simply "return self.val" results in "[1] 29554 segmentation fault
(core dumped) gdb -q -nh"
Bug ID: 22481
Summary: Python Exception <class 'gdb.error'> Trying to read
string with inappropriate type `int'.:
Product: gdb
Version: 8.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: hi-angel at yandex dot ru
Target Milestone: ---
#Steps to reproduce:
1. Write the following code to ~/gdb.py
class my_print:
def __init__(self, val):
self.val = val
def to_string(self):
return self.val.string()
def lookup_type_my_int (val):
if str(val.type) == 'int':
return my_print(val)
return None
gdb.pretty_printers.append(lookup_type_my_int)
2. Run `gdb -nh`
3. type `source ~/gdb.py`
4. type `print 1`
Expected result: the value of "val" is printed
Actual results: error "$1 = Python Exception <class 'gdb.error'> Trying to read
string with inappropriate type `int'.:".
#Additional info:
python version 3.6.3
Some more results because this issue might be useful for someone coming from
google in attempt to use pretty printers:
Using "return str(self.val)" results in "$1 = Python Exception <class
'RecursionError'> maximum recursion depth exceeded in comparison:
1"
And using simply "return self.val" results in "[1] 29554 segmentation fault
(core dumped) gdb -q -nh"
--
You are receiving this mail because:
You are on the CC list for the bug.
You are receiving this mail because:
You are on the CC list for the bug.