Commit b3910d59 authored by Simon Sobisch's avatar Simon Sobisch

cobcd.py: malloc adjustments

* fix return type
* directly get the expression without parsing a user-output
parent 1dfb2849
......@@ -201,17 +201,15 @@ def GdbExecute(curframe, command):
def cob_malloc(size):
# This is the Python-side wrapper for cob_malloc calls.
# We use the C-side wrapper that cobcd-st put into the generated .C
command = "call (char *){0}({1})".format(GV_ModuleState.cob_malloc, size)
hexback = gdb.execute(command, False, True).split()[2]
retval = int(hexback, 16)
return retval
expression = "(void *(*)(const size_t)){0}({1})".format(GV_ModuleState.cob_malloc, size)
ret = gdb.parse_and_eval(expression)
return int(ret)
def cob_cache_malloc(size):
command = "call (char *){0}({1})".format(GV_ModuleState.cob_cache_malloc, size)
hexback = gdb.execute(command, False, True).split()[2]
retval = int(hexback, 16)
return retval
expression = "(void *(*)(const size_t)){0}({1})".format(GV_ModuleState.cob_cache_malloc, size)
ret = gdb.parse_and_eval(expression)
return int(ret)
def cob_free(location):
......
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