As previously guessed, the overload library is once again unrequired. Sigh.
Basically, a sequence of gdb commands can basically replicate the
functionality of the overload library. An example gdb MI2 session to
demonstrate:
strange@quark:~/c/aesalon$ gdb --interpreter=mi2 ~/c/malloc_test
(gdb)
-break-insert -f __malloc
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",
addr="<PENDING>",pending="__malloc",times="0",original-location="__malloc"}
(gdb)
-exec-run
^running
(gdb)
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
frame={addr="0x00007ffff7b03770",func="*__GI___libc_malloc",
args=[{name="bytes",value="1"}],file="malloc.c",line="3593"},thread-id="1",
stopped-threads="all"
(gdb)
-break-after 1 1
^done
(gdb)
-exec-finish
^running
*running,thread-id="1"
(gdb)
*stopped,reason="function-finished",frame={addr="0x000000000040054a",
func="allocate_memory",args=[],file="malloc_test_2.c",
fullname="/home/strange/c/malloc_test_2.c",line="7"},gdb-result-var="$1",
return-value="(void *) 0x601010",thread-id="1",stopped-threads="all"
(gdb)
-exec-continue
^running
(gdb)
*stopped,reason="exited-normally"
(gdb)
(edited for clarity, of course.)
The interesting line here is the '*stopped,reason="function-finished"', in
particular the result-record 'return-value' . . .
That alone should be enough. Sorry, but goodbye again, overload.