diff --git a/programs/winedbg/Makefile.in b/programs/winedbg/Makefile.in index 6fad9d74836..a4f40aeda72 100644 --- a/programs/winedbg/Makefile.in +++ b/programs/winedbg/Makefile.in @@ -13,6 +13,7 @@ C_SRCS = \ be_alpha.c \ be_i386.c \ be_ppc.c \ + be_sparc.c \ be_x86_64.c \ break.c \ crashdlg.c \ diff --git a/programs/winedbg/be_sparc.c b/programs/winedbg/be_sparc.c new file mode 100644 index 00000000000..45ba44e406a --- /dev/null +++ b/programs/winedbg/be_sparc.c @@ -0,0 +1,158 @@ +/* + * Debugger Sparc specific functions + * + * Copyright 2010 Austin English + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "debugger.h" + +#if defined(__sparc__) + +static unsigned be_sparc_get_addr(HANDLE hThread, const CONTEXT* ctx, + enum be_cpu_addr bca, ADDRESS64* addr) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +static unsigned be_sparc_get_register_info(int regno, enum be_cpu_addr* kind) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +static void be_sparc_single_step(CONTEXT* ctx, unsigned enable) +{ + dbg_printf("not done for Sparc\n"); +} + +static void be_sparc_print_context(HANDLE hThread, const CONTEXT* ctx, int all_regs) +{ + dbg_printf("not done for Sparc\n"); +} + +static void be_sparc_print_segment_info(HANDLE hThread, const CONTEXT* ctx) +{ + dbg_printf("not done for Sparc\n"); +} + +static struct dbg_internal_var be_sparc_ctx[] = +{ + {0, NULL, 0, dbg_itype_none} +}; + +static unsigned be_sparc_is_step_over_insn(const void* insn) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +static unsigned be_sparc_is_function_return(const void* insn) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +static unsigned be_sparc_is_break_insn(const void* insn) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +static unsigned be_sparc_is_func_call(const void* insn, ADDRESS64* callee) +{ + return FALSE; +} + +static void be_sparc_disasm_one_insn(ADDRESS64* addr, int display) +{ + dbg_printf("not done for Sparc\n"); +} + +static unsigned be_sparc_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long* val, unsigned size) +{ + dbg_printf("not done for Sparc\n"); + return 0; +} + +static unsigned be_sparc_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long val, unsigned size) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +static unsigned be_sparc_is_watchpoint_set(const CONTEXT* ctx, unsigned idx) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +static void be_sparc_clear_watchpoint(CONTEXT* ctx, unsigned idx) +{ + dbg_printf("not done for Sparc\n"); +} + +static int be_sparc_adjust_pc_for_break(CONTEXT* ctx, BOOL way) +{ + dbg_printf("not done for Sparc\n"); + return 0; +} + +static int be_sparc_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, + unsigned ext_sign, LONGLONG* ret) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +static int be_sparc_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, + long double* ret) +{ + dbg_printf("not done for Sparc\n"); + return FALSE; +} + +struct backend_cpu be_sparc = +{ + IMAGE_FILE_MACHINE_SPARC, + 4, + be_cpu_linearize, + be_cpu_build_addr, + be_sparc_get_addr, + be_sparc_get_register_info, + be_sparc_single_step, + be_sparc_print_context, + be_sparc_print_segment_info, + be_sparc_ctx, + be_sparc_is_step_over_insn, + be_sparc_is_function_return, + be_sparc_is_break_insn, + be_sparc_is_func_call, + be_sparc_disasm_one_insn, + be_sparc_insert_Xpoint, + be_sparc_remove_Xpoint, + be_sparc_is_watchpoint_set, + be_sparc_clear_watchpoint, + be_sparc_adjust_pc_for_break, + be_sparc_fetch_integer, + be_sparc_fetch_float, +}; +#endif diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index 3d8ccd52cfe..885ff86989b 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -391,6 +391,41 @@ static size_t cpu_register_map[] = { FIELD_OFFSET(CONTEXT, SegFs), FIELD_OFFSET(CONTEXT, SegGs), }; +#elif defined(__sparc__) +static size_t cpu_register_map[] = { + FIELD_OFFSET(CONTEXT, g0), + FIELD_OFFSET(CONTEXT, g1), + FIELD_OFFSET(CONTEXT, g2), + FIELD_OFFSET(CONTEXT, g3), + FIELD_OFFSET(CONTEXT, g4), + FIELD_OFFSET(CONTEXT, g5), + FIELD_OFFSET(CONTEXT, g6), + FIELD_OFFSET(CONTEXT, g7), + FIELD_OFFSET(CONTEXT, o0), + FIELD_OFFSET(CONTEXT, o1), + FIELD_OFFSET(CONTEXT, o2), + FIELD_OFFSET(CONTEXT, o3), + FIELD_OFFSET(CONTEXT, o4), + FIELD_OFFSET(CONTEXT, o5), + FIELD_OFFSET(CONTEXT, o6), + FIELD_OFFSET(CONTEXT, o7), + FIELD_OFFSET(CONTEXT, l0), + FIELD_OFFSET(CONTEXT, l1), + FIELD_OFFSET(CONTEXT, l2), + FIELD_OFFSET(CONTEXT, l3), + FIELD_OFFSET(CONTEXT, l4), + FIELD_OFFSET(CONTEXT, l5), + FIELD_OFFSET(CONTEXT, l6), + FIELD_OFFSET(CONTEXT, l7), + FIELD_OFFSET(CONTEXT, i0), + FIELD_OFFSET(CONTEXT, i1), + FIELD_OFFSET(CONTEXT, i2), + FIELD_OFFSET(CONTEXT, i3), + FIELD_OFFSET(CONTEXT, i4), + FIELD_OFFSET(CONTEXT, i5), + FIELD_OFFSET(CONTEXT, i6), + FIELD_OFFSET(CONTEXT, i7), +}; #else # error Define the registers map for your CPU #endif diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 3e645065d04..aeef795a839 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -612,6 +612,8 @@ extern struct backend_cpu be_ppc; extern struct backend_cpu be_alpha; #elif defined(__x86_64__) extern struct backend_cpu be_x86_64; +#elif defined(__sparc__) +extern struct backend_cpu be_sparc; #else # error CPU unknown #endif @@ -630,6 +632,8 @@ int main(int argc, char** argv) be_cpu = &be_alpha; #elif defined(__x86_64__) be_cpu = &be_x86_64; +#elif defined(__sparc__) + be_cpu = &be_sparc; #else # error CPU unknown #endif