GDB (xrefs)

/tmp/gdb-8.1/gdb/fbsd-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for FreeBSD, architecture-independent.
2
3 Copyright (C) 2002-2018 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
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
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 #include "defs.h"
21 #include "auxv.h"
22 #include "gdbcore.h"
23 #include "inferior.h"
24 #include "regcache.h"
25 #include "regset.h"
26 #include "gdbthread.h"
27 #include "xml-syscall.h"
28
29 #include "elf-bfd.h"
30 #include "fbsd-tdep.h"
31
32
33 /* FreeBSD kernels 12.0 and later include a copy of the
34 'ptrace_lwpinfo' structure returned by the PT_LWPINFO ptrace
35 operation in an ELF core note (NT_FREEBSD_PTLWPINFO) for each LWP.
36 The constants below define the offset of field members and flags in
37 this structure used by methods in this file. Note that the
38 'ptrace_lwpinfo' struct in the note is preceded by a 4 byte integer
39 containing the size of the structure. */
40
41 #define LWPINFO_OFFSET 0x4
42
43 /* Offsets in ptrace_lwpinfo. */
44 #define LWPINFO_PL_FLAGS 0x8
45 #define LWPINFO64_PL_SIGINFO 0x30
46 #define LWPINFO32_PL_SIGINFO 0x2c
47
48 /* Flags in pl_flags. */
49 #define PL_FLAG_SI 0x20 /* siginfo is valid */
50
51 /* Sizes of siginfo_t. */
52 #define SIZE64_SIGINFO_T 80
53 #define SIZE32_SIGINFO_T 64
54
55 static struct gdbarch_data *fbsd_gdbarch_data_handle;
56
57 struct fbsd_gdbarch_data
58 {
59 struct type *siginfo_type;
60 };
61
62 static void *
63 init_fbsd_gdbarch_data (struct gdbarch *gdbarch)
64 {
65 return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct fbsd_gdbarch_data);
66 }
67
68 static struct fbsd_gdbarch_data *
69 get_fbsd_gdbarch_data (struct gdbarch *gdbarch)
70 {
71 return ((struct fbsd_gdbarch_data *)
72 gdbarch_data (gdbarch, fbsd_gdbarch_data_handle));
73 }
74
75 /* This is how we want PTIDs from core files to be printed. */
76
77 static const char *
78 fbsd_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
79 {
80 static char buf[80];
81
82 if (ptid_get_lwp (ptid) != 0)
83 {
84 xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid));
85 return buf;
86 }
87
88 return normal_pid_to_str (ptid);
89 }
90
91 /* Extract the name assigned to a thread from a core. Returns the
92 string in a static buffer. */
93
94 static const char *
95 fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
96 {
97 static char buf[80];
98 struct bfd_section *section;
99 bfd_size_type size;
100
101 if (ptid_get_lwp (thr->ptid) != 0)
102 {
103 /* FreeBSD includes a NT_FREEBSD_THRMISC note for each thread
104 whose contents are defined by a "struct thrmisc" declared in
105 <sys/procfs.h> on FreeBSD. The per-thread name is stored as
106 a null-terminated string as the first member of the
107 structure. Rather than define the full structure here, just
108 extract the null-terminated name from the start of the
109 note. */
110 thread_section_name section_name (".thrmisc", thr->ptid);
111
112 section = bfd_get_section_by_name (core_bfd, section_name.c_str ());
113 if (section != NULL && bfd_section_size (core_bfd, section) > 0)
114 {
115 /* Truncate the name if it is longer than "buf". */
116 size = bfd_section_size (core_bfd, section);
117 if (size > sizeof buf - 1)
118 size = sizeof buf - 1;
119 if (bfd_get_section_contents (core_bfd, section, buf, (file_ptr) 0,
120 size)
121 && buf[0] != '\0')
122 {
123 buf[size] = '\0';
124
125 /* Note that each thread will report the process command
126 as its thread name instead of an empty name if a name
127 has not been set explicitly. Return a NULL name in
128 that case. */
129 if (strcmp (buf, elf_tdata (core_bfd)->core->program) != 0)
130 return buf;
131 }
132 }
133 }
134
135 return NULL;
136 }
137
138 /* Implement the "core_xfer_siginfo" gdbarch method. */
139
140 static LONGEST
141 fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
142 ULONGEST offset, ULONGEST len)
143 {
144 size_t siginfo_size;
145
146 if (gdbarch_long_bit (gdbarch) == 32)
147 siginfo_size = SIZE32_SIGINFO_T;
148 else
149 siginfo_size = SIZE64_SIGINFO_T;
150 if (offset > siginfo_size)
151 return -1;
152
153 thread_section_name section_name (".note.freebsdcore.lwpinfo", inferior_ptid);
154 asection *section = bfd_get_section_by_name (core_bfd, section_name.c_str ());
155 if (section == NULL)
156 return -1;
157
158 gdb_byte buf[4];
159 if (!bfd_get_section_contents (core_bfd, section, buf,
160 LWPINFO_OFFSET + LWPINFO_PL_FLAGS, 4))
161 return -1;
162
163 int pl_flags = extract_signed_integer (buf, 4, gdbarch_byte_order (gdbarch));
164 if (!(pl_flags & PL_FLAG_SI))
165 return -1;
166
167 if (offset + len > siginfo_size)
168 len = siginfo_size - offset;
169
170 ULONGEST siginfo_offset;
171 if (gdbarch_long_bit (gdbarch) == 32)
172 siginfo_offset = LWPINFO_OFFSET + LWPINFO32_PL_SIGINFO;
173 else
174 siginfo_offset = LWPINFO_OFFSET + LWPINFO64_PL_SIGINFO;
175
176 if (!bfd_get_section_contents (core_bfd, section, readbuf,
177 siginfo_offset + offset, len))
178 return -1;
179
180 return len;
181 }
182
183 static int
184 find_signalled_thread (struct thread_info *info, void *data)
185 {
186 if (info->suspend.stop_signal != GDB_SIGNAL_0
187 && ptid_get_pid (info->ptid) == ptid_get_pid (inferior_ptid))
188 return 1;
189
190 return 0;
191 }
192
193 /* Structure for passing information from
194 fbsd_collect_thread_registers via an iterator to
195 fbsd_collect_regset_section_cb. */
196
197 struct fbsd_collect_regset_section_cb_data
198 {
199 const struct regcache *regcache;
200 bfd *obfd;
201 char *note_data;
202 int *note_size;
203 unsigned long lwp;
204 enum gdb_signal stop_signal;
205 int abort_iteration;
206 };
207
208 static void
209 fbsd_collect_regset_section_cb (const char *sect_name, int size,
210 const struct regset *regset,
211 const char *human_name, void *cb_data)
212 {
213 char *buf;
214 struct fbsd_collect_regset_section_cb_data *data
215 = (struct fbsd_collect_regset_section_cb_data *) cb_data;
216
217 if (data->abort_iteration)
218 return;
219
220 gdb_assert (regset->collect_regset);
221
222 buf = (char *) xmalloc (size);
223 regset->collect_regset (regset, data->regcache, -1, buf, size);
224
225 /* PRSTATUS still needs to be treated specially. */
226 if (strcmp (sect_name, ".reg") == 0)
227 data->note_data = (char *) elfcore_write_prstatus
228 (data->obfd, data->note_data, data->note_size, data->lwp,
229 gdb_signal_to_host (data->stop_signal), buf);
230 else
231 data->note_data = (char *) elfcore_write_register_note
232 (data->obfd, data->note_data, data->note_size,
233 sect_name, buf, size);
234 xfree (buf);
235
236 if (data->note_data == NULL)
237 data->abort_iteration = 1;
238 }
239
240 /* Records the thread's register state for the corefile note
241 section. */
242
243 static char *
244 fbsd_collect_thread_registers (const struct regcache *regcache,
245 ptid_t ptid, bfd *obfd,
246 char *note_data, int *note_size,
247 enum gdb_signal stop_signal)
248 {
249 struct gdbarch *gdbarch = regcache->arch ();
250 struct fbsd_collect_regset_section_cb_data data;
251
252 data.regcache = regcache;
253 data.obfd = obfd;
254 data.note_data = note_data;
255 data.note_size = note_size;
256 data.stop_signal = stop_signal;
257 data.abort_iteration = 0;
258 data.lwp = ptid_get_lwp (ptid);
259
260 gdbarch_iterate_over_regset_sections (gdbarch,
261 fbsd_collect_regset_section_cb,
262 &data, regcache);
263 return data.note_data;
264 }
265
266 struct fbsd_corefile_thread_data
267 {
268 struct gdbarch *gdbarch;
269 bfd *obfd;
270 char *note_data;
271 int *note_size;
272 enum gdb_signal stop_signal;
273 };
274
275 /* Records the thread's register state for the corefile note
276 section. */
277
278 static void
279 fbsd_corefile_thread (struct thread_info *info,
280 struct fbsd_corefile_thread_data *args)
281 {
282 struct regcache *regcache;
283
284 regcache = get_thread_arch_regcache (info->ptid, args->gdbarch);
285
286 target_fetch_registers (regcache, -1);
287
288 args->note_data = fbsd_collect_thread_registers
289 (regcache, info->ptid, args->obfd, args->note_data,
290 args->note_size, args->stop_signal);
291 }
292
293 /* Create appropriate note sections for a corefile, returning them in
294 allocated memory. */
295
296 static char *
297 fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
298 {
299 struct fbsd_corefile_thread_data thread_args;
300 char *note_data = NULL;
301 Elf_Internal_Ehdr *i_ehdrp;
302 struct thread_info *curr_thr, *signalled_thr, *thr;
303
304 /* Put a "FreeBSD" label in the ELF header. */
305 i_ehdrp = elf_elfheader (obfd);
306 i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
307
308 gdb_assert (gdbarch_iterate_over_regset_sections_p (gdbarch));
309
310 if (get_exec_file (0))
311 {
312 const char *fname = lbasename (get_exec_file (0));
313 char *psargs = xstrdup (fname);
314
315 if (get_inferior_args ())
316 psargs = reconcat (psargs, psargs, " ", get_inferior_args (),
317 (char *) NULL);
318
319 note_data = elfcore_write_prpsinfo (obfd, note_data, note_size,
320 fname, psargs);
321 }
322
323 /* Thread register information. */
324 TRY
325 {
326 update_thread_list ();
327 }
328 CATCH (e, RETURN_MASK_ERROR)
329 {
330 exception_print (gdb_stderr, e);
331 }
332 END_CATCH
333
334 /* Like the kernel, prefer dumping the signalled thread first.
335 "First thread" is what tools use to infer the signalled thread.
336 In case there's more than one signalled thread, prefer the
337 current thread, if it is signalled. */
338 curr_thr = inferior_thread ();
339 if (curr_thr->suspend.stop_signal != GDB_SIGNAL_0)
340 signalled_thr = curr_thr;
341 else
342 {
343 signalled_thr = iterate_over_threads (find_signalled_thread, NULL);
344 if (signalled_thr == NULL)
345 signalled_thr = curr_thr;
346 }
347
348 thread_args.gdbarch = gdbarch;
349 thread_args.obfd = obfd;
350 thread_args.note_data = note_data;
351 thread_args.note_size = note_size;
352 thread_args.stop_signal = signalled_thr->suspend.stop_signal;
353
354 fbsd_corefile_thread (signalled_thr, &thread_args);
355 ALL_NON_EXITED_THREADS (thr)
356 {
357 if (thr == signalled_thr)
358 continue;
359 if (ptid_get_pid (thr->ptid) != ptid_get_pid (inferior_ptid))
360 continue;
361
362 fbsd_corefile_thread (thr, &thread_args);
363 }
364
365 note_data = thread_args.note_data;
366
367 return note_data;
368 }
369
370 /* Print descriptions of FreeBSD-specific AUXV entries to FILE. */
371
372 static void
373 fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
374 CORE_ADDR type, CORE_ADDR val)
375 {
376 const char *name;
377 const char *description;
378 enum auxv_format format;
379
380 switch (type)
381 {
382 #define _TAGNAME(tag) #tag
383 #define TAGNAME(tag) _TAGNAME(AT_##tag)
384 #define TAG(tag, text, kind) \
385 case AT_FREEBSD_##tag: name = TAGNAME(tag); description = text; format = kind; break
386 TAG (EXECPATH, _("Executable path"), AUXV_FORMAT_STR);
387 TAG (CANARY, _("Canary for SSP"), AUXV_FORMAT_HEX);
388 TAG (CANARYLEN, ("Length of the SSP canary"), AUXV_FORMAT_DEC);
389 TAG (OSRELDATE, _("OSRELDATE"), AUXV_FORMAT_DEC);
390 TAG (NCPUS, _("Number of CPUs"), AUXV_FORMAT_DEC);
391 TAG (PAGESIZES, _("Pagesizes"), AUXV_FORMAT_HEX);
392 TAG (PAGESIZESLEN, _("Number of pagesizes"), AUXV_FORMAT_DEC);
393 TAG (TIMEKEEP, _("Pointer to timehands"), AUXV_FORMAT_HEX);
394 TAG (STACKPROT, _("Initial stack protection"), AUXV_FORMAT_HEX);
395 TAG (EHDRFLAGS, _("ELF header e_flags"), AUXV_FORMAT_HEX);
396 TAG (HWCAP, _("Machine-dependent CPU capability hints"), AUXV_FORMAT_HEX);
397 default:
398 default_print_auxv_entry (gdbarch, file, type, val);
399 return;
400 }
401
402 fprint_auxv_entry (file, name, description, format, type, val);
403 }
404
405 /* Implement the "get_siginfo_type" gdbarch method. */
406
407 static struct type *
408 fbsd_get_siginfo_type (struct gdbarch *gdbarch)
409 {
410 struct fbsd_gdbarch_data *fbsd_gdbarch_data;
411 struct type *int_type, *int32_type, *uint32_type, *long_type, *void_ptr_type;
412 struct type *uid_type, *pid_type;
413 struct type *sigval_type, *reason_type;
414 struct type *siginfo_type;
415 struct type *type;
416
417 fbsd_gdbarch_data = get_fbsd_gdbarch_data (gdbarch);
418 if (fbsd_gdbarch_data->siginfo_type != NULL)
419 return fbsd_gdbarch_data->siginfo_type;
420
421 int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
422 0, "int");
423 int32_type = arch_integer_type (gdbarch, 32, 0, "int32_t");
424 uint32_type = arch_integer_type (gdbarch, 32, 1, "uint32_t");
425 long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
426 0, "long");
427 void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
428
429 /* union sigval */
430 sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
431 TYPE_NAME (sigval_type) = xstrdup ("sigval");
432 append_composite_type_field (sigval_type, "sival_int", int_type);
433 append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type);
434
435 /* __pid_t */
436 pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
437 TYPE_LENGTH (int32_type) * TARGET_CHAR_BIT, "__pid_t");
438 TYPE_TARGET_TYPE (pid_type) = int32_type;
439 TYPE_TARGET_STUB (pid_type) = 1;
440
441 /* __uid_t */
442 uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
443 TYPE_LENGTH (uint32_type) * TARGET_CHAR_BIT,
444 "__uid_t");
445 TYPE_TARGET_TYPE (uid_type) = uint32_type;
446 TYPE_TARGET_STUB (uid_type) = 1;
447
448 /* _reason */
449 reason_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
450
451 /* _fault */
452 type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
453 append_composite_type_field (type, "si_trapno", int_type);
454 append_composite_type_field (reason_type, "_fault", type);
455
456 /* _timer */
457 type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
458 append_composite_type_field (type, "si_timerid", int_type);
459 append_composite_type_field (type, "si_overrun", int_type);
460 append_composite_type_field (reason_type, "_timer", type);
461
462 /* _mesgq */
463 type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
464 append_composite_type_field (type, "si_mqd", int_type);
465 append_composite_type_field (reason_type, "_mesgq", type);
466
467 /* _poll */
468 type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
469 append_composite_type_field (type, "si_band", long_type);
470 append_composite_type_field (reason_type, "_poll", type);
471
472 /* __spare__ */
473 type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
474 append_composite_type_field (type, "__spare1__", long_type);
475 append_composite_type_field (type, "__spare2__",
476 init_vector_type (int_type, 7));
477 append_composite_type_field (reason_type, "__spare__", type);
478
479 /* struct siginfo */
480 siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
481 TYPE_NAME (siginfo_type) = xstrdup ("siginfo");
482 append_composite_type_field (siginfo_type, "si_signo", int_type);
483 append_composite_type_field (siginfo_type, "si_errno", int_type);
484 append_composite_type_field (siginfo_type, "si_code", int_type);
485 append_composite_type_field (siginfo_type, "si_pid", pid_type);
486 append_composite_type_field (siginfo_type, "si_uid", uid_type);
487 append_composite_type_field (siginfo_type, "si_status", int_type);
488 append_composite_type_field (siginfo_type, "si_addr", void_ptr_type);
489 append_composite_type_field (siginfo_type, "si_value", sigval_type);
490 append_composite_type_field (siginfo_type, "_reason", reason_type);
491
492 fbsd_gdbarch_data->siginfo_type = siginfo_type;
493
494 return siginfo_type;
495 }
496
497 /* Implement the "get_syscall_number" gdbarch method. */
498
499 static LONGEST
500 fbsd_get_syscall_number (struct gdbarch *gdbarch,
501 ptid_t ptid)
502 {
503
504 /* FreeBSD doesn't use gdbarch_get_syscall_number since FreeBSD
505 native targets fetch the system call number from the
506 'pl_syscall_code' member of struct ptrace_lwpinfo in fbsd_wait.
507 However, system call catching requires this function to be
508 set. */
509
510 internal_error (__FILE__, __LINE__, _("fbsd_get_sycall_number called"));
511 }
512
513 /* To be called from GDB_OSABI_FREEBSD handlers. */
514
515 void
516 fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
517 {
518 set_gdbarch_core_pid_to_str (gdbarch, fbsd_core_pid_to_str);
519 set_gdbarch_core_thread_name (gdbarch, fbsd_core_thread_name);
520 set_gdbarch_core_xfer_siginfo (gdbarch, fbsd_core_xfer_siginfo);
521 set_gdbarch_make_corefile_notes (gdbarch, fbsd_make_corefile_notes);
522 set_gdbarch_print_auxv_entry (gdbarch, fbsd_print_auxv_entry);
523 set_gdbarch_get_siginfo_type (gdbarch, fbsd_get_siginfo_type);
524
525 /* `catch syscall' */
526 set_xml_syscall_file_name (gdbarch, "syscalls/freebsd.xml");
527 set_gdbarch_get_syscall_number (gdbarch, fbsd_get_syscall_number);
528 }
529
530 void
531 _initialize_fbsd_tdep (void)
532 {
533 fbsd_gdbarch_data_handle =
534 gdbarch_data_register_post_init (init_fbsd_gdbarch_data);
535 }
gdbarch
Definition: gdbarch.c:127
fbsd-tdep.h
fbsd_collect_regset_section_cb_data::lwp
unsigned long lwp
Definition: fbsd-tdep.c:203
arch_type
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int bit, const char *name)
Definition: gdbtypes.c:4941
set_gdbarch_core_pid_to_str
void set_gdbarch_core_pid_to_str(struct gdbarch *gdbarch, gdbarch_core_pid_to_str_ftype core_pid_to_str)
Definition: gdbarch.c:3767
set_gdbarch_core_thread_name
void set_gdbarch_core_thread_name(struct gdbarch *gdbarch, gdbarch_core_thread_name_ftype core_thread_name)
Definition: gdbarch.c:3791
CORE_ADDR
bfd_vma CORE_ADDR
Definition: common-types.h:41
LWPINFO32_PL_SIGINFO
#define LWPINFO32_PL_SIGINFO
Definition: fbsd-tdep.c:46
ptid_get_pid
int ptid_get_pid(const ptid_t &ptid)
Definition: ptid.c:47
xfree
void xfree(void *)
get_inferior_args
char * get_inferior_args(void)
Definition: infcmd.c:161
gdbarch_int_bit
int gdbarch_int_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1579
regcache::regcache
regcache(gdbarch *gdbarch)
Definition: regcache.h:235
fbsd_gdbarch_data
Definition: fbsd-tdep.c:57
fbsd_gdbarch_data_handle
static struct gdbarch_data * fbsd_gdbarch_data_handle
Definition: fbsd-tdep.c:55
TYPE_NAME
#define TYPE_NAME(thistype)
Definition: gdbtypes.h:1224
set_gdbarch_get_siginfo_type
void set_gdbarch_get_siginfo_type(struct gdbarch *gdbarch, gdbarch_get_siginfo_type_ftype get_siginfo_type)
Definition: gdbarch.c:4233
fbsd_corefile_thread_data::obfd
bfd * obfd
Definition: fbsd-tdep.c:269
get_exec_file
char * get_exec_file(int err)
Definition: corefile.c:167
fbsd_get_syscall_number
static LONGEST fbsd_get_syscall_number(struct gdbarch *gdbarch, ptid_t ptid)
Definition: fbsd-tdep.c:500
SIZE32_SIGINFO_T
#define SIZE32_SIGINFO_T
Definition: fbsd-tdep.c:53
RETURN_MASK_ERROR
Definition: common-exceptions.h:43
internal_error
void internal_error(const char *file, int line, const char *fmt,...)
Definition: errors.c:50
inferior_thread
struct thread_info * inferior_thread(void)
Definition: thread.c:90
fbsd_corefile_thread
static void fbsd_corefile_thread(struct thread_info *info, struct fbsd_corefile_thread_data *args)
Definition: fbsd-tdep.c:279
auxv.h
gdbarch_long_bit
int gdbarch_long_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1596
target_fetch_registers
void target_fetch_registers(struct regcache *regcache, int regno)
Definition: target.c:3437
fbsd_corefile_thread_data::note_data
char * note_data
Definition: fbsd-tdep.c:270
_
#define _(String)
Definition: gdb_locale.h:35
thread_suspend_state::stop_signal
enum gdb_signal stop_signal
Definition: gdbthread.h:158
ui_file
Definition: ui-file.h:26
set_gdbarch_core_xfer_siginfo
void set_gdbarch_core_xfer_siginfo(struct gdbarch *gdbarch, gdbarch_core_xfer_siginfo_ftype core_xfer_siginfo)
Definition: gdbarch.c:3815
defs.h
builtin_type
Definition: gdbtypes.h:1495
END_CATCH
#define END_CATCH
Definition: common-exceptions.h:259
GDBARCH_OBSTACK_ZALLOC
#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE)
Definition: gdbarch.h:1709
arch_integer_type
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, const char *name)
Definition: gdbtypes.c:4962
default_print_auxv_entry
void default_print_auxv_entry(struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val)
Definition: auxv.c:445
regset
Definition: regset.h:34
normal_pid_to_str
const char * normal_pid_to_str(ptid_t ptid)
Definition: target.c:3234
TRY
#define TRY
Definition: common-exceptions.h:246
iterate_over_threads
struct thread_info * iterate_over_threads(thread_callback_func, void *)
Definition: thread.c:551
fbsd_collect_regset_section_cb_data::abort_iteration
int abort_iteration
Definition: fbsd-tdep.c:205
TYPE_CODE_TYPEDEF
Definition: gdbtypes.h:169
name
const char *const name
Definition: aarch64-tdep.c:76
fbsd_collect_regset_section_cb_data::obfd
bfd * obfd
Definition: fbsd-tdep.c:200
_initialize_fbsd_tdep
void _initialize_fbsd_tdep(void)
Definition: fbsd-tdep.c:531
append_composite_type_field
void append_composite_type_field(struct type *t, const char *name, struct type *field)
Definition: gdbtypes.c:5208
gdbarch_iterate_over_regset_sections_p
int gdbarch_iterate_over_regset_sections_p(struct gdbarch *gdbarch)
Definition: gdbarch.c:3630
CATCH
#define CATCH(EXCEPTION, MASK)
Definition: common-exceptions.h:254
fbsd_corefile_thread_data::gdbarch
struct gdbarch * gdbarch
Definition: fbsd-tdep.c:268
thread_info::suspend
thread_suspend_state suspend
Definition: gdbthread.h:295
fbsd_collect_regset_section_cb_data
Definition: fbsd-tdep.c:197
fbsd_core_xfer_siginfo
static LONGEST fbsd_core_xfer_siginfo(struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
Definition: fbsd-tdep.c:141
LWPINFO64_PL_SIGINFO
#define LWPINFO64_PL_SIGINFO
Definition: fbsd-tdep.c:45
regcache.h
ptid_t
Definition: ptid.h:35
get_fbsd_gdbarch_data
static struct fbsd_gdbarch_data * get_fbsd_gdbarch_data(struct gdbarch *gdbarch)
Definition: fbsd-tdep.c:69
exception_print
void exception_print(struct ui_file *file, struct gdb_exception e)
Definition: exceptions.c:109
gdbarch_byte_order
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition: gdbarch.c:1509
gdbthread.h
inferior.h
TYPE_CODE_UNION
Definition: gdbtypes.h:107
TARGET_CHAR_BIT
#define TARGET_CHAR_BIT
Definition: host-defs.h:29
type
Definition: gdbtypes.h:749
gdb_signal_to_host
int gdb_signal_to_host(enum gdb_signal)
Definition: signals.c:639
fbsd_init_abi
void fbsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: fbsd-tdep.c:516
init_vector_type
struct type * init_vector_type(struct type *elt_type, int n)
Definition: gdbtypes.c:1334
TYPE_TARGET_STUB
#define TYPE_TARGET_STUB(t)
Definition: gdbtypes.h:225
type
static const char * type
Definition: language.c:113
fbsd_corefile_thread_data::stop_signal
enum gdb_signal stop_signal
Definition: fbsd-tdep.c:272
thread_info::ptid
ptid_t ptid
Definition: gdbthread.h:219
fbsd_gdbarch_data::siginfo_type
struct type * siginfo_type
Definition: fbsd-tdep.c:59
set_gdbarch_make_corefile_notes
void set_gdbarch_make_corefile_notes(struct gdbarch *gdbarch, gdbarch_make_corefile_notes_ftype make_corefile_notes)
Definition: gdbarch.c:3671
PL_FLAG_SI
#define PL_FLAG_SI
Definition: fbsd-tdep.c:49
AUXV_FORMAT_STR
Definition: auxv.h:50
thread_section_name::c_str
const char * c_str() const
Definition: gdbcore.h:258
set_xml_syscall_file_name
void set_xml_syscall_file_name(struct gdbarch *gdbarch, const char *name)
Definition: xml-syscall.c:513
auxv_format
auxv_format
Definition: auxv.h:50
xml-syscall.h
xmalloc
void * xmalloc(YYSIZE_T)
ptid_get_lwp
long ptid_get_lwp(const ptid_t &ptid)
Definition: ptid.c:55
TYPE_CODE_STRUCT
Definition: gdbtypes.h:106
LWPINFO_OFFSET
#define LWPINFO_OFFSET
Definition: fbsd-tdep.c:41
gdb_assert
#define gdb_assert(expr)
Definition: gdb_assert.h:32
gdb_byte
bfd_byte gdb_byte
Definition: common-types.h:38
fbsd_collect_regset_section_cb
static void fbsd_collect_regset_section_cb(const char *sect_name, int size, const struct regset *regset, const char *human_name, void *cb_data)
Definition: fbsd-tdep.c:209
TYPE_TARGET_TYPE
#define TYPE_TARGET_TYPE(thistype)
Definition: gdbtypes.h:1226
ALL_NON_EXITED_THREADS
#define ALL_NON_EXITED_THREADS(T)
Definition: gdbthread.h:490
LWPINFO_PL_FLAGS
#define LWPINFO_PL_FLAGS
Definition: fbsd-tdep.c:44
gdb_stderr
#define gdb_stderr
Definition: utils.h:344
gdbcore.h
update_thread_list
void update_thread_list(void)
Definition: thread.c:2000
xsnprintf
int xsnprintf(char *str, size_t size, const char *format,...)
Definition: common-utils.c:134
inferior_ptid
ptid_t inferior_ptid
Definition: infcmd.c:94
offset
int offset
Definition: agent.c:65
set_gdbarch_get_syscall_number
void set_gdbarch_get_syscall_number(struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype get_syscall_number)
Definition: gdbarch.c:4281
fbsd_corefile_thread_data::note_size
int * note_size
Definition: fbsd-tdep.c:271
TAG
#define TAG(tag, text, kind)
regcache::arch
gdbarch * arch() const
Definition: regcache.c:221
fbsd_core_thread_name
static const char * fbsd_core_thread_name(struct gdbarch *gdbarch, struct thread_info *thr)
Definition: fbsd-tdep.c:95
extract_signed_integer
static LONGEST extract_signed_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
Definition: defs.h:570
fprint_auxv_entry
void fprint_auxv_entry(struct ui_file *file, const char *name, const char *description, enum auxv_format format, CORE_ADDR type, CORE_ADDR val)
Definition: auxv.c:413
fbsd_collect_regset_section_cb_data::regcache
const struct regcache * regcache
Definition: fbsd-tdep.c:199
AUXV_FORMAT_HEX
Definition: auxv.h:50
fbsd_print_auxv_entry
static void fbsd_print_auxv_entry(struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val)
Definition: fbsd-tdep.c:373
fbsd_collect_regset_section_cb_data::note_size
int * note_size
Definition: fbsd-tdep.c:202
fbsd_collect_thread_registers
static char * fbsd_collect_thread_registers(const struct regcache *regcache, ptid_t ptid, bfd *obfd, char *note_data, int *note_size, enum gdb_signal stop_signal)
Definition: fbsd-tdep.c:244
set_gdbarch_print_auxv_entry
void set_gdbarch_print_auxv_entry(struct gdbarch *gdbarch, gdbarch_print_auxv_entry_ftype print_auxv_entry)
Definition: gdbarch.c:4938
ULONGEST
unsigned long long ULONGEST
Definition: common-types.h:53
regcache
Definition: regcache.h:232
gdbarch_info
Definition: gdbarch.h:1626
regset.h
core_bfd
bfd * core_bfd
Definition: corefile.c:54
TYPE_LENGTH
#define TYPE_LENGTH(thistype)
Definition: gdbtypes.h:1235
fbsd_core_pid_to_str
static const char * fbsd_core_pid_to_str(struct gdbarch *gdbarch, ptid_t ptid)
Definition: fbsd-tdep.c:78
SIZE64_SIGINFO_T
#define SIZE64_SIGINFO_T
Definition: fbsd-tdep.c:52
AUXV_FORMAT_DEC
Definition: auxv.h:50
gdbarch_data
Definition: gdbarch.c:5084
fbsd_corefile_thread_data
Definition: fbsd-tdep.c:266
find_signalled_thread
static int find_signalled_thread(struct thread_info *info, void *data)
Definition: fbsd-tdep.c:184
thread_section_name
Definition: gdbcore.h:239
thread_info
Definition: gdbthread.h:205
size
size_t size
Definition: go32-nat.c:242
gdbarch_data_register_post_init
struct gdbarch_data * gdbarch_data_register_post_init(gdbarch_data_post_init_ftype *post_init)
Definition: gdbarch.c:5136
lookup_pointer_type
struct type * lookup_pointer_type(struct type *type)
Definition: gdbtypes.c:381
fbsd_collect_regset_section_cb_data::stop_signal
enum gdb_signal stop_signal
Definition: fbsd-tdep.c:204
LONGEST
long long LONGEST
Definition: common-types.h:52
arch_composite_type
struct type * arch_composite_type(struct gdbarch *gdbarch, const char *name, enum type_code code)
Definition: gdbtypes.c:5132
fbsd_collect_regset_section_cb_data::note_data
char * note_data
Definition: fbsd-tdep.c:201
get_thread_arch_regcache
struct regcache * get_thread_arch_regcache(ptid_t ptid, struct gdbarch *gdbarch)
Definition: regcache.c:423
init_fbsd_gdbarch_data
static void * init_fbsd_gdbarch_data(struct gdbarch *gdbarch)
Definition: fbsd-tdep.c:63
fbsd_get_siginfo_type
static struct type * fbsd_get_siginfo_type(struct gdbarch *gdbarch)
Definition: fbsd-tdep.c:408
gdbarch_iterate_over_regset_sections
void gdbarch_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
Definition: gdbarch.c:3637
fbsd_make_corefile_notes
static char * fbsd_make_corefile_notes(struct gdbarch *gdbarch, bfd *obfd, int *note_size)
Definition: fbsd-tdep.c:297
regset::collect_regset
collect_regset_ftype * collect_regset
Definition: regset.h:45