40a7c09d78e2d0b3d286eb4e3b19a2b01ce467a3
1 /* libthread_db helper functions for the remote server for GDB.
2 Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009
3 Free Software Foundation, Inc.
5 Contributed by MontaVista Software.
7 This file is part of GDB.
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
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 /* This file is currently tied to GNU/Linux. It should scale well to
25 another libthread_db implementation, with the approriate gdbserver
26 hooks, but for now this means we can use GNU/Linux's target data. */
28 #include "linux-low.h"
30 #include "gdb_proc_service.h"
32 typedef struct ps_prochandle
*gdb_ps_prochandle_t
;
33 typedef void *gdb_ps_read_buf_t
;
34 typedef const void *gdb_ps_write_buf_t
;
35 typedef size_t gdb_ps_size_t
;
37 #ifdef HAVE_LINUX_REGSETS
42 static struct regset_info
*
47 while (target_regsets
[i
].size
!= -1)
49 if (target_regsets
[i
].type
== GENERAL_REGS
)
54 return &target_regsets
[i
];
58 /* Search for the symbol named NAME within the object named OBJ within
59 the target process PH. If the symbol is found the address of the
60 symbol is stored in SYM_ADDR. */
63 ps_pglobal_lookup (gdb_ps_prochandle_t ph
, const char *obj
,
64 const char *name
, psaddr_t
*sym_addr
)
68 if (look_up_one_symbol (name
, &addr
) == 0)
71 *sym_addr
= (psaddr_t
) (unsigned long) addr
;
75 /* Read SIZE bytes from the target process PH at address ADDR and copy
79 ps_pdread (gdb_ps_prochandle_t ph
, psaddr_t addr
,
80 gdb_ps_read_buf_t buf
, gdb_ps_size_t size
)
82 read_inferior_memory ((unsigned long) addr
, buf
, size
);
86 /* Write SIZE bytes from BUF into the target process PH at address ADDR. */
89 ps_pdwrite (gdb_ps_prochandle_t ph
, psaddr_t addr
,
90 gdb_ps_write_buf_t buf
, gdb_ps_size_t size
)
92 return write_inferior_memory ((unsigned long) addr
, buf
, size
);
95 /* Get the general registers of LWP LWPID within the target process PH
96 and store them in GREGSET. */
99 ps_lgetregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
, prgregset_t gregset
)
102 struct lwp_info
*lwp
;
103 struct thread_info
*reg_inferior
, *save_inferior
;
105 lwp
= (struct lwp_info
*) find_inferior_id (&all_lwps
,
110 reg_inferior
= get_lwp_thread (lwp
);
111 save_inferior
= current_inferior
;
112 current_inferior
= reg_inferior
;
114 the_target
->fetch_registers (0);
115 gregset_info()->fill_function (gregset
);
117 current_inferior
= save_inferior
;
124 /* Set the general registers of LWP LWPID within the target process PH
128 ps_lsetregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
, const prgregset_t gregset
)
134 /* Get the floating-point registers of LWP LWPID within the target
135 process PH and store them in FPREGSET. */
138 ps_lgetfpregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
, void *fpregset
)
144 /* Set the floating-point registers of LWP LWPID within the target
145 process PH from FPREGSET. */
148 ps_lsetfpregs (gdb_ps_prochandle_t ph
, lwpid_t lwpid
, void *fpregset
)
154 /* Return overall process id of the target PH. Special for GNU/Linux
155 -- not used on Solaris. */
158 ps_getpid (gdb_ps_prochandle_t ph
)
This page took 0.034259 seconds and 4 git commands to generate.