| OLD | NEW |
| 1 /* Low level interface for debugging AIX 4.3+ pthreads. | 1 /* Low level interface for debugging AIX 4.3+ pthreads. |
| 2 | 2 |
| 3 Copyright (C) 1999-2000, 2002, 2007-2012 Free Software Foundation, | 3 Copyright (C) 1999-2000, 2002, 2007-2012 Free Software Foundation, |
| 4 Inc. | 4 Inc. |
| 5 Written by Nick Duffek <nsd@redhat.com>. | 5 Written by Nick Duffek <nsd@redhat.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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 | 963 |
| 964 pd_disable (); | 964 pd_disable (); |
| 965 beneath->to_detach (beneath, args, from_tty); | 965 beneath->to_detach (beneath, args, from_tty); |
| 966 } | 966 } |
| 967 | 967 |
| 968 /* Tell the inferior process to continue running thread PID if != -1 | 968 /* Tell the inferior process to continue running thread PID if != -1 |
| 969 and all threads otherwise. */ | 969 and all threads otherwise. */ |
| 970 | 970 |
| 971 static void | 971 static void |
| 972 aix_thread_resume (struct target_ops *ops, | 972 aix_thread_resume (struct target_ops *ops, |
| 973 ptid_t ptid, int step, enum target_signal sig) | 973 ptid_t ptid, int step, enum gdb_signal sig) |
| 974 { | 974 { |
| 975 struct thread_info *thread; | 975 struct thread_info *thread; |
| 976 pthdb_tid_t tid[2]; | 976 pthdb_tid_t tid[2]; |
| 977 | 977 |
| 978 if (!PD_TID (ptid)) | 978 if (!PD_TID (ptid)) |
| 979 { | 979 { |
| 980 struct cleanup *cleanup = save_inferior_ptid (); | 980 struct cleanup *cleanup = save_inferior_ptid (); |
| 981 struct target_ops *beneath = find_target_beneath (ops); | 981 struct target_ops *beneath = find_target_beneath (ops); |
| 982 | 982 |
| 983 inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid)); | 983 inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid)); |
| 984 beneath->to_resume (beneath, ptid, step, sig); | 984 beneath->to_resume (beneath, ptid, step, sig); |
| 985 do_cleanups (cleanup); | 985 do_cleanups (cleanup); |
| 986 } | 986 } |
| 987 else | 987 else |
| 988 { | 988 { |
| 989 thread = find_thread_ptid (ptid); | 989 thread = find_thread_ptid (ptid); |
| 990 if (!thread) | 990 if (!thread) |
| 991 error (_("aix-thread resume: unknown pthread %ld"), | 991 error (_("aix-thread resume: unknown pthread %ld"), |
| 992 TIDGET (ptid)); | 992 TIDGET (ptid)); |
| 993 | 993 |
| 994 tid[0] = thread->private->tid; | 994 tid[0] = thread->private->tid; |
| 995 if (tid[0] == PTHDB_INVALID_TID) | 995 if (tid[0] == PTHDB_INVALID_TID) |
| 996 error (_("aix-thread resume: no tid for pthread %ld"), | 996 error (_("aix-thread resume: no tid for pthread %ld"), |
| 997 TIDGET (ptid)); | 997 TIDGET (ptid)); |
| 998 tid[1] = 0; | 998 tid[1] = 0; |
| 999 | 999 |
| 1000 if (arch64) | 1000 if (arch64) |
| 1001 ptrace64aix (PTT_CONTINUE, tid[0], 1, | 1001 ptrace64aix (PTT_CONTINUE, tid[0], 1, |
| 1002 » » target_signal_to_host (sig), (void *) tid); | 1002 » » gdb_signal_to_host (sig), (void *) tid); |
| 1003 else | 1003 else |
| 1004 ptrace32 (PTT_CONTINUE, tid[0], (int *) 1, | 1004 ptrace32 (PTT_CONTINUE, tid[0], (int *) 1, |
| 1005 » » target_signal_to_host (sig), (void *) tid); | 1005 » » gdb_signal_to_host (sig), (void *) tid); |
| 1006 } | 1006 } |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 /* Wait for thread/process ID if != -1 or for any thread otherwise. | 1009 /* Wait for thread/process ID if != -1 or for any thread otherwise. |
| 1010 If an error occurs, return -1, else return the pid of the stopped | 1010 If an error occurs, return -1, else return the pid of the stopped |
| 1011 thread. */ | 1011 thread. */ |
| 1012 | 1012 |
| 1013 static ptid_t | 1013 static ptid_t |
| 1014 aix_thread_wait (struct target_ops *ops, | 1014 aix_thread_wait (struct target_ops *ops, |
| 1015 ptid_t ptid, struct target_waitstatus *status, int options) | 1015 ptid_t ptid, struct target_waitstatus *status, int options) |
| 1016 { | 1016 { |
| 1017 struct cleanup *cleanup = save_inferior_ptid (); | 1017 struct cleanup *cleanup = save_inferior_ptid (); |
| 1018 struct target_ops *beneath = find_target_beneath (ops); | 1018 struct target_ops *beneath = find_target_beneath (ops); |
| 1019 | 1019 |
| 1020 pid_to_prc (&ptid); | 1020 pid_to_prc (&ptid); |
| 1021 | 1021 |
| 1022 inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid)); | 1022 inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid)); |
| 1023 ptid = beneath->to_wait (beneath, ptid, status, options); | 1023 ptid = beneath->to_wait (beneath, ptid, status, options); |
| 1024 do_cleanups (cleanup); | 1024 do_cleanups (cleanup); |
| 1025 | 1025 |
| 1026 if (PIDGET (ptid) == -1) | 1026 if (PIDGET (ptid) == -1) |
| 1027 return pid_to_ptid (-1); | 1027 return pid_to_ptid (-1); |
| 1028 | 1028 |
| 1029 /* Check whether libpthdebug might be ready to be initialized. */ | 1029 /* Check whether libpthdebug might be ready to be initialized. */ |
| 1030 if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED | 1030 if (!pd_active && status->kind == TARGET_WAITKIND_STOPPED |
| 1031 && status->value.sig == TARGET_SIGNAL_TRAP) | 1031 && status->value.sig == GDB_SIGNAL_TRAP) |
| 1032 { | 1032 { |
| 1033 struct regcache *regcache = get_thread_regcache (ptid); | 1033 struct regcache *regcache = get_thread_regcache (ptid); |
| 1034 struct gdbarch *gdbarch = get_regcache_arch (regcache); | 1034 struct gdbarch *gdbarch = get_regcache_arch (regcache); |
| 1035 | 1035 |
| 1036 if (regcache_read_pc (regcache) | 1036 if (regcache_read_pc (regcache) |
| 1037 - gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr) | 1037 - gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr) |
| 1038 return pd_activate (0); | 1038 return pd_activate (0); |
| 1039 } | 1039 } |
| 1040 | 1040 |
| 1041 return pd_update (0); | 1041 return pd_update (0); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1068 supply_fprs (struct regcache *regcache, double *vals) | 1068 supply_fprs (struct regcache *regcache, double *vals) |
| 1069 { | 1069 { |
| 1070 struct gdbarch *gdbarch = get_regcache_arch (regcache); | 1070 struct gdbarch *gdbarch = get_regcache_arch (regcache); |
| 1071 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | 1071 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
| 1072 int regno; | 1072 int regno; |
| 1073 | 1073 |
| 1074 /* This function should never be called on architectures without | 1074 /* This function should never be called on architectures without |
| 1075 floating-point registers. */ | 1075 floating-point registers. */ |
| 1076 gdb_assert (ppc_floating_point_unit_p (gdbarch)); | 1076 gdb_assert (ppc_floating_point_unit_p (gdbarch)); |
| 1077 | 1077 |
| 1078 for (regno = 0; regno < ppc_num_fprs; regno++) | 1078 for (regno = tdep->ppc_fp0_regnum; |
| 1079 regcache_raw_supply (regcache, regno + tdep->ppc_fp0_regnum, | 1079 regno < tdep->ppc_fp0_regnum + ppc_num_fprs; |
| 1080 » » » (char *) (vals + regno)); | 1080 regno++) |
| 1081 regcache_raw_supply (regcache, regno, |
| 1082 » » » (char *) (vals + regno - tdep->ppc_fp0_regnum)); |
| 1081 } | 1083 } |
| 1082 | 1084 |
| 1083 /* Predicate to test whether given register number is a "special" register. */ | 1085 /* Predicate to test whether given register number is a "special" register. */ |
| 1084 static int | 1086 static int |
| 1085 special_register_p (struct gdbarch *gdbarch, int regno) | 1087 special_register_p (struct gdbarch *gdbarch, int regno) |
| 1086 { | 1088 { |
| 1087 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | 1089 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
| 1088 | 1090 |
| 1089 return regno == gdbarch_pc_regnum (gdbarch) | 1091 return regno == gdbarch_pc_regnum (gdbarch) |
| 1090 || regno == tdep->ppc_ps_regnum | 1092 || regno == tdep->ppc_ps_regnum |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 int regno; | 1351 int regno; |
| 1350 | 1352 |
| 1351 /* This function should never be called on architectures without | 1353 /* This function should never be called on architectures without |
| 1352 floating-point registers. */ | 1354 floating-point registers. */ |
| 1353 gdb_assert (ppc_floating_point_unit_p (gdbarch)); | 1355 gdb_assert (ppc_floating_point_unit_p (gdbarch)); |
| 1354 | 1356 |
| 1355 for (regno = tdep->ppc_fp0_regnum; | 1357 for (regno = tdep->ppc_fp0_regnum; |
| 1356 regno < tdep->ppc_fp0_regnum + ppc_num_fprs; | 1358 regno < tdep->ppc_fp0_regnum + ppc_num_fprs; |
| 1357 regno++) | 1359 regno++) |
| 1358 if (REG_VALID == regcache_register_status (regcache, regno)) | 1360 if (REG_VALID == regcache_register_status (regcache, regno)) |
| 1359 regcache_raw_collect (regcache, regno, vals + regno); | 1361 regcache_raw_collect (regcache, regno, |
| 1362 » » » vals + regno - tdep->ppc_fp0_regnum); |
| 1360 } | 1363 } |
| 1361 | 1364 |
| 1362 /* Store the special registers into the specified 64-bit and 32-bit | 1365 /* Store the special registers into the specified 64-bit and 32-bit |
| 1363 locations. */ | 1366 locations. */ |
| 1364 | 1367 |
| 1365 static void | 1368 static void |
| 1366 fill_sprs64 (const struct regcache *regcache, | 1369 fill_sprs64 (const struct regcache *regcache, |
| 1367 uint64_t *iar, uint64_t *msr, uint32_t *cr, | 1370 uint64_t *iar, uint64_t *msr, uint32_t *cr, |
| 1368 uint64_t *lr, uint64_t *ctr, uint32_t *xer, | 1371 uint64_t *lr, uint64_t *ctr, uint32_t *xer, |
| 1369 uint32_t *fpscr) | 1372 uint32_t *fpscr) |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 aix_thread_ops.to_pid_to_str = aix_thread_pid_to_str; | 1825 aix_thread_ops.to_pid_to_str = aix_thread_pid_to_str; |
| 1823 aix_thread_ops.to_extra_thread_info = aix_thread_extra_thread_info; | 1826 aix_thread_ops.to_extra_thread_info = aix_thread_extra_thread_info; |
| 1824 aix_thread_ops.to_get_ada_task_ptid = aix_thread_get_ada_task_ptid; | 1827 aix_thread_ops.to_get_ada_task_ptid = aix_thread_get_ada_task_ptid; |
| 1825 aix_thread_ops.to_stratum = thread_stratum; | 1828 aix_thread_ops.to_stratum = thread_stratum; |
| 1826 aix_thread_ops.to_magic = OPS_MAGIC; | 1829 aix_thread_ops.to_magic = OPS_MAGIC; |
| 1827 } | 1830 } |
| 1828 | 1831 |
| 1829 /* Module startup initialization function, automagically called by | 1832 /* Module startup initialization function, automagically called by |
| 1830 init.c. */ | 1833 init.c. */ |
| 1831 | 1834 |
| 1835 void _initialize_aix_thread (void); |
| 1836 |
| 1832 void | 1837 void |
| 1833 _initialize_aix_thread (void) | 1838 _initialize_aix_thread (void) |
| 1834 { | 1839 { |
| 1835 init_aix_thread_ops (); | 1840 init_aix_thread_ops (); |
| 1836 add_target (&aix_thread_ops); | 1841 add_target (&aix_thread_ops); |
| 1837 | 1842 |
| 1838 /* Notice when object files get loaded and unloaded. */ | 1843 /* Notice when object files get loaded and unloaded. */ |
| 1839 observer_attach_new_objfile (new_objfile); | 1844 observer_attach_new_objfile (new_objfile); |
| 1840 | 1845 |
| 1841 add_setshow_boolean_cmd ("aix-thread", class_maintenance, &debug_aix_thread, | 1846 add_setshow_boolean_cmd ("aix-thread", class_maintenance, &debug_aix_thread, |
| 1842 _("Set debugging of AIX thread module."), | 1847 _("Set debugging of AIX thread module."), |
| 1843 _("Show debugging of AIX thread module."), | 1848 _("Show debugging of AIX thread module."), |
| 1844 _("Enables debugging output (used to debug GDB)."), | 1849 _("Enables debugging output (used to debug GDB)."), |
| 1845 NULL, NULL, | 1850 NULL, NULL, |
| 1846 /* FIXME: i18n: Debugging of AIX thread | 1851 /* FIXME: i18n: Debugging of AIX thread |
| 1847 module is \"%d\". */ | 1852 module is \"%d\". */ |
| 1848 &setdebuglist, &showdebuglist); | 1853 &setdebuglist, &showdebuglist); |
| 1849 } | 1854 } |
| OLD | NEW |