OLD | NEW |
1 /* SPU target-dependent code for GDB, the GNU debugger. | 1 /* SPU target-dependent code for GDB, the GNU debugger. |
2 Copyright (C) 2006-2012 Free Software Foundation, Inc. | 2 Copyright (C) 2006-2012 Free Software Foundation, Inc. |
3 | 3 |
4 Contributed by Ulrich Weigand <uweigand@de.ibm.com>. | 4 Contributed by Ulrich Weigand <uweigand@de.ibm.com>. |
5 Based on a port by Sid Manning <sid@us.ibm.com>. | 5 Based on a port by Sid Manning <sid@us.ibm.com>. |
6 | 6 |
7 This file is part of GDB. | 7 This file is part of GDB. |
8 | 8 |
9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 control or the beginning of the function or reach the hard | 842 control or the beginning of the function or reach the hard |
843 limit for the size of an epilogue. */ | 843 limit for the size of an epilogue. */ |
844 | 844 |
845 static int | 845 static int |
846 spu_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) | 846 spu_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) |
847 { | 847 { |
848 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 848 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
849 CORE_ADDR scan_pc, func_start, func_end, epilogue_start, epilogue_end; | 849 CORE_ADDR scan_pc, func_start, func_end, epilogue_start, epilogue_end; |
850 bfd_byte buf[4]; | 850 bfd_byte buf[4]; |
851 unsigned int insn; | 851 unsigned int insn; |
852 int rt, ra, rb, rc, immed; | 852 int rt, ra, rb, immed; |
853 | 853 |
854 /* Find the search limits based on function boundaries and hard limit. | 854 /* Find the search limits based on function boundaries and hard limit. |
855 We assume the epilogue can be up to 64 instructions long. */ | 855 We assume the epilogue can be up to 64 instructions long. */ |
856 | 856 |
857 const int spu_max_epilogue_size = 64 * 4; | 857 const int spu_max_epilogue_size = 64 * 4; |
858 | 858 |
859 if (!find_pc_partial_function (pc, NULL, &func_start, &func_end)) | 859 if (!find_pc_partial_function (pc, NULL, &func_start, &func_end)) |
860 return 0; | 860 return 0; |
861 | 861 |
862 if (pc - func_start < spu_max_epilogue_size) | 862 if (pc - func_start < spu_max_epilogue_size) |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 { | 1443 { |
1444 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | 1444 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
1445 CORE_ADDR pc = get_frame_register_unsigned (this_frame, SPU_PC_REGNUM); | 1445 CORE_ADDR pc = get_frame_register_unsigned (this_frame, SPU_PC_REGNUM); |
1446 CORE_ADDR sp = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM); | 1446 CORE_ADDR sp = get_frame_register_unsigned (this_frame, SPU_SP_REGNUM); |
1447 return frame_id_build (SPUADDR (tdep->id, sp), SPUADDR (tdep->id, pc & -4)); | 1447 return frame_id_build (SPUADDR (tdep->id, sp), SPUADDR (tdep->id, pc & -4)); |
1448 } | 1448 } |
1449 | 1449 |
1450 /* Function return value access. */ | 1450 /* Function return value access. */ |
1451 | 1451 |
1452 static enum return_value_convention | 1452 static enum return_value_convention |
1453 spu_return_value (struct gdbarch *gdbarch, struct type *func_type, | 1453 spu_return_value (struct gdbarch *gdbarch, struct value *function, |
1454 struct type *type, struct regcache *regcache, | 1454 struct type *type, struct regcache *regcache, |
1455 gdb_byte *out, const gdb_byte *in) | 1455 gdb_byte *out, const gdb_byte *in) |
1456 { | 1456 { |
| 1457 struct type *func_type = function ? value_type (function) : NULL; |
1457 enum return_value_convention rvc; | 1458 enum return_value_convention rvc; |
1458 int opencl_vector = 0; | 1459 int opencl_vector = 0; |
1459 | 1460 |
1460 if (func_type) | 1461 if (func_type) |
1461 { | 1462 { |
1462 func_type = check_typedef (func_type); | 1463 func_type = check_typedef (func_type); |
1463 | 1464 |
1464 if (TYPE_CODE (func_type) == TYPE_CODE_PTR) | 1465 if (TYPE_CODE (func_type) == TYPE_CODE_PTR) |
1465 func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); | 1466 func_type = check_typedef (TYPE_TARGET_TYPE (func_type)); |
1466 | 1467 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 sal = find_function_start_sal (sym, 1); | 1936 sal = find_function_start_sal (sym, 1); |
1936 pc = sal.pc; | 1937 pc = sal.pc; |
1937 } | 1938 } |
1938 } | 1939 } |
1939 | 1940 |
1940 /* Use a numerical address for the set_breakpoint command to avoid having | 1941 /* Use a numerical address for the set_breakpoint command to avoid having |
1941 the breakpoint re-set incorrectly. */ | 1942 the breakpoint re-set incorrectly. */ |
1942 xsnprintf (buf, sizeof buf, "*%s", core_addr_to_string (pc)); | 1943 xsnprintf (buf, sizeof buf, "*%s", core_addr_to_string (pc)); |
1943 create_breakpoint (get_objfile_arch (objfile), buf /* arg */, | 1944 create_breakpoint (get_objfile_arch (objfile), buf /* arg */, |
1944 NULL /* cond_string */, -1 /* thread */, | 1945 NULL /* cond_string */, -1 /* thread */, |
| 1946 NULL /* extra_string */, |
1945 0 /* parse_condition_and_thread */, 1 /* tempflag */, | 1947 0 /* parse_condition_and_thread */, 1 /* tempflag */, |
1946 bp_breakpoint /* type_wanted */, | 1948 bp_breakpoint /* type_wanted */, |
1947 0 /* ignore_count */, | 1949 0 /* ignore_count */, |
1948 AUTO_BOOLEAN_FALSE /* pending_break_support */, | 1950 AUTO_BOOLEAN_FALSE /* pending_break_support */, |
1949 &bkpt_breakpoint_ops /* ops */, 0 /* from_tty */, | 1951 &bkpt_breakpoint_ops /* ops */, 0 /* from_tty */, |
1950 1 /* enabled */, 0 /* internal */, 0); | 1952 1 /* enabled */, 0 /* internal */, 0); |
1951 } | 1953 } |
1952 | 1954 |
1953 | 1955 |
1954 /* Look up OBJFILE loaded into FRAME's SPU context. */ | 1956 /* Look up OBJFILE loaded into FRAME's SPU context. */ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 static void | 2025 static void |
2024 info_spu_event_command (char *args, int from_tty) | 2026 info_spu_event_command (char *args, int from_tty) |
2025 { | 2027 { |
2026 struct frame_info *frame = get_selected_frame (NULL); | 2028 struct frame_info *frame = get_selected_frame (NULL); |
2027 ULONGEST event_status = 0; | 2029 ULONGEST event_status = 0; |
2028 ULONGEST event_mask = 0; | 2030 ULONGEST event_mask = 0; |
2029 struct cleanup *chain; | 2031 struct cleanup *chain; |
2030 gdb_byte buf[100]; | 2032 gdb_byte buf[100]; |
2031 char annex[32]; | 2033 char annex[32]; |
2032 LONGEST len; | 2034 LONGEST len; |
2033 int rc, id; | 2035 int id; |
2034 | 2036 |
2035 if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu) | 2037 if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu) |
2036 error (_("\"info spu\" is only supported on the SPU architecture.")); | 2038 error (_("\"info spu\" is only supported on the SPU architecture.")); |
2037 | 2039 |
2038 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); | 2040 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); |
2039 | 2041 |
2040 xsnprintf (annex, sizeof annex, "%d/event_status", id); | 2042 xsnprintf (annex, sizeof annex, "%d/event_status", id); |
2041 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, | 2043 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, |
2042 buf, 0, (sizeof (buf) - 1)); | 2044 buf, 0, (sizeof (buf) - 1)); |
2043 if (len <= 0) | 2045 if (len <= 0) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 ULONGEST signal1 = 0; | 2082 ULONGEST signal1 = 0; |
2081 ULONGEST signal1_type = 0; | 2083 ULONGEST signal1_type = 0; |
2082 int signal1_pending = 0; | 2084 int signal1_pending = 0; |
2083 ULONGEST signal2 = 0; | 2085 ULONGEST signal2 = 0; |
2084 ULONGEST signal2_type = 0; | 2086 ULONGEST signal2_type = 0; |
2085 int signal2_pending = 0; | 2087 int signal2_pending = 0; |
2086 struct cleanup *chain; | 2088 struct cleanup *chain; |
2087 char annex[32]; | 2089 char annex[32]; |
2088 gdb_byte buf[100]; | 2090 gdb_byte buf[100]; |
2089 LONGEST len; | 2091 LONGEST len; |
2090 int rc, id; | 2092 int id; |
2091 | 2093 |
2092 if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) | 2094 if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) |
2093 error (_("\"info spu\" is only supported on the SPU architecture.")); | 2095 error (_("\"info spu\" is only supported on the SPU architecture.")); |
2094 | 2096 |
2095 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); | 2097 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); |
2096 | 2098 |
2097 xsnprintf (annex, sizeof annex, "%d/signal1", id); | 2099 xsnprintf (annex, sizeof annex, "%d/signal1", id); |
2098 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, buf, 0, 4); | 2100 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, buf, 0, 4); |
2099 if (len < 0) | 2101 if (len < 0) |
2100 error (_("Could not read signal1.")); | 2102 error (_("Could not read signal1.")); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 static void | 2203 static void |
2202 info_spu_mailbox_command (char *args, int from_tty) | 2204 info_spu_mailbox_command (char *args, int from_tty) |
2203 { | 2205 { |
2204 struct frame_info *frame = get_selected_frame (NULL); | 2206 struct frame_info *frame = get_selected_frame (NULL); |
2205 struct gdbarch *gdbarch = get_frame_arch (frame); | 2207 struct gdbarch *gdbarch = get_frame_arch (frame); |
2206 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 2208 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
2207 struct cleanup *chain; | 2209 struct cleanup *chain; |
2208 char annex[32]; | 2210 char annex[32]; |
2209 gdb_byte buf[1024]; | 2211 gdb_byte buf[1024]; |
2210 LONGEST len; | 2212 LONGEST len; |
2211 int i, id; | 2213 int id; |
2212 | 2214 |
2213 if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) | 2215 if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) |
2214 error (_("\"info spu\" is only supported on the SPU architecture.")); | 2216 error (_("\"info spu\" is only supported on the SPU architecture.")); |
2215 | 2217 |
2216 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); | 2218 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); |
2217 | 2219 |
2218 chain = make_cleanup_ui_out_tuple_begin_end (current_uiout, "SPUInfoMailbox"); | 2220 chain = make_cleanup_ui_out_tuple_begin_end (current_uiout, "SPUInfoMailbox"); |
2219 | 2221 |
2220 xsnprintf (annex, sizeof annex, "%d/mbox_info", id); | 2222 xsnprintf (annex, sizeof annex, "%d/mbox_info", id); |
2221 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, | 2223 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 | 2351 |
2350 ui_out_table_body (current_uiout); | 2352 ui_out_table_body (current_uiout); |
2351 | 2353 |
2352 for (i = 0; i < nr; i++) | 2354 for (i = 0; i < nr; i++) |
2353 { | 2355 { |
2354 struct cleanup *cmd_chain; | 2356 struct cleanup *cmd_chain; |
2355 ULONGEST mfc_cq_dw0; | 2357 ULONGEST mfc_cq_dw0; |
2356 ULONGEST mfc_cq_dw1; | 2358 ULONGEST mfc_cq_dw1; |
2357 ULONGEST mfc_cq_dw2; | 2359 ULONGEST mfc_cq_dw2; |
2358 int mfc_cmd_opcode, mfc_cmd_tag, rclass_id, tclass_id; | 2360 int mfc_cmd_opcode, mfc_cmd_tag, rclass_id, tclass_id; |
2359 int lsa, size, list_lsa, list_size, mfc_lsa, mfc_size; | 2361 int list_lsa, list_size, mfc_lsa, mfc_size; |
2360 ULONGEST mfc_ea; | 2362 ULONGEST mfc_ea; |
2361 int list_valid_p, noop_valid_p, qw_valid_p, ea_valid_p, cmd_error_p; | 2363 int list_valid_p, noop_valid_p, qw_valid_p, ea_valid_p, cmd_error_p; |
2362 | 2364 |
2363 /* Decode contents of MFC Command Queue Context Save/Restore Registers. | 2365 /* Decode contents of MFC Command Queue Context Save/Restore Registers. |
2364 See "Cell Broadband Engine Registers V1.3", section 3.3.2.1. */ | 2366 See "Cell Broadband Engine Registers V1.3", section 3.3.2.1. */ |
2365 | 2367 |
2366 mfc_cq_dw0 | 2368 mfc_cq_dw0 |
2367 = extract_unsigned_integer (buf + 32*seq[i], 8, byte_order); | 2369 = extract_unsigned_integer (buf + 32*seq[i], 8, byte_order); |
2368 mfc_cq_dw1 | 2370 mfc_cq_dw1 |
2369 = extract_unsigned_integer (buf + 32*seq[i] + 8, 8, byte_order); | 2371 = extract_unsigned_integer (buf + 32*seq[i] + 8, 8, byte_order); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2443 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 2445 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
2444 ULONGEST dma_info_type; | 2446 ULONGEST dma_info_type; |
2445 ULONGEST dma_info_mask; | 2447 ULONGEST dma_info_mask; |
2446 ULONGEST dma_info_status; | 2448 ULONGEST dma_info_status; |
2447 ULONGEST dma_info_stall_and_notify; | 2449 ULONGEST dma_info_stall_and_notify; |
2448 ULONGEST dma_info_atomic_command_status; | 2450 ULONGEST dma_info_atomic_command_status; |
2449 struct cleanup *chain; | 2451 struct cleanup *chain; |
2450 char annex[32]; | 2452 char annex[32]; |
2451 gdb_byte buf[1024]; | 2453 gdb_byte buf[1024]; |
2452 LONGEST len; | 2454 LONGEST len; |
2453 int i, id; | 2455 int id; |
2454 | 2456 |
2455 if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu) | 2457 if (gdbarch_bfd_arch_info (get_frame_arch (frame))->arch != bfd_arch_spu) |
2456 error (_("\"info spu\" is only supported on the SPU architecture.")); | 2458 error (_("\"info spu\" is only supported on the SPU architecture.")); |
2457 | 2459 |
2458 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); | 2460 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); |
2459 | 2461 |
2460 xsnprintf (annex, sizeof annex, "%d/dma_info", id); | 2462 xsnprintf (annex, sizeof annex, "%d/dma_info", id); |
2461 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, | 2463 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, |
2462 buf, 0, 40 + 16 * 32); | 2464 buf, 0, 40 + 16 * 32); |
2463 if (len <= 0) | 2465 if (len <= 0) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2522 struct frame_info *frame = get_selected_frame (NULL); | 2524 struct frame_info *frame = get_selected_frame (NULL); |
2523 struct gdbarch *gdbarch = get_frame_arch (frame); | 2525 struct gdbarch *gdbarch = get_frame_arch (frame); |
2524 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 2526 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
2525 ULONGEST dma_info_type; | 2527 ULONGEST dma_info_type; |
2526 ULONGEST dma_info_mask; | 2528 ULONGEST dma_info_mask; |
2527 ULONGEST dma_info_status; | 2529 ULONGEST dma_info_status; |
2528 struct cleanup *chain; | 2530 struct cleanup *chain; |
2529 char annex[32]; | 2531 char annex[32]; |
2530 gdb_byte buf[1024]; | 2532 gdb_byte buf[1024]; |
2531 LONGEST len; | 2533 LONGEST len; |
2532 int i, id; | 2534 int id; |
2533 | 2535 |
2534 if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) | 2536 if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_spu) |
2535 error (_("\"info spu\" is only supported on the SPU architecture.")); | 2537 error (_("\"info spu\" is only supported on the SPU architecture.")); |
2536 | 2538 |
2537 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); | 2539 id = get_frame_register_unsigned (frame, SPU_ID_REGNUM); |
2538 | 2540 |
2539 xsnprintf (annex, sizeof annex, "%d/proxydma_info", id); | 2541 xsnprintf (annex, sizeof annex, "%d/proxydma_info", id); |
2540 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, | 2542 len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, |
2541 buf, 0, 24 + 8 * 32); | 2543 buf, 0, 24 + 8 * 32); |
2542 if (len <= 0) | 2544 if (len <= 0) |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2808 add_cmd ("mailbox", class_info, info_spu_mailbox_command, | 2810 add_cmd ("mailbox", class_info, info_spu_mailbox_command, |
2809 _("Display SPU mailbox facility status.\n"), | 2811 _("Display SPU mailbox facility status.\n"), |
2810 &infospucmdlist); | 2812 &infospucmdlist); |
2811 add_cmd ("dma", class_info, info_spu_dma_command, | 2813 add_cmd ("dma", class_info, info_spu_dma_command, |
2812 _("Display MFC DMA status.\n"), | 2814 _("Display MFC DMA status.\n"), |
2813 &infospucmdlist); | 2815 &infospucmdlist); |
2814 add_cmd ("proxydma", class_info, info_spu_proxydma_command, | 2816 add_cmd ("proxydma", class_info, info_spu_proxydma_command, |
2815 _("Display MFC Proxy-DMA status.\n"), | 2817 _("Display MFC Proxy-DMA status.\n"), |
2816 &infospucmdlist); | 2818 &infospucmdlist); |
2817 } | 2819 } |
OLD | NEW |