mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 16:48:11 +00:00
gdb: Workaround optimized out quark_seq_id
On fedora 38 (and it was the case in previous releases), the quark_seq_id is optimized out so getting quarks from the global variable always failed. This patch works around that by assuming it is a valid quark whenever the quark_seq_id is not accessible. This issue often manifested as Python Exception <class 'TypeError'>: can only concatenate str (not "NoneType") to str when debugging as other parts of the code assume that getting the quark for a GType name will work. Same as https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3559 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5986>
This commit is contained in:
parent
3855646f1d
commit
6258ee56d2
1 changed files with 23 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
##
|
##
|
||||||
## imported from glib: glib/glib_gdb.py
|
# imported from glib: glib/glib_gdb.py
|
||||||
##
|
##
|
||||||
import gdb
|
import gdb
|
||||||
import sys
|
import sys
|
||||||
|
@ -11,23 +11,35 @@ if sys.version_info[0] >= 3:
|
||||||
def read_global_var (symname):
|
def read_global_var (symname):
|
||||||
return gdb.selected_frame().read_var(symname)
|
return gdb.selected_frame().read_var(symname)
|
||||||
|
|
||||||
def g_quark_to_string (quark):
|
|
||||||
|
def g_quark_to_string(quark):
|
||||||
if quark is None:
|
if quark is None:
|
||||||
return None
|
return None
|
||||||
quark = long(quark)
|
quark = long(quark)
|
||||||
if quark == 0:
|
if quark == 0:
|
||||||
return None
|
return None
|
||||||
|
max_q = None
|
||||||
try:
|
try:
|
||||||
val = read_global_var ("quarks")
|
val = read_global_var("quarks")
|
||||||
max_q = long(read_global_var ("quark_seq_id"))
|
try:
|
||||||
except:
|
max_q = long(read_global_var("quark_seq_id"))
|
||||||
|
# quark_seq_id gets optimized out in some builds so work around it
|
||||||
|
except gdb.error:
|
||||||
|
pass
|
||||||
|
except Exception:
|
||||||
|
try:
|
||||||
|
val = read_global_var("g_quarks")
|
||||||
|
try:
|
||||||
|
max_q = long(read_global_var("g_quark_seq_id"))
|
||||||
|
except gdb.error:
|
||||||
|
pass
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
if max_q is None or quark < max_q:
|
||||||
try:
|
try:
|
||||||
val = read_global_var ("g_quarks")
|
|
||||||
max_q = long(read_global_var ("g_quark_seq_id"))
|
|
||||||
except:
|
|
||||||
return None;
|
|
||||||
if quark < max_q:
|
|
||||||
return val[quark].string()
|
return val[quark].string()
|
||||||
|
except gdb.MemoryError:
|
||||||
|
print("Invalid quark %d" % quark)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Reference in a new issue