18dffb485Schristos /* Target operations for the remote server for GDB. 2*f1c2b495Schristos Copyright (C) 2002-2024 Free Software Foundation, Inc. 38dffb485Schristos 48dffb485Schristos Contributed by MontaVista Software. 58dffb485Schristos 68dffb485Schristos This file is part of GDB. 78dffb485Schristos 88dffb485Schristos This program is free software; you can redistribute it and/or modify 98dffb485Schristos it under the terms of the GNU General Public License as published by 108dffb485Schristos the Free Software Foundation; either version 3 of the License, or 118dffb485Schristos (at your option) any later version. 128dffb485Schristos 138dffb485Schristos This program is distributed in the hope that it will be useful, 148dffb485Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 158dffb485Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 168dffb485Schristos GNU General Public License for more details. 178dffb485Schristos 188dffb485Schristos You should have received a copy of the GNU General Public License 198dffb485Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 208dffb485Schristos 218dffb485Schristos #include "tracepoint.h" 228dffb485Schristos #include "gdbsupport/byte-vector.h" 238dffb485Schristos #include "hostio.h" 248dffb485Schristos #include <fcntl.h> 258dffb485Schristos #include <unistd.h> 268dffb485Schristos #include <sys/types.h> 278dffb485Schristos #include <sys/stat.h> 288dffb485Schristos 298dffb485Schristos process_stratum_target *the_target; 308dffb485Schristos 314b169a6bSchristos /* See target.h. */ 324b169a6bSchristos 334b169a6bSchristos bool 348dffb485Schristos set_desired_thread () 358dffb485Schristos { 368dffb485Schristos client_state &cs = get_client_state (); 378dffb485Schristos thread_info *found = find_thread_ptid (cs.general_thread); 388dffb485Schristos 394b169a6bSchristos if (found == nullptr) 404b169a6bSchristos { 414b169a6bSchristos process_info *proc = find_process_pid (cs.general_thread.pid ()); 424b169a6bSchristos if (proc == nullptr) 434b169a6bSchristos { 444b169a6bSchristos threads_debug_printf 454b169a6bSchristos ("did not find thread nor process for general_thread %s", 464b169a6bSchristos cs.general_thread.to_string ().c_str ()); 474b169a6bSchristos } 484b169a6bSchristos else 494b169a6bSchristos { 504b169a6bSchristos threads_debug_printf 514b169a6bSchristos ("did not find thread for general_thread %s, but found process", 524b169a6bSchristos cs.general_thread.to_string ().c_str ()); 534b169a6bSchristos } 544b169a6bSchristos switch_to_process (proc); 554b169a6bSchristos } 564b169a6bSchristos else 574b169a6bSchristos switch_to_thread (found); 584b169a6bSchristos 598dffb485Schristos return (current_thread != NULL); 608dffb485Schristos } 618dffb485Schristos 628dffb485Schristos /* See target.h. */ 638dffb485Schristos 644b169a6bSchristos bool 654b169a6bSchristos set_desired_process () 668dffb485Schristos { 678dffb485Schristos client_state &cs = get_client_state (); 688dffb485Schristos 694b169a6bSchristos process_info *proc = find_process_pid (cs.general_thread.pid ()); 704b169a6bSchristos if (proc == nullptr) 718dffb485Schristos { 724b169a6bSchristos threads_debug_printf 734b169a6bSchristos ("did not find process for general_thread %s", 744b169a6bSchristos cs.general_thread.to_string ().c_str ()); 758dffb485Schristos } 764b169a6bSchristos switch_to_process (proc); 778dffb485Schristos 784b169a6bSchristos return proc != nullptr; 798dffb485Schristos } 808dffb485Schristos 81*f1c2b495Schristos /* See target.h. */ 82*f1c2b495Schristos 838dffb485Schristos int 848dffb485Schristos read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) 858dffb485Schristos { 864b169a6bSchristos /* At the time of writing, GDB only sends write packets with LEN==0, 874b169a6bSchristos not read packets (see comment in target_write_memory), but it 884b169a6bSchristos doesn't hurt to prevent problems if it ever does, or we're 894b169a6bSchristos connected to some client other than GDB that does. */ 904b169a6bSchristos if (len == 0) 914b169a6bSchristos return 0; 924b169a6bSchristos 934b169a6bSchristos int res = the_target->read_memory (memaddr, myaddr, len); 948dffb485Schristos check_mem_read (memaddr, myaddr, len); 958dffb485Schristos return res; 968dffb485Schristos } 978dffb485Schristos 988dffb485Schristos /* See target/target.h. */ 998dffb485Schristos 1008dffb485Schristos int 1018dffb485Schristos target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len) 1028dffb485Schristos { 1038dffb485Schristos return read_inferior_memory (memaddr, myaddr, len); 1048dffb485Schristos } 1058dffb485Schristos 1068dffb485Schristos /* See target/target.h. */ 1078dffb485Schristos 1088dffb485Schristos int 1098dffb485Schristos target_read_uint32 (CORE_ADDR memaddr, uint32_t *result) 1108dffb485Schristos { 1118dffb485Schristos return read_inferior_memory (memaddr, (gdb_byte *) result, sizeof (*result)); 1128dffb485Schristos } 1138dffb485Schristos 1148dffb485Schristos /* See target/target.h. */ 1158dffb485Schristos 1168dffb485Schristos int 1178dffb485Schristos target_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, 1188dffb485Schristos ssize_t len) 1198dffb485Schristos { 1204b169a6bSchristos /* GDB may send X packets with LEN==0, for probing packet support. 1214b169a6bSchristos If we let such a request go through, then buffer.data() below may 1224b169a6bSchristos return NULL, which may confuse target implementations. Handle it 1234b169a6bSchristos here to avoid lower levels having to care about this case. */ 1244b169a6bSchristos if (len == 0) 1254b169a6bSchristos return 0; 1264b169a6bSchristos 1278dffb485Schristos /* Make a copy of the data because check_mem_write may need to 1288dffb485Schristos update it. */ 1298dffb485Schristos gdb::byte_vector buffer (myaddr, myaddr + len); 1308dffb485Schristos check_mem_write (memaddr, buffer.data (), myaddr, len); 1318dffb485Schristos return the_target->write_memory (memaddr, buffer.data (), len); 1328dffb485Schristos } 1338dffb485Schristos 1348dffb485Schristos ptid_t 1354b169a6bSchristos mywait (ptid_t ptid, struct target_waitstatus *ourstatus, 1364b169a6bSchristos target_wait_flags options, int connected_wait) 1378dffb485Schristos { 1388dffb485Schristos ptid_t ret; 1398dffb485Schristos 1408dffb485Schristos if (connected_wait) 1418dffb485Schristos server_waiting = 1; 1428dffb485Schristos 1438dffb485Schristos ret = target_wait (ptid, ourstatus, options); 1448dffb485Schristos 1458dffb485Schristos /* We don't expose _LOADED events to gdbserver core. See the 1468dffb485Schristos `dlls_changed' global. */ 1474b169a6bSchristos if (ourstatus->kind () == TARGET_WAITKIND_LOADED) 1484b169a6bSchristos ourstatus->set_stopped (GDB_SIGNAL_0); 1498dffb485Schristos 1508dffb485Schristos /* If GDB is connected through TCP/serial, then GDBserver will most 1518dffb485Schristos probably be running on its own terminal/console, so it's nice to 1528dffb485Schristos print there why is GDBserver exiting. If however, GDB is 1538dffb485Schristos connected through stdio, then there's no need to spam the GDB 1548dffb485Schristos console with this -- the user will already see the exit through 1558dffb485Schristos regular GDB output, in that same terminal. */ 1568dffb485Schristos if (!remote_connection_is_stdio ()) 1578dffb485Schristos { 1584b169a6bSchristos if (ourstatus->kind () == TARGET_WAITKIND_EXITED) 1598dffb485Schristos fprintf (stderr, 1604b169a6bSchristos "\nChild exited with status %d\n", ourstatus->exit_status ()); 1614b169a6bSchristos else if (ourstatus->kind () == TARGET_WAITKIND_SIGNALLED) 1628dffb485Schristos fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n", 1634b169a6bSchristos gdb_signal_to_host (ourstatus->sig ()), 1644b169a6bSchristos gdb_signal_to_name (ourstatus->sig ())); 1658dffb485Schristos } 1668dffb485Schristos 1678dffb485Schristos if (connected_wait) 1688dffb485Schristos server_waiting = 0; 1698dffb485Schristos 1708dffb485Schristos return ret; 1718dffb485Schristos } 1728dffb485Schristos 1738dffb485Schristos /* See target/target.h. */ 1748dffb485Schristos 1758dffb485Schristos void 1768dffb485Schristos target_stop_and_wait (ptid_t ptid) 1778dffb485Schristos { 1788dffb485Schristos struct target_waitstatus status; 1798dffb485Schristos bool was_non_stop = non_stop; 1808dffb485Schristos struct thread_resume resume_info; 1818dffb485Schristos 1828dffb485Schristos resume_info.thread = ptid; 1838dffb485Schristos resume_info.kind = resume_stop; 1848dffb485Schristos resume_info.sig = GDB_SIGNAL_0; 1858dffb485Schristos the_target->resume (&resume_info, 1); 1868dffb485Schristos 1878dffb485Schristos non_stop = true; 1888dffb485Schristos mywait (ptid, &status, 0, 0); 1898dffb485Schristos non_stop = was_non_stop; 1908dffb485Schristos } 1918dffb485Schristos 1928dffb485Schristos /* See target/target.h. */ 1938dffb485Schristos 1948dffb485Schristos ptid_t 1954b169a6bSchristos target_wait (ptid_t ptid, struct target_waitstatus *status, 1964b169a6bSchristos target_wait_flags options) 1978dffb485Schristos { 1988dffb485Schristos return the_target->wait (ptid, status, options); 1998dffb485Schristos } 2008dffb485Schristos 2018dffb485Schristos /* See target/target.h. */ 2028dffb485Schristos 2038dffb485Schristos void 2048dffb485Schristos target_mourn_inferior (ptid_t ptid) 2058dffb485Schristos { 2068dffb485Schristos the_target->mourn (find_process_pid (ptid.pid ())); 2078dffb485Schristos } 2088dffb485Schristos 2098dffb485Schristos /* See target/target.h. */ 2108dffb485Schristos 2118dffb485Schristos void 2128dffb485Schristos target_continue_no_signal (ptid_t ptid) 2138dffb485Schristos { 2148dffb485Schristos struct thread_resume resume_info; 2158dffb485Schristos 2168dffb485Schristos resume_info.thread = ptid; 2178dffb485Schristos resume_info.kind = resume_continue; 2188dffb485Schristos resume_info.sig = GDB_SIGNAL_0; 2198dffb485Schristos the_target->resume (&resume_info, 1); 2208dffb485Schristos } 2218dffb485Schristos 2228dffb485Schristos /* See target/target.h. */ 2238dffb485Schristos 2248dffb485Schristos void 2258dffb485Schristos target_continue (ptid_t ptid, enum gdb_signal signal) 2268dffb485Schristos { 2278dffb485Schristos struct thread_resume resume_info; 2288dffb485Schristos 2298dffb485Schristos resume_info.thread = ptid; 2308dffb485Schristos resume_info.kind = resume_continue; 2318dffb485Schristos resume_info.sig = gdb_signal_to_host (signal); 2328dffb485Schristos the_target->resume (&resume_info, 1); 2338dffb485Schristos } 2348dffb485Schristos 2358dffb485Schristos /* See target/target.h. */ 2368dffb485Schristos 2378dffb485Schristos int 2388dffb485Schristos target_supports_multi_process (void) 2398dffb485Schristos { 2408dffb485Schristos return the_target->supports_multi_process (); 2418dffb485Schristos } 2428dffb485Schristos 2438dffb485Schristos void 2448dffb485Schristos set_target_ops (process_stratum_target *target) 2458dffb485Schristos { 2468dffb485Schristos the_target = target; 2478dffb485Schristos } 2488dffb485Schristos 2498dffb485Schristos /* Convert pid to printable format. */ 2508dffb485Schristos 2514b169a6bSchristos std::string 2528dffb485Schristos target_pid_to_str (ptid_t ptid) 2538dffb485Schristos { 2548dffb485Schristos if (ptid == minus_one_ptid) 2554b169a6bSchristos return string_printf("<all threads>"); 2568dffb485Schristos else if (ptid == null_ptid) 2574b169a6bSchristos return string_printf("<null thread>"); 2588dffb485Schristos else if (ptid.tid () != 0) 2594b169a6bSchristos return string_printf("Thread %d.0x%s", 2604b169a6bSchristos ptid.pid (), 2614b169a6bSchristos phex_nz (ptid.tid (), sizeof (ULONGEST))); 2628dffb485Schristos else if (ptid.lwp () != 0) 2634b169a6bSchristos return string_printf("LWP %d.%ld", 2648dffb485Schristos ptid.pid (), ptid.lwp ()); 2658dffb485Schristos else 2664b169a6bSchristos return string_printf("Process %d", 2678dffb485Schristos ptid.pid ()); 2688dffb485Schristos } 2698dffb485Schristos 2708dffb485Schristos int 2718dffb485Schristos kill_inferior (process_info *proc) 2728dffb485Schristos { 2738dffb485Schristos gdb_agent_about_to_close (proc->pid); 2748dffb485Schristos 2758dffb485Schristos return the_target->kill (proc); 2768dffb485Schristos } 2778dffb485Schristos 2788dffb485Schristos /* Define it. */ 2798dffb485Schristos 2808dffb485Schristos target_terminal_state target_terminal::m_terminal_state 2818dffb485Schristos = target_terminal_state::is_ours; 2828dffb485Schristos 2838dffb485Schristos /* See target/target.h. */ 2848dffb485Schristos 2858dffb485Schristos void 2868dffb485Schristos target_terminal::init () 2878dffb485Schristos { 2888dffb485Schristos /* Placeholder needed because of fork_inferior. Not necessary on 2898dffb485Schristos GDBserver. */ 2908dffb485Schristos } 2918dffb485Schristos 2928dffb485Schristos /* See target/target.h. */ 2938dffb485Schristos 2948dffb485Schristos void 2958dffb485Schristos target_terminal::inferior () 2968dffb485Schristos { 2978dffb485Schristos /* Placeholder needed because of fork_inferior. Not necessary on 2988dffb485Schristos GDBserver. */ 2998dffb485Schristos } 3008dffb485Schristos 3018dffb485Schristos /* See target/target.h. */ 3028dffb485Schristos 3038dffb485Schristos void 3048dffb485Schristos target_terminal::ours () 3058dffb485Schristos { 3068dffb485Schristos /* Placeholder needed because of fork_inferior. Not necessary on 3078dffb485Schristos GDBserver. */ 3088dffb485Schristos } 3098dffb485Schristos 3108dffb485Schristos /* See target/target.h. */ 3118dffb485Schristos 3128dffb485Schristos void 3138dffb485Schristos target_terminal::ours_for_output (void) 3148dffb485Schristos { 3158dffb485Schristos /* Placeholder. */ 3168dffb485Schristos } 3178dffb485Schristos 3188dffb485Schristos /* See target/target.h. */ 3198dffb485Schristos 3208dffb485Schristos void 3218dffb485Schristos target_terminal::info (const char *arg, int from_tty) 3228dffb485Schristos { 3238dffb485Schristos /* Placeholder. */ 3248dffb485Schristos } 3258dffb485Schristos 3268dffb485Schristos /* Default implementations of target ops. 3278dffb485Schristos See target.h for definitions. */ 3288dffb485Schristos 3298dffb485Schristos void 3308dffb485Schristos process_stratum_target::post_create_inferior () 3318dffb485Schristos { 3328dffb485Schristos /* Nop. */ 3338dffb485Schristos } 3348dffb485Schristos 3358dffb485Schristos void 3368dffb485Schristos process_stratum_target::look_up_symbols () 3378dffb485Schristos { 3388dffb485Schristos /* Nop. */ 3398dffb485Schristos } 3408dffb485Schristos 3418dffb485Schristos bool 3428dffb485Schristos process_stratum_target::supports_read_auxv () 3438dffb485Schristos { 3448dffb485Schristos return false; 3458dffb485Schristos } 3468dffb485Schristos 3478dffb485Schristos int 348*f1c2b495Schristos process_stratum_target::read_auxv (int pid, CORE_ADDR offset, 349*f1c2b495Schristos unsigned char *myaddr, unsigned int len) 3508dffb485Schristos { 3518dffb485Schristos gdb_assert_not_reached ("target op read_auxv not supported"); 3528dffb485Schristos } 3538dffb485Schristos 3548dffb485Schristos bool 3558dffb485Schristos process_stratum_target::supports_z_point_type (char z_type) 3568dffb485Schristos { 3578dffb485Schristos return false; 3588dffb485Schristos } 3598dffb485Schristos 3608dffb485Schristos int 3618dffb485Schristos process_stratum_target::insert_point (enum raw_bkpt_type type, 3628dffb485Schristos CORE_ADDR addr, 3638dffb485Schristos int size, raw_breakpoint *bp) 3648dffb485Schristos { 3658dffb485Schristos return 1; 3668dffb485Schristos } 3678dffb485Schristos 3688dffb485Schristos int 3698dffb485Schristos process_stratum_target::remove_point (enum raw_bkpt_type type, 3708dffb485Schristos CORE_ADDR addr, 3718dffb485Schristos int size, raw_breakpoint *bp) 3728dffb485Schristos { 3738dffb485Schristos return 1; 3748dffb485Schristos } 3758dffb485Schristos 3768dffb485Schristos bool 3778dffb485Schristos process_stratum_target::stopped_by_sw_breakpoint () 3788dffb485Schristos { 3798dffb485Schristos return false; 3808dffb485Schristos } 3818dffb485Schristos 3828dffb485Schristos bool 3838dffb485Schristos process_stratum_target::supports_stopped_by_sw_breakpoint () 3848dffb485Schristos { 3858dffb485Schristos return false; 3868dffb485Schristos } 3878dffb485Schristos 3888dffb485Schristos bool 3898dffb485Schristos process_stratum_target::stopped_by_hw_breakpoint () 3908dffb485Schristos { 3918dffb485Schristos return false; 3928dffb485Schristos } 3938dffb485Schristos 3948dffb485Schristos bool 3958dffb485Schristos process_stratum_target::supports_stopped_by_hw_breakpoint () 3968dffb485Schristos { 3978dffb485Schristos return false; 3988dffb485Schristos } 3998dffb485Schristos 4008dffb485Schristos bool 4018dffb485Schristos process_stratum_target::supports_hardware_single_step () 4028dffb485Schristos { 4038dffb485Schristos return false; 4048dffb485Schristos } 4058dffb485Schristos 4068dffb485Schristos bool 4078dffb485Schristos process_stratum_target::stopped_by_watchpoint () 4088dffb485Schristos { 4098dffb485Schristos return false; 4108dffb485Schristos } 4118dffb485Schristos 4128dffb485Schristos CORE_ADDR 4138dffb485Schristos process_stratum_target::stopped_data_address () 4148dffb485Schristos { 4158dffb485Schristos return 0; 4168dffb485Schristos } 4178dffb485Schristos 4188dffb485Schristos bool 4198dffb485Schristos process_stratum_target::supports_read_offsets () 4208dffb485Schristos { 4218dffb485Schristos return false; 4228dffb485Schristos } 4238dffb485Schristos 4244b169a6bSchristos bool 4254b169a6bSchristos process_stratum_target::supports_memory_tagging () 4264b169a6bSchristos { 4274b169a6bSchristos return false; 4284b169a6bSchristos } 4294b169a6bSchristos 4304b169a6bSchristos bool 4314b169a6bSchristos process_stratum_target::fetch_memtags (CORE_ADDR address, size_t len, 4324b169a6bSchristos gdb::byte_vector &tags, int type) 4334b169a6bSchristos { 4344b169a6bSchristos gdb_assert_not_reached ("target op fetch_memtags not supported"); 4354b169a6bSchristos } 4364b169a6bSchristos 4374b169a6bSchristos bool 4384b169a6bSchristos process_stratum_target::store_memtags (CORE_ADDR address, size_t len, 4394b169a6bSchristos const gdb::byte_vector &tags, int type) 4404b169a6bSchristos { 4414b169a6bSchristos gdb_assert_not_reached ("target op store_memtags not supported"); 4424b169a6bSchristos } 4434b169a6bSchristos 4448dffb485Schristos int 4458dffb485Schristos process_stratum_target::read_offsets (CORE_ADDR *text, CORE_ADDR *data) 4468dffb485Schristos { 4478dffb485Schristos gdb_assert_not_reached ("target op read_offsets not supported"); 4488dffb485Schristos } 4498dffb485Schristos 4508dffb485Schristos bool 4518dffb485Schristos process_stratum_target::supports_get_tls_address () 4528dffb485Schristos { 4538dffb485Schristos return false; 4548dffb485Schristos } 4558dffb485Schristos 4568dffb485Schristos int 4578dffb485Schristos process_stratum_target::get_tls_address (thread_info *thread, 4588dffb485Schristos CORE_ADDR offset, 4598dffb485Schristos CORE_ADDR load_module, 4608dffb485Schristos CORE_ADDR *address) 4618dffb485Schristos { 4628dffb485Schristos gdb_assert_not_reached ("target op get_tls_address not supported"); 4638dffb485Schristos } 4648dffb485Schristos 4658dffb485Schristos bool 4668dffb485Schristos process_stratum_target::supports_qxfer_osdata () 4678dffb485Schristos { 4688dffb485Schristos return false; 4698dffb485Schristos } 4708dffb485Schristos 4718dffb485Schristos int 4728dffb485Schristos process_stratum_target::qxfer_osdata (const char *annex, 4738dffb485Schristos unsigned char *readbuf, 4748dffb485Schristos unsigned const char *writebuf, 4758dffb485Schristos CORE_ADDR offset, int len) 4768dffb485Schristos { 4778dffb485Schristos gdb_assert_not_reached ("target op qxfer_osdata not supported"); 4788dffb485Schristos } 4798dffb485Schristos 4808dffb485Schristos bool 4818dffb485Schristos process_stratum_target::supports_qxfer_siginfo () 4828dffb485Schristos { 4838dffb485Schristos return false; 4848dffb485Schristos } 4858dffb485Schristos 4868dffb485Schristos int 4878dffb485Schristos process_stratum_target::qxfer_siginfo (const char *annex, 4888dffb485Schristos unsigned char *readbuf, 4898dffb485Schristos unsigned const char *writebuf, 4908dffb485Schristos CORE_ADDR offset, int len) 4918dffb485Schristos { 4928dffb485Schristos gdb_assert_not_reached ("target op qxfer_siginfo not supported"); 4938dffb485Schristos } 4948dffb485Schristos 4958dffb485Schristos bool 4968dffb485Schristos process_stratum_target::supports_non_stop () 4978dffb485Schristos { 4988dffb485Schristos return false; 4998dffb485Schristos } 5008dffb485Schristos 5018dffb485Schristos bool 5028dffb485Schristos process_stratum_target::async (bool enable) 5038dffb485Schristos { 5048dffb485Schristos return false; 5058dffb485Schristos } 5068dffb485Schristos 5078dffb485Schristos int 5088dffb485Schristos process_stratum_target::start_non_stop (bool enable) 5098dffb485Schristos { 5108dffb485Schristos if (enable) 5118dffb485Schristos return -1; 5128dffb485Schristos else 5138dffb485Schristos return 0; 5148dffb485Schristos } 5158dffb485Schristos 5168dffb485Schristos bool 5178dffb485Schristos process_stratum_target::supports_multi_process () 5188dffb485Schristos { 5198dffb485Schristos return false; 5208dffb485Schristos } 5218dffb485Schristos 5228dffb485Schristos bool 5238dffb485Schristos process_stratum_target::supports_fork_events () 5248dffb485Schristos { 5258dffb485Schristos return false; 5268dffb485Schristos } 5278dffb485Schristos 5288dffb485Schristos bool 5298dffb485Schristos process_stratum_target::supports_vfork_events () 5308dffb485Schristos { 5318dffb485Schristos return false; 5328dffb485Schristos } 5338dffb485Schristos 534*f1c2b495Schristos gdb_thread_options 535*f1c2b495Schristos process_stratum_target::supported_thread_options () 536*f1c2b495Schristos { 537*f1c2b495Schristos return 0; 538*f1c2b495Schristos } 539*f1c2b495Schristos 5408dffb485Schristos bool 5418dffb485Schristos process_stratum_target::supports_exec_events () 5428dffb485Schristos { 5438dffb485Schristos return false; 5448dffb485Schristos } 5458dffb485Schristos 5468dffb485Schristos void 5478dffb485Schristos process_stratum_target::handle_new_gdb_connection () 5488dffb485Schristos { 5498dffb485Schristos /* Nop. */ 5508dffb485Schristos } 5518dffb485Schristos 5528dffb485Schristos int 5538dffb485Schristos process_stratum_target::handle_monitor_command (char *mon) 5548dffb485Schristos { 5558dffb485Schristos return 0; 5568dffb485Schristos } 5578dffb485Schristos 5588dffb485Schristos int 5598dffb485Schristos process_stratum_target::core_of_thread (ptid_t ptid) 5608dffb485Schristos { 5618dffb485Schristos return -1; 5628dffb485Schristos } 5638dffb485Schristos 5648dffb485Schristos bool 5658dffb485Schristos process_stratum_target::supports_read_loadmap () 5668dffb485Schristos { 5678dffb485Schristos return false; 5688dffb485Schristos } 5698dffb485Schristos 5708dffb485Schristos int 5718dffb485Schristos process_stratum_target::read_loadmap (const char *annex, 5728dffb485Schristos CORE_ADDR offset, 5738dffb485Schristos unsigned char *myaddr, 5748dffb485Schristos unsigned int len) 5758dffb485Schristos { 5768dffb485Schristos gdb_assert_not_reached ("target op read_loadmap not supported"); 5778dffb485Schristos } 5788dffb485Schristos 5798dffb485Schristos void 5808dffb485Schristos process_stratum_target::process_qsupported 5818dffb485Schristos (gdb::array_view<const char * const> features) 5828dffb485Schristos { 5838dffb485Schristos /* Nop. */ 5848dffb485Schristos } 5858dffb485Schristos 5868dffb485Schristos bool 5878dffb485Schristos process_stratum_target::supports_tracepoints () 5888dffb485Schristos { 5898dffb485Schristos return false; 5908dffb485Schristos } 5918dffb485Schristos 5928dffb485Schristos CORE_ADDR 5938dffb485Schristos process_stratum_target::read_pc (regcache *regcache) 5948dffb485Schristos { 5958dffb485Schristos gdb_assert_not_reached ("process_target::read_pc: Unable to find PC"); 5968dffb485Schristos } 5978dffb485Schristos 5988dffb485Schristos void 5998dffb485Schristos process_stratum_target::write_pc (regcache *regcache, CORE_ADDR pc) 6008dffb485Schristos { 6018dffb485Schristos gdb_assert_not_reached ("process_target::write_pc: Unable to update PC"); 6028dffb485Schristos } 6038dffb485Schristos 6048dffb485Schristos bool 6058dffb485Schristos process_stratum_target::supports_thread_stopped () 6068dffb485Schristos { 6078dffb485Schristos return false; 6088dffb485Schristos } 6098dffb485Schristos 6108dffb485Schristos bool 6118dffb485Schristos process_stratum_target::thread_stopped (thread_info *thread) 6128dffb485Schristos { 6138dffb485Schristos gdb_assert_not_reached ("target op thread_stopped not supported"); 6148dffb485Schristos } 6158dffb485Schristos 6168dffb485Schristos bool 617*f1c2b495Schristos process_stratum_target::any_resumed () 618*f1c2b495Schristos { 619*f1c2b495Schristos return true; 620*f1c2b495Schristos } 621*f1c2b495Schristos 622*f1c2b495Schristos bool 6238dffb485Schristos process_stratum_target::supports_get_tib_address () 6248dffb485Schristos { 6258dffb485Schristos return false; 6268dffb485Schristos } 6278dffb485Schristos 6288dffb485Schristos int 6298dffb485Schristos process_stratum_target::get_tib_address (ptid_t ptid, CORE_ADDR *address) 6308dffb485Schristos { 6318dffb485Schristos gdb_assert_not_reached ("target op get_tib_address not supported"); 6328dffb485Schristos } 6338dffb485Schristos 6348dffb485Schristos void 6358dffb485Schristos process_stratum_target::pause_all (bool freeze) 6368dffb485Schristos { 6378dffb485Schristos /* Nop. */ 6388dffb485Schristos } 6398dffb485Schristos 6408dffb485Schristos void 6418dffb485Schristos process_stratum_target::unpause_all (bool unfreeze) 6428dffb485Schristos { 6438dffb485Schristos /* Nop. */ 6448dffb485Schristos } 6458dffb485Schristos 6468dffb485Schristos void 6478dffb485Schristos process_stratum_target::stabilize_threads () 6488dffb485Schristos { 6498dffb485Schristos /* Nop. */ 6508dffb485Schristos } 6518dffb485Schristos 6528dffb485Schristos bool 6538dffb485Schristos process_stratum_target::supports_fast_tracepoints () 6548dffb485Schristos { 6558dffb485Schristos return false; 6568dffb485Schristos } 6578dffb485Schristos 6588dffb485Schristos int 6598dffb485Schristos process_stratum_target::install_fast_tracepoint_jump_pad 6608dffb485Schristos (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, 6618dffb485Schristos CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry, 6628dffb485Schristos CORE_ADDR *trampoline, ULONGEST *trampoline_size, 6638dffb485Schristos unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size, 6648dffb485Schristos CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end, 6658dffb485Schristos char *err) 6668dffb485Schristos { 6678dffb485Schristos gdb_assert_not_reached ("target op install_fast_tracepoint_jump_pad " 6688dffb485Schristos "not supported"); 6698dffb485Schristos } 6708dffb485Schristos 6718dffb485Schristos int 6728dffb485Schristos process_stratum_target::get_min_fast_tracepoint_insn_len () 6738dffb485Schristos { 6748dffb485Schristos return 0; 6758dffb485Schristos } 6768dffb485Schristos 6778dffb485Schristos struct emit_ops * 6788dffb485Schristos process_stratum_target::emit_ops () 6798dffb485Schristos { 6808dffb485Schristos return nullptr; 6818dffb485Schristos } 6828dffb485Schristos 6838dffb485Schristos bool 6848dffb485Schristos process_stratum_target::supports_disable_randomization () 6858dffb485Schristos { 6868dffb485Schristos return false; 6878dffb485Schristos } 6888dffb485Schristos 6898dffb485Schristos bool 6908dffb485Schristos process_stratum_target::supports_qxfer_libraries_svr4 () 6918dffb485Schristos { 6928dffb485Schristos return false; 6938dffb485Schristos } 6948dffb485Schristos 6958dffb485Schristos int 6968dffb485Schristos process_stratum_target::qxfer_libraries_svr4 (const char *annex, 6978dffb485Schristos unsigned char *readbuf, 6988dffb485Schristos unsigned const char *writebuf, 6998dffb485Schristos CORE_ADDR offset, int len) 7008dffb485Schristos { 7018dffb485Schristos gdb_assert_not_reached ("target op qxfer_libraries_svr4 not supported"); 7028dffb485Schristos } 7038dffb485Schristos 7048dffb485Schristos bool 7058dffb485Schristos process_stratum_target::supports_agent () 7068dffb485Schristos { 7078dffb485Schristos return false; 7088dffb485Schristos } 7098dffb485Schristos 7104b169a6bSchristos bool 7114b169a6bSchristos process_stratum_target::supports_btrace () 7124b169a6bSchristos { 7134b169a6bSchristos return false; 7144b169a6bSchristos } 7154b169a6bSchristos 7168dffb485Schristos btrace_target_info * 7174b169a6bSchristos process_stratum_target::enable_btrace (thread_info *tp, 7184b169a6bSchristos const btrace_config *conf) 7198dffb485Schristos { 7208dffb485Schristos error (_("Target does not support branch tracing.")); 7218dffb485Schristos } 7228dffb485Schristos 7238dffb485Schristos int 7248dffb485Schristos process_stratum_target::disable_btrace (btrace_target_info *tinfo) 7258dffb485Schristos { 7268dffb485Schristos error (_("Target does not support branch tracing.")); 7278dffb485Schristos } 7288dffb485Schristos 7298dffb485Schristos int 7308dffb485Schristos process_stratum_target::read_btrace (btrace_target_info *tinfo, 731*f1c2b495Schristos std::string *buffer, 7328dffb485Schristos enum btrace_read_type type) 7338dffb485Schristos { 7348dffb485Schristos error (_("Target does not support branch tracing.")); 7358dffb485Schristos } 7368dffb485Schristos 7378dffb485Schristos int 7388dffb485Schristos process_stratum_target::read_btrace_conf (const btrace_target_info *tinfo, 739*f1c2b495Schristos std::string *buffer) 7408dffb485Schristos { 7418dffb485Schristos error (_("Target does not support branch tracing.")); 7428dffb485Schristos } 7438dffb485Schristos 7448dffb485Schristos bool 7458dffb485Schristos process_stratum_target::supports_range_stepping () 7468dffb485Schristos { 7478dffb485Schristos return false; 7488dffb485Schristos } 7498dffb485Schristos 7508dffb485Schristos bool 7518dffb485Schristos process_stratum_target::supports_pid_to_exec_file () 7528dffb485Schristos { 7538dffb485Schristos return false; 7548dffb485Schristos } 7558dffb485Schristos 7564b169a6bSchristos const char * 7578dffb485Schristos process_stratum_target::pid_to_exec_file (int pid) 7588dffb485Schristos { 7598dffb485Schristos gdb_assert_not_reached ("target op pid_to_exec_file not supported"); 7608dffb485Schristos } 7618dffb485Schristos 7628dffb485Schristos bool 7638dffb485Schristos process_stratum_target::supports_multifs () 7648dffb485Schristos { 7658dffb485Schristos return false; 7668dffb485Schristos } 7678dffb485Schristos 7688dffb485Schristos int 7698dffb485Schristos process_stratum_target::multifs_open (int pid, const char *filename, 7708dffb485Schristos int flags, mode_t mode) 7718dffb485Schristos { 7728dffb485Schristos return open (filename, flags, mode); 7738dffb485Schristos } 7748dffb485Schristos 7758dffb485Schristos int 7768dffb485Schristos process_stratum_target::multifs_unlink (int pid, const char *filename) 7778dffb485Schristos { 7788dffb485Schristos return unlink (filename); 7798dffb485Schristos } 7808dffb485Schristos 7818dffb485Schristos ssize_t 7828dffb485Schristos process_stratum_target::multifs_readlink (int pid, const char *filename, 7838dffb485Schristos char *buf, size_t bufsiz) 7848dffb485Schristos { 7858dffb485Schristos return readlink (filename, buf, bufsiz); 7868dffb485Schristos } 7878dffb485Schristos 7888dffb485Schristos int 7898dffb485Schristos process_stratum_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr) 7908dffb485Schristos { 7918dffb485Schristos /* The default behavior is to use the size of a breakpoint as the 7928dffb485Schristos kind. */ 7938dffb485Schristos int size = 0; 7948dffb485Schristos sw_breakpoint_from_kind (0, &size); 7958dffb485Schristos return size; 7968dffb485Schristos } 7978dffb485Schristos 7988dffb485Schristos int 7998dffb485Schristos process_stratum_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr) 8008dffb485Schristos { 8018dffb485Schristos return breakpoint_kind_from_pc (pcptr); 8028dffb485Schristos } 8038dffb485Schristos 8048dffb485Schristos const char * 8058dffb485Schristos process_stratum_target::thread_name (ptid_t thread) 8068dffb485Schristos { 8078dffb485Schristos return nullptr; 8088dffb485Schristos } 8098dffb485Schristos 8108dffb485Schristos bool 8118dffb485Schristos process_stratum_target::thread_handle (ptid_t ptid, gdb_byte **handle, 8128dffb485Schristos int *handle_len) 8138dffb485Schristos { 8148dffb485Schristos return false; 8158dffb485Schristos } 8168dffb485Schristos 8174b169a6bSchristos thread_info * 8184b169a6bSchristos process_stratum_target::thread_pending_parent (thread_info *thread) 8194b169a6bSchristos { 8204b169a6bSchristos return nullptr; 8214b169a6bSchristos } 8224b169a6bSchristos 8234b169a6bSchristos thread_info * 824*f1c2b495Schristos process_stratum_target::thread_pending_child (thread_info *thread, 825*f1c2b495Schristos target_waitkind *kind) 8264b169a6bSchristos { 8274b169a6bSchristos return nullptr; 8284b169a6bSchristos } 8294b169a6bSchristos 8308dffb485Schristos bool 8318dffb485Schristos process_stratum_target::supports_software_single_step () 8328dffb485Schristos { 8338dffb485Schristos return false; 8348dffb485Schristos } 8358dffb485Schristos 8368dffb485Schristos bool 8378dffb485Schristos process_stratum_target::supports_catch_syscall () 8388dffb485Schristos { 8398dffb485Schristos return false; 8408dffb485Schristos } 8418dffb485Schristos 8428dffb485Schristos int 8438dffb485Schristos process_stratum_target::get_ipa_tdesc_idx () 8448dffb485Schristos { 8458dffb485Schristos return 0; 8468dffb485Schristos } 847