summaryrefslogtreecommitdiff
path: root/overlay/mgdb/gdb/amd64-winnt-tdep.c
blob: c9089dcb7b3e00edc35c0fb093e38f6f27433a9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/***************************************************************/
/*  mgdb: midipix-specific bits for gdb                        */
/*  Copyright (C) 2019  Z. Gilboa                              */
/*  Released under GPLv2 and GPLv3; see COPYING.MGDB.          */
/***************************************************************/

#include "defs.h"
#include "osabi.h"
#include "solib.h"
#include "solib-target.h"
#include "frame-unwind.h"
#include "amd64-windows-tdep.c"

#define amd64_winnt_push_dummy_call		amd64_windows_push_dummy_call
#define amd64_winnt_return_value		amd64_windows_return_value
#define amd64_winnt_skip_trampoline_code	amd64_windows_skip_trampoline_code

#define amd64_winnt_skip_prologue               amd64_windows_skip_prologue
#define amd64_winnt_skip_main_prologue		amd64_skip_main_prologue
#define amd64_winnt_frame_unwind                amd64_windows_frame_unwind

extern void amd64_winnt_init_reg_offsets(void);

static void amd64_winnt_init_abi (struct gdbarch_info info, struct gdbarch * gdbarch)
{
	/* abi */
	amd64_init_abi                    (info, gdbarch);

	/* out-of-band function calls */
	set_gdbarch_push_dummy_call       (gdbarch, amd64_winnt_push_dummy_call);
	set_gdbarch_return_value          (gdbarch, amd64_winnt_return_value);
	set_gdbarch_skip_trampoline_code  (gdbarch, amd64_winnt_skip_trampoline_code);

	/* skip prologue methods */
	set_gdbarch_skip_prologue         (gdbarch, amd64_windows_skip_prologue);
	set_gdbarch_skip_main_prologue    (gdbarch, amd64_skip_main_prologue);

	/* SEH unwinder */
	frame_unwind_append_unwinder      (gdbarch, &amd64_winnt_frame_unwind);

	/* todo: inferior-specific, dynamically detected size of long */
	set_gdbarch_long_bit              (gdbarch, 64);

	/* solibs */
	set_solib_ops                     (gdbarch, &solib_target_so_ops);

	/* register offsets */
	amd64_winnt_init_reg_offsets();
}

void windows_init_abi (struct gdbarch_info info, struct gdbarch * gdbarch)
{
}

extern initialize_file_ftype _initialize_amd64_winnt_tdep;

void
_initialize_amd64_winnt_tdep (void)
{
	gdbarch_register_osabi(
		bfd_arch_i386,
		bfd_mach_x86_64,
		GDB_OSABI_WINNT,
		amd64_winnt_init_abi);
}