This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: The root cause for SEGV in evaluating fortran function call,any solution or suggestion?
> Date: Thu, 3 Nov 2005 11:14:51 +0800 (CST)
> From: Wu Zhou <woodzltc@cn.ibm.com>
>
> Maybe we can convert the argument to its pointer before we enter into
> call_function_by_hand (evaluate_subexp_standard: case OP_FUNCALL)?
> Normally what function you will use to allocate memory on the stack? I am
> not very familar with that kind of code. Thanks!
Allocating memory on the stack is actually quite eazy. Just
substract/add the amount of space you need from/to the stack pointer,
and use the new/old stack pointer as the address for the memory.
Whether you should substract or add depends on whether the stack grows
downward or upward. Use gdbarch_inner_than(gdbarch, 1, 2) to check.
There's quite a bit of code in infcall.c that uses this trick.
Mark