Add gdb pretty-printer for TileCoords.
This commit is contained in:
parent
f556bd396f
commit
5a1dbda3c3
1 changed files with 17 additions and 12 deletions
|
@ -3,13 +3,26 @@ import re;
|
||||||
|
|
||||||
class VectorWrapperPrinter:
|
class VectorWrapperPrinter:
|
||||||
def __init__(self, parVal):
|
def __init__(self, parVal):
|
||||||
self.val = parVal
|
self.val = parVal;
|
||||||
|
|
||||||
def to_string(self):
|
def to_string(self):
|
||||||
sz = int(self.val["m_wrapped"].type.template_argument(1));
|
sz = int(self.val["m_wrapped"].type.template_argument(1));
|
||||||
arr_vals = ", ".join(str(self.val["m_wrapped"]["_M_elems"][z]) for z in range(0, sz));
|
arr_vals = ", ".join(str(self.val["m_wrapped"]["_M_elems"][z]) for z in range(0, sz));
|
||||||
return "<{0}>".format(arr_vals);
|
return "<{0}>".format(arr_vals);
|
||||||
|
|
||||||
|
def display_hint(self):
|
||||||
|
return "array";
|
||||||
|
|
||||||
|
class TileCoordsPrinter:
|
||||||
|
def __init__(self, parVal):
|
||||||
|
self.val = parVal;
|
||||||
|
|
||||||
|
def to_string(self):
|
||||||
|
return "{{m_pos = {0}, m_size = {1} (upper)}}".format(self.val["m_pos"], self.val["m_size"]);
|
||||||
|
|
||||||
|
def display_hint(self):
|
||||||
|
return "map";
|
||||||
|
|
||||||
def vector_wrapper_match(parVal):
|
def vector_wrapper_match(parVal):
|
||||||
tag_value = str(parVal.type.strip_typedefs().tag);
|
tag_value = str(parVal.type.strip_typedefs().tag);
|
||||||
if tag_value == None:
|
if tag_value == None:
|
||||||
|
@ -17,21 +30,13 @@ def vector_wrapper_match(parVal):
|
||||||
|
|
||||||
reg_vecbase = re.compile("^vwr::implem::VecBase<.*>$");
|
reg_vecbase = re.compile("^vwr::implem::VecBase<.*>$");
|
||||||
reg_vec = re.compile("^vwr::Vec<.*>$");
|
reg_vec = re.compile("^vwr::Vec<.*>$");
|
||||||
|
reg_tilecoords = re.compile("^dk::TileCoords<.*>$");
|
||||||
if reg_vecbase.match(tag_value) or reg_vec.match(tag_value):
|
if reg_vecbase.match(tag_value) or reg_vec.match(tag_value):
|
||||||
return VectorWrapperPrinter(parVal);
|
return VectorWrapperPrinter(parVal);
|
||||||
|
elif reg_tilecoords.match(tag_value):
|
||||||
|
return TileCoordsPrinter(parVal);
|
||||||
else:
|
else:
|
||||||
return None;
|
return None;
|
||||||
|
|
||||||
def display_hint(self):
|
|
||||||
return "array";
|
|
||||||
|
|
||||||
def register_printers(parObjfile):
|
def register_printers(parObjfile):
|
||||||
parObjfile.pretty_printers.append(vector_wrapper_match);
|
parObjfile.pretty_printers.append(vector_wrapper_match);
|
||||||
|
|
||||||
# (gdb) p parFrom
|
|
||||||
# $1 = (const dk::Viewport<2u>::coords &) @0x7fffffffb810: {<vwr::implem::VecBase<std::array<int, 2ul> >> = {m_wrapped = {_M_elems = {0,
|
|
||||||
# 0}}}, <vwr::implem::VecAccessors<std::array<int, 2ul>, 2u>> = {<vwr::implem::Vec2Promotion<std::array<int, 2ul>, true>> = {<No data fields>}, <No data fields>}, static unit_x = <optimized out>, static unit_y = <optimized out>}
|
|
||||||
|
|
||||||
# (gdb) p parFrom
|
|
||||||
# $1 = (const dk::Viewport<2u>::coords &) @0x7fffffffb810: {<vwr::implem::VecBase<std::array<int, 2ul> >> =
|
|
||||||
# {0, 0}, <vwr::implem::VecAccessors<std::array<int, 2ul>, 2u>> = {<vwr::implem::Vec2Promotion<std::array<int, 2ul>, true>> = {<No data fields>}, <No data fields>}, static unit_x = <optimized out>, static unit_y = <optimized out>}
|
|
||||||
|
|
Loading…
Reference in a new issue