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; |
2403 |
|
2404 |
/* This is the hack to determine which version of gcc is used to generate |
2405 |
the function, if it is greater than 4.6, this use thiscall for member |
2406 |
function. */ |
2407 |
int i386_windows_build_gt_gcc46 = 0; |
2399 |
|
2408 |
|
2400 |
static CORE_ADDR |
2409 |
static CORE_ADDR |
2401 |
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, |
2410 |
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; |
2417 |
int i; |
2409 |
int write_pass; |
2418 |
int write_pass; |
2410 |
int args_space = 0; |
2419 |
int args_space = 0; |
|
|
2420 |
struct type *func_type = value_type (function); |
2421 |
int i386_windows_thiscall = 0; |
2422 |
|
2423 |
if (func_type) |
2424 |
{ |
2425 |
func_type = check_typedef (func_type); |
2426 |
|
2427 |
if (TYPE_CODE (func_type) == TYPE_CODE_PTR) |
2428 |
func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); |
2429 |
|
2430 |
if( (TYPE_CODE (func_type) == TYPE_CODE_METHOD) |
2431 |
&& i386_windows_build_gt_gcc46 == 1 |
2432 |
&& (nargs > 0) |
2433 |
&& i386_windows_static_memfun == 0 ) |
2434 |
{ |
2435 |
/* a.f(5,6); |
2436 |
args[0] = this pointer; |
2437 |
args[1] = 5; |
2438 |
args[2] = 6; */ |
2439 |
i386_windows_thiscall = 1; |
2440 |
} |
2441 |
} |
2411 |
|
2442 |
|
2412 |
/* Determine the total space required for arguments and struct |
2443 |
/* Determine the total space required for arguments and struct |
2413 |
return address in a first pass (allowing for 16-byte-aligned |
2444 |
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; |
2461 |
args_space += 4; |
2431 |
} |
2462 |
} |
2432 |
|
2463 |
|
2433 |
for (i = 0; i < nargs; i++) |
2464 |
for (i = i386_windows_thiscall; i < nargs; i++) |
2434 |
{ |
2465 |
{ |
2435 |
int len = TYPE_LENGTH (value_enclosing_type (args[i])); |
2466 |
int len = TYPE_LENGTH (value_enclosing_type (args[i])); |
2436 |
|
2467 |
|
Lines 2482-2487
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
Link Here
|
2482 |
/* ...and fake a frame pointer. */ |
2513 |
/* ...and fake a frame pointer. */ |
2483 |
regcache_cooked_write (regcache, I386_EBP_REGNUM, buf); |
2514 |
regcache_cooked_write (regcache, I386_EBP_REGNUM, buf); |
2484 |
|
2515 |
|
|
|
2516 |
if (i386_windows_thiscall) |
2517 |
{ |
2518 |
/* args[0] refer to the last argument which is the this pointer */ |
2519 |
regcache_cooked_write (regcache, I386_ECX_REGNUM, value_contents_all(args[0])); |
2520 |
} |
2521 |
|
2485 |
/* MarkK wrote: This "+ 8" is all over the place: |
2522 |
/* MarkK wrote: This "+ 8" is all over the place: |
2486 |
(i386_frame_this_id, i386_sigtramp_frame_this_id, |
2523 |
(i386_frame_this_id, i386_sigtramp_frame_this_id, |
2487 |
i386_dummy_id). It's there, since all frame unwinders for |
2524 |
i386_dummy_id). It's there, since all frame unwinders for |