Lines 2396-2401
i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
Link Here
|
2396 |
/* Keep the stack aligned. */ |
2396 |
/* Keep the stack aligned. */ |
2397 |
return sp - 16; |
2397 |
return sp - 16; |
2398 |
} |
2398 |
} |
|
|
2399 |
/* This is the hack to handle the non-static member function to thiscall |
2400 |
calling convention mode, this variable is updated in eval.c of the |
2401 |
static member function check */ |
2402 |
int i386_windows_static_memfun = 0; |
2399 |
|
2403 |
|
2400 |
static CORE_ADDR |
2404 |
static CORE_ADDR |
2401 |
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, |
2405 |
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, |
Lines 2408-2413
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
Link Here
|
2408 |
int i; |
2412 |
int i; |
2409 |
int write_pass; |
2413 |
int write_pass; |
2410 |
int args_space = 0; |
2414 |
int args_space = 0; |
|
|
2415 |
struct type *func_type = value_type (function); |
2416 |
int i386_windows_thiscall = 0; |
2417 |
|
2418 |
if (func_type) |
2419 |
{ |
2420 |
func_type = check_typedef (func_type); |
2421 |
|
2422 |
if (TYPE_CODE (func_type) == TYPE_CODE_PTR) |
2423 |
func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); |
2424 |
|
2425 |
if( (TYPE_CODE (func_type) == TYPE_CODE_METHOD) |
2426 |
&& (nargs > 0) |
2427 |
&& i386_windows_static_memfun == 0 ) |
2428 |
{ |
2429 |
/* a.f(5,6); |
2430 |
args[0] = this pointer; |
2431 |
args[1] = 5; |
2432 |
args[2] = 6; */ |
2433 |
i386_windows_thiscall = 1; |
2434 |
} |
2435 |
} |
2411 |
|
2436 |
|
2412 |
/* Determine the total space required for arguments and struct |
2437 |
/* Determine the total space required for arguments and struct |
2413 |
return address in a first pass (allowing for 16-byte-aligned |
2438 |
return address in a first pass (allowing for 16-byte-aligned |
Lines 2430-2436
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
Link Here
|
2430 |
args_space += 4; |
2455 |
args_space += 4; |
2431 |
} |
2456 |
} |
2432 |
|
2457 |
|
2433 |
for (i = 0; i < nargs; i++) |
2458 |
for (i = i386_windows_thiscall; i < nargs; i++) |
2434 |
{ |
2459 |
{ |
2435 |
int len = TYPE_LENGTH (value_enclosing_type (args[i])); |
2460 |
int len = TYPE_LENGTH (value_enclosing_type (args[i])); |
2436 |
|
2461 |
|
Lines 2482-2487
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
Link Here
|
2482 |
/* ...and fake a frame pointer. */ |
2507 |
/* ...and fake a frame pointer. */ |
2483 |
regcache_cooked_write (regcache, I386_EBP_REGNUM, buf); |
2508 |
regcache_cooked_write (regcache, I386_EBP_REGNUM, buf); |
2484 |
|
2509 |
|
|
|
2510 |
if (i386_windows_thiscall) |
2511 |
{ |
2512 |
/* args[0] refer to the last argument which is the this pointer */ |
2513 |
regcache_cooked_write (regcache, I386_ECX_REGNUM, value_contents_all(args[0])); |
2514 |
} |
2515 |
|
2485 |
/* MarkK wrote: This "+ 8" is all over the place: |
2516 |
/* MarkK wrote: This "+ 8" is all over the place: |
2486 |
(i386_frame_this_id, i386_sigtramp_frame_this_id, |
2517 |
(i386_frame_this_id, i386_sigtramp_frame_this_id, |
2487 |
i386_dummy_id). It's there, since all frame unwinders for |
2518 |
i386_dummy_id). It's there, since all frame unwinders for |