Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: gdb/hppa-hpux-tdep.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/h8300-tdep.c ('k') | gdb/hppa-tdep.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Target-dependent code for HP-UX on PA-RISC. 1 /* Target-dependent code for HP-UX on PA-RISC.
2 2
3 Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc. 3 Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 stub and return. 170 stub and return.
171 171
172 Then see if the PC value falls within the section bounds for the 172 Then see if the PC value falls within the section bounds for the
173 section containing the minimal symbol we found in the first 173 section containing the minimal symbol we found in the first
174 step. If it does, then assume we are not in a stub and return. 174 step. If it does, then assume we are not in a stub and return.
175 175
176 Finally peek at the instructions to see if they look like a stub. */ 176 Finally peek at the instructions to see if they look like a stub. */
177 struct minimal_symbol *minsym; 177 struct minimal_symbol *minsym;
178 asection *sec; 178 asection *sec;
179 CORE_ADDR addr; 179 CORE_ADDR addr;
180 int insn, i; 180 int insn;
181 181
182 minsym = lookup_minimal_symbol_by_pc (pc); 182 minsym = lookup_minimal_symbol_by_pc (pc);
183 if (! minsym) 183 if (! minsym)
184 return 0; 184 return 0;
185 185
186 sec = SYMBOL_OBJ_SECTION (minsym)->the_bfd_section; 186 sec = SYMBOL_OBJ_SECTION (minsym)->the_bfd_section;
187 187
188 if (bfd_get_section_vma (sec->owner, sec) <= pc 188 if (bfd_get_section_vma (sec->owner, sec) <= pc
189 && pc < (bfd_get_section_vma (sec->owner, sec) 189 && pc < (bfd_get_section_vma (sec->owner, sec)
190 + bfd_section_size (sec->owner, sec))) 190 + bfd_section_size (sec->owner, sec)))
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 return 1; 223 return 1;
224 } 224 }
225 225
226 /* Return one if PC is in the return path of a trampoline, else return zero. 226 /* Return one if PC is in the return path of a trampoline, else return zero.
227 227
228 Note we return one for *any* call trampoline (long-call, arg-reloc), not 228 Note we return one for *any* call trampoline (long-call, arg-reloc), not
229 just shared library trampolines (import, export). */ 229 just shared library trampolines (import, export). */
230 230
231 static int 231 static int
232 hppa_hpux_in_solib_return_trampoline (struct gdbarch *gdbarch, 232 hppa_hpux_in_solib_return_trampoline (struct gdbarch *gdbarch,
233 » » » » CORE_ADDR pc, char *name) 233 » » » » CORE_ADDR pc, const char *name)
234 { 234 {
235 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); 235 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
236 struct unwind_table_entry *u; 236 struct unwind_table_entry *u;
237 237
238 /* Get the unwind descriptor corresponding to PC, return zero 238 /* Get the unwind descriptor corresponding to PC, return zero
239 if no unwind was found. */ 239 if no unwind was found. */
240 u = find_unwind_entry (pc); 240 u = find_unwind_entry (pc);
241 if (!u) 241 if (!u)
242 return 0; 242 return 0;
243 243
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 static CORE_ADDR 949 static CORE_ADDR
950 hppa64_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc, 950 hppa64_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc,
951 int *argreg) 951 int *argreg)
952 { 952 {
953 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); 953 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
954 struct objfile *obj; 954 struct objfile *obj;
955 struct obj_section *sec; 955 struct obj_section *sec;
956 struct hppa_objfile_private *priv; 956 struct hppa_objfile_private *priv;
957 CORE_ADDR addr; 957 CORE_ADDR addr;
958 struct minimal_symbol *msym; 958 struct minimal_symbol *msym;
959 int i;
960 959
961 sec = find_pc_section (pc); 960 sec = find_pc_section (pc);
962 obj = sec->objfile; 961 obj = sec->objfile;
963 priv = objfile_data (obj, hppa_objfile_priv_data); 962 priv = objfile_data (obj, hppa_objfile_priv_data);
964 963
965 if (!priv) 964 if (!priv)
966 priv = hppa_init_objfile_priv_data (obj); 965 priv = hppa_init_objfile_priv_data (obj);
967 if (!priv) 966 if (!priv)
968 error (_("Internal error creating objfile private data.")); 967 error (_("Internal error creating objfile private data."));
969 968
970 /* Use the cached value if we have one. */ 969 /* Use the cached value if we have one. */
971 if (priv->dummy_call_sequence_addr != 0) 970 if (priv->dummy_call_sequence_addr != 0)
972 { 971 {
973 *argreg = priv->dummy_call_sequence_reg; 972 *argreg = priv->dummy_call_sequence_reg;
974 return priv->dummy_call_sequence_addr; 973 return priv->dummy_call_sequence_addr;
975 } 974 }
976 975
977 /* FIXME: Without stub unwind information, locating a suitable sequence is 976 /* FIXME: Without stub unwind information, locating a suitable sequence is
978 fairly difficult. For now, we implement a very naive and inefficient 977 fairly difficult. For now, we implement a very naive and inefficient
979 scheme; try to read in blocks of code, and look for a "bve,n (rp)" 978 scheme; try to read in blocks of code, and look for a "bve,n (rp)"
980 instruction. These are likely to occur at the end of functions, so 979 instruction. These are likely to occur at the end of functions, so
981 we only look at the last two instructions of each function. */ 980 we only look at the last two instructions of each function. */
982 for (i = 0, msym = obj->msymbols; i < obj->minimal_symbol_count; i++, msym++) 981 ALL_OBJFILE_MSYMBOLS (obj, msym)
983 { 982 {
984 CORE_ADDR begin, end; 983 CORE_ADDR begin, end;
985 char *name; 984 const char *name;
986 gdb_byte buf[2 * HPPA_INSN_SIZE]; 985 gdb_byte buf[2 * HPPA_INSN_SIZE];
987 int offset; 986 int offset;
988 987
989 find_pc_partial_function (SYMBOL_VALUE_ADDRESS (msym), &name, 988 find_pc_partial_function (SYMBOL_VALUE_ADDRESS (msym), &name,
990 &begin, &end); 989 &begin, &end);
991 990
992 if (name == NULL || begin == 0 || end == 0) 991 if (name == NULL || begin == 0 || end == 0)
993 continue; 992 continue;
994 993
995 if (target_read_memory (end - sizeof (buf), buf, sizeof (buf)) == 0) 994 if (target_read_memory (end - sizeof (buf), buf, sizeof (buf)) == 0)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 prematurely. Instead, we try to look for an address in the same space to 1079 prematurely. Instead, we try to look for an address in the same space to
1081 put the breakpoint. 1080 put the breakpoint.
1082 1081
1083 This is similar in spirit to putting the breakpoint at the "entry point" 1082 This is similar in spirit to putting the breakpoint at the "entry point"
1084 of an executable. */ 1083 of an executable. */
1085 1084
1086 struct obj_section *sec; 1085 struct obj_section *sec;
1087 struct unwind_table_entry *u; 1086 struct unwind_table_entry *u;
1088 struct minimal_symbol *msym; 1087 struct minimal_symbol *msym;
1089 CORE_ADDR func; 1088 CORE_ADDR func;
1090 int i;
1091 1089
1092 sec = find_pc_section (addr); 1090 sec = find_pc_section (addr);
1093 if (sec) 1091 if (sec)
1094 { 1092 {
1095 /* First try the lowest address in the section; we can use it as long 1093 /* First try the lowest address in the section; we can use it as long
1096 as it is "regular" code (i.e. not a stub). */ 1094 as it is "regular" code (i.e. not a stub). */
1097 u = find_unwind_entry (obj_section_addr (sec)); 1095 u = find_unwind_entry (obj_section_addr (sec));
1098 if (!u || u->stub_unwind.stub_type == 0) 1096 if (!u || u->stub_unwind.stub_type == 0)
1099 return obj_section_addr (sec); 1097 return obj_section_addr (sec);
1100 1098
1101 /* Otherwise, we need to find a symbol for a regular function. We 1099 /* Otherwise, we need to find a symbol for a regular function. We
1102 do this by walking the list of msymbols in the objfile. The symbol 1100 do this by walking the list of msymbols in the objfile. The symbol
1103 we find should not be the same as the function that was passed in. */ 1101 we find should not be the same as the function that was passed in. */
1104 1102
1105 /* FIXME: this is broken, because we can find a function that will be 1103 /* FIXME: this is broken, because we can find a function that will be
1106 called by the dummy call target function, which will still not 1104 called by the dummy call target function, which will still not
1107 work. */ 1105 work. */
1108 1106
1109 find_pc_partial_function (addr, NULL, &func, NULL); 1107 find_pc_partial_function (addr, NULL, &func, NULL);
1110 for (i = 0, msym = sec->objfile->msymbols; 1108 ALL_OBJFILE_MSYMBOLS (sec->objfile, msym)
1111 » i < sec->objfile->minimal_symbol_count;
1112 » i++, msym++)
1113 { 1109 {
1114 u = find_unwind_entry (SYMBOL_VALUE_ADDRESS (msym)); 1110 u = find_unwind_entry (SYMBOL_VALUE_ADDRESS (msym));
1115 if (func != SYMBOL_VALUE_ADDRESS (msym) 1111 if (func != SYMBOL_VALUE_ADDRESS (msym)
1116 && (!u || u->stub_unwind.stub_type == 0)) 1112 && (!u || u->stub_unwind.stub_type == 0))
1117 return SYMBOL_VALUE_ADDRESS (msym); 1113 return SYMBOL_VALUE_ADDRESS (msym);
1118 } 1114 }
1119 } 1115 }
1120 1116
1121 warning (_("Cannot find suitable address to place dummy breakpoint; nested " 1117 warning (_("Cannot find suitable address to place dummy breakpoint; nested "
1122 "calls may fail.")); 1118 "calls may fail."));
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 hppa_hpux_core_osabi_sniffer); 1577 hppa_hpux_core_osabi_sniffer);
1582 gdbarch_register_osabi_sniffer (bfd_arch_hppa, 1578 gdbarch_register_osabi_sniffer (bfd_arch_hppa,
1583 bfd_target_elf_flavour, 1579 bfd_target_elf_flavour,
1584 hppa_hpux_core_osabi_sniffer); 1580 hppa_hpux_core_osabi_sniffer);
1585 1581
1586 gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_HPUX_SOM, 1582 gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_HPUX_SOM,
1587 hppa_hpux_som_init_abi); 1583 hppa_hpux_som_init_abi);
1588 gdbarch_register_osabi (bfd_arch_hppa, bfd_mach_hppa20w, GDB_OSABI_HPUX_ELF, 1584 gdbarch_register_osabi (bfd_arch_hppa, bfd_mach_hppa20w, GDB_OSABI_HPUX_ELF,
1589 hppa_hpux_elf_init_abi); 1585 hppa_hpux_elf_init_abi);
1590 } 1586 }
OLDNEW
« no previous file with comments | « gdb/h8300-tdep.c ('k') | gdb/hppa-tdep.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698