Commit c289ac1f authored by hjk's avatar hjk Committed by hjk

debugger: add convienience constructor for std::strings

Change-Id: I61454ddbe417162ab182a1541b580e4cb4c783a4
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent a609689a
......@@ -545,6 +545,18 @@ def makeValue(type, init):
#warn(" VALUE: %s" % value)
return value
def makeStdString(init):
# Works only for small allocators, but they are usually empty.
gdb.execute("set $d=(std::string*)calloc(sizeof(std::string), 2)");
gdb.execute("call($d->basic_string(\"" + init +
"\",*(std::allocator<char>*)(1+$d)))")
value = parseAndEvaluate("$d").dereference()
#warn(" TYPE: %s" % value.type)
#warn(" ADDR: %s" % value.address)
#warn(" VALUE: %s" % value)
return value
def makeExpression(value):
type = stripClassTag(str(value.type))
if type.find(":") >= 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment