aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/mem-break.cc
AgeCommit message (Collapse)AuthorFilesLines
2024-03-26gdb, gdbserver, gdbsupport: remove includes of early headersSimon Marchi1-1/+0
Now that defs.h, server.h and common-defs.h are included via the `-include` option, it is no longer necessary for source files to include them. Remove all the inclusions of these files I could find. Update the generation scripts where relevant. Change-Id: Ia026cff269c1b7ae7386dd3619bc9bb6a5332837 Approved-By: Pedro Alves <pedro@palves.net>
2024-02-26gdb: Modify the output of "info breakpoints" and "delete breakpoints"Tiezhu Yang1-3/+4
The output of "info breakpoints" includes breakpoint, watchpoint, tracepoint, and catchpoint if they are created, so it should show all the four types are deleted in the output of "info breakpoints" to report empty list after "delete breakpoints". It should also change the output of "delete breakpoints" to make it clear that watchpoints, tracepoints, and catchpoints are also being deleted. This is suggested by Guinevere Larsen, thank you. $ make check-gdb TESTS="gdb.base/access-mem-running.exp" $ gdb/gdb gdb/testsuite/outputs/gdb.base/access-mem-running/access-mem-running [...] (gdb) break main Breakpoint 1 at 0x12000073c: file /home/loongson/gdb.git/gdb/testsuite/gdb.base/access-mem-running.c, line 32. (gdb) watch global_counter Hardware watchpoint 2: global_counter (gdb) trace maybe_stop_here Tracepoint 3 at 0x12000071c: file /home/loongson/gdb.git/gdb/testsuite/gdb.base/access-mem-running.c, line 27. (gdb) catch fork Catchpoint 4 (fork) (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x000000012000073c in main at /home/loongson/gdb.git/gdb/testsuite/gdb.base/access-mem-running.c:32 2 hw watchpoint keep y global_counter 3 tracepoint keep y 0x000000012000071c in maybe_stop_here at /home/loongson/gdb.git/gdb/testsuite/gdb.base/access-mem-running.c:27 not installed on target 4 catchpoint keep y fork Without this patch: (gdb) delete breakpoints Delete all breakpoints? (y or n) y (gdb) info breakpoints No breakpoints or watchpoints. (gdb) info breakpoints 3 No breakpoint or watchpoint matching '3'. With this patch: (gdb) delete breakpoints Delete all breakpoints, watchpoints, tracepoints, and catchpoints? (y or n) y (gdb) info breakpoints No breakpoints, watchpoints, tracepoints, or catchpoints. (gdb) info breakpoints 3 No breakpoint, watchpoint, tracepoint, or catchpoint matching '3'. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Approved-by: Kevin Buettner <kevinb@redhat.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-10-26gdb: handle main thread exiting during detachAndrew Burgess1-0/+11
Overview ======== Consider the following situation, GDB is in non-stop mode, the main thread is running while a second thread is stopped. The user has the second thread selected as the current thread and asks GDB to detach. At the exact moment of detach the main thread exits. This situation currently causes crashes, assertion failures, and unexpected errors to be reported from GDB for both native and remote targets. This commit addresses this situation for native and remote targets. There are a number of different fixes, but all are required in order to get this functionality working correct for native and remote targets. Native Linux Target =================== For the native Linux target, detaching is handled in the function linux_nat_target::detach. In here we call stop_wait_callback for each thread, and it is this callback that will spot that the main thread has exited. GDB then detaches from everything except the main thread by calling detach_callback. After this the first problem is this assert: /* Only the initial process should be left right now. */ gdb_assert (num_lwps (pid) == 1); The num_lwps call will return 0 as the main thread has exited and all of the other threads have now been detached. I fix this by changing the assert to allow for 0 or 1 lwps at this point. As the 0 case can only happen in non-stop mode, the assert becomes: gdb_assert (num_lwps (pid) == 1 || (target_is_non_stop_p () && num_lwps (pid) == 0)); The next problem is that we do: main_lwp = find_lwp_pid (ptid_t (pid)); and then proceed assuming that main_lwp is not nullptr. In the case that the main thread has exited though, main_lwp will be nullptr. However, we only need main_lwp so that GDB can detach from the thread. If the main thread has exited, and GDB has already detached from every other thread, then GDB has finished detaching, GDB can skip the calls that try to detach from the main thread, and then tell the user that the detach was a success. For Remote Targets ================== On remote targets there are two problems. First is that when the exit occurs during the early phase of the detach, we see the stop notification arrive while GDB is removing the breakpoints ahead of the detach. The 'set debug remote on' trace looks like this: [remote] Sending packet: $z0,7f1648fe0241,1#35 [remote] Notification received: Stop:W0;process:2a0ac8 # At this point an unpatched gdbserver segfaults, and the connection # is broken. A patched gdbserver continues as below... [remote] Packet received: E01 [remote] Sending packet: $z0,7f1648ff00a8,1#68 [remote] Packet received: E01 [remote] Sending packet: $z0,7f1648ff132f,1#6b [remote] Packet received: E01 [remote] Sending packet: $D;2a0ac8#3e [remote] Packet received: E01 I was originally running into Segmentation Faults, from within gdbserver/mem-break.cc, in the function find_gdb_breakpoint. This function calls current_process() and then dereferences the result to find the breakpoint list. However, in our case, the current process has already exited, and so the current_process() call returns nullptr. At the point of failure, the gdbserver backtrace looks like this: #0 0x00000000004190e4 in find_gdb_breakpoint (z_type=48 '0', addr=4198762, kind=1) at ../../src/gdbserver/mem-break.cc:982 #1 0x000000000041930d in delete_gdb_breakpoint (z_type=48 '0', addr=4198762, kind=1) at ../../src/gdbserver/mem-break.cc:1093 #2 0x000000000042d8db in process_serial_event () at ../../src/gdbserver/server.cc:4372 #3 0x000000000042dcab in handle_serial_event (err=0, client_data=0x0) at ../../src/gdbserver/server.cc:4498 ... The problem is that, as a result non-stop being on, the process exiting is only reported back to GDB after the request to remove a breakpoint has been sent. Clearly gdbserver can't actually remove this breakpoint -- the process has already exited -- so I think the best solution is for gdbserver just to report an error, which is what I've done. The second problem I ran into was on the gdb side, as the process has already exited, but GDB has not yet acknowledged the exit event, the detach -- the 'D' packet in the above trace -- fails. This was being reported to the user with a 'Can't detach process' error. As the test actually calls detach from Python code, this error was then becoming a Python exception. Though clearly the detach has returned an error, and so, maybe, having GDB throw an error would be fine, I think in this case, there's a good argument that the remote error can be ignored -- if GDB tries to detach and gets back an error, and if there's a pending exit event for the pid we tried to detach, then just ignore the error and pretend the detach worked fine. We could possibly check for a pending exit event before sending the detach packet, however, I believe that it might be possible (in non-stop mode) for the stop notification to arrive after the detach is sent, but before gdbserver has started processing the detach. In this case we would still need to check for pending stop events after seeing the detach fail, so I figure there's no point having two checks -- we just send the detach request, and if it fails, check to see if the process has already exited. Testing ======= In order to test this issue I needed to ensure that the exit event arrives at the same time as the detach call. The window of opportunity for getting the exit to arrive is so small I've never managed to trigger this in real use -- I originally spotted this issue while working on another patch, which did manage to trigger this issue. However, if we trigger both the exit and the detach from a single Python function then we never return to GDB's event loop, as such GDB never processes the exit event, and so the first time GDB gets a chance to see the exit is during the detach call. And so that is the approach I've taken for testing this patch. Tested-By: Kevin Buettner <kevinb@redhat.com> Approved-By: Kevin Buettner <kevinb@redhat.com>
2023-06-03[gdb] Fix typosTom de Vries1-1/+1
Fix a few typos: - implemention -> implementation - convertion(s) -> conversion(s) - backlashes -> backslashes - signoring -> ignoring - (un)ambigious -> (un)ambiguous - occured -> occurred - hidding -> hiding - temporarilly -> temporarily - immediatelly -> immediately - sillyness -> silliness - similiar -> similar - porkuser -> pokeuser - thats -> that - alway -> always - supercede -> supersede - accomodate -> accommodate - aquire -> acquire - priveleged -> privileged - priviliged -> privileged - priviledges -> privileges - privilige -> privilege - recieve -> receive - (p)refered -> (p)referred - succesfully -> successfully - successfuly -> successfully - responsability -> responsibility - wether -> whether - wich -> which - disasbleable -> disableable - descriminant -> discriminant - construcstor -> constructor - underlaying -> underlying - underyling -> underlying - structureal -> structural - appearences -> appearances - terciarily -> tertiarily - resgisters -> registers - reacheable -> reachable - likelyhood -> likelihood - intepreter -> interpreter - disassemly -> disassembly - covnersion -> conversion - conviently -> conveniently - atttribute -> attribute - struction -> struct - resonable -> reasonable - popupated -> populated - namespaxe -> namespace - intialize -> initialize - identifer(s) -> identifier(s) - expection -> exception - exectuted -> executed - dungerous -> dangerous - dissapear -> disappear - completly -> completely - (inter)changable -> (inter)changeable - beakpoint -> breakpoint - automativ -> automatic - alocating -> allocating - agressive -> aggressive - writting -> writing - reguires -> requires - registed -> registered - recuding -> reducing - opeartor -> operator - ommitted -> omitted - modifing -> modifying - intances -> instances - imbedded -> embedded - gdbaarch -> gdbarch - exection -> execution - direcive -> directive - demanged -> demangled - decidely -> decidedly - argments -> arguments - agrument -> argument - amespace -> namespace - targtet -> target - supress(ed) -> suppress(ed) - startum -> stratum - squence -> sequence - prompty -> prompt - overlow -> overflow - memember -> member - languge -> language - geneate -> generate - funcion -> function - exising -> existing - dinking -> syncing - destroh -> destroy - clenaed -> cleaned - changep -> changedp (name of variable) - arround -> around - aproach -> approach - whould -> would - symobl -> symbol - recuse -> recurse - outter -> outer - freeds -> frees - contex -> context Tested on x86_64-linux. Reviewed-By: Tom Tromey <tom@tromey.com>
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-10-19internal_error: remove need to pass __FILE__/__LINE__Pedro Alves1-2/+1
Currently, every internal_error call must be passed __FILE__/__LINE__ explicitly, like: internal_error (__FILE__, __LINE__, "foo %d", var); The need to pass in explicit __FILE__/__LINE__ is there probably because the function predates widespread and portable variadic macros availability. We can use variadic macros nowadays, and in fact, we already use them in several places, including the related gdb_assert_not_reached. So this patch renames the internal_error function to something else, and then reimplements internal_error as a variadic macro that expands __FILE__/__LINE__ itself. The result is that we now should call internal_error like so: internal_error ("foo %d", var); Likewise for internal_warning. The patch adjusts all calls sites. 99% of the adjustments were done with a perl/sed script. The non-mechanical changes are in gdbsupport/errors.h, gdbsupport/gdb_assert.h, and gdb/gdbarch.py. Approved-By: Simon Marchi <simon.marchi@efficios.com> Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
2022-04-14gdbserver: Eliminate prepare_to_access_memoryPedro Alves1-87/+14
Given: - The prepare_to_access_memory machinery was added for non-stop mode. - Only Linux supports non-stop. - Linux no longer needs the prepare_to_access_memory machinery. In fact, after the previous patch, linux_process_target::prepare_to_access_memory became a nop. Thus, prepare_to_access_memory can go away, simplifying core GDBserver code. Change-Id: I93ac8bfe66bd61c3d1c4a0e7d419335163120ecf
2022-01-18gdbserver: introduce threads_debug_printf, THREADS_SCOPED_DEBUG_ENTER_EXITSimon Marchi1-73/+55
Add the threads_debug_printf and THREADS_SCOPED_DEBUG_ENTER_EXIT, which use the logging infrastructure from gdbsupport/common-debug.h. Replace all debug_print uses that are predicated by debug_threads with threads_dethreads_debug_printf. Replace uses of the debug_enter and debug_exit macros with THREADS_SCOPED_DEBUG_ENTER_EXIT, which serves essentially the same purpose, but allows showing what comes between the enter and the exit in an indented form. Note that "threads" debug is currently used for a bit of everything in GDBserver, not only threads related stuff. It should ideally be cleaned up and separated logically as is done in GDB, but that's out of the scope of this patch. Change-Id: I2d4546464462cb4c16f7f1168c5cec5a89f2289a
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-12-13gdbserver: replace direct assignments to current_threadTankut Baris Aktemur1-9/+6
Replace the direct assignments to current_thread with switch_to_thread. Use scoped_restore_current_thread when appropriate. There is one instance remaining in linux-low.cc's wait_for_sigstop. This will be handled in a separate patch. Regression-tested on X86-64 Linux using the native-gdbserver and native-extended-gdbserver board files.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-02-20gdbserver: finish turning the target ops vector into a classTankut Baris Aktemur1-11/+11
Now that 'process_stratum_target' has a single field left, namely 'pt' of type 'process_target', and that all the requests to a 'process_stratum_target' are forwarded to 'pt', meld the 'process_target' class into 'process_stratum_target'. This essentially means 1. All the references of the form 'the_target->pt' become 'the_target'. 2. All the uses of the name 'process_target' become 'process_stratum_target'. 3. The platform-specific target op vectors (e.g. linux_target_ops) are removed and instances of their "process target" classes are used instead. gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * target.h (struct process_stratum_target): Remove. (class process_target): Rename to ... (class process_stratum_target): ... this. * linux-low.h (class linux_process_target): Derive from 'process_stratum_target'. * linux-low.cc (linux_target_ops): Remove. (initialize_low): Set the_target to the singleton instance of linux_process_target. * lynx-low.h (class lynx_process_target): Derive from 'process_stratum_target'. * lynx-low.cc (lynx_target_ops): Remove. (initialize_low): Set the_target to the singleton instance of lynx_process_target. * nto-low.h (class nto_process_target): Derive from 'process_stratum_target'. * nto-low.cc (nto_target_ops): Remove. (initialize_low): Set the_target to the singleton instance of nto_process_target. * win32-low.h (class win32_process_target): Derive from 'process_stratum_target'. * win32-low.cc (win32_target_ops): Remove. (initialize_low): Set the_target to the singleton instance of win32_process_target. Replace 'the_target->pt' with 'the_target' in the uses below. * hostio.cc (hostio_error) (handle_setfs) (handle_open) (handle_unlink) (handle_readlink) * linux-aarch32-low.cc (arm_breakpoint_at) * linux-aarch64-low.cc (aarch64_breakpoint_at) * linux-arm-low.cc (arm_sigreturn_next_pc) (arm_get_hwcap) (arm_get_syscall_trapinfo) * linux-cris-low.cc (cris_breakpoint_at) * linux-crisv32-low.cc (cris_breakpoint_at) * linux-low.cc (handle_extended_wait) (linux_wait_1) (linux_read_memory) (linux_process_target::breakpoint_kind_from_pc) (linux_get_auxv) * linux-m32r-low.cc (m32r_breakpoint_at) * linux-mips-low.cc (mips_breakpoint_at) * linux-nios2-low.cc (nios2_breakpoint_at) * linux-ppc-low.cc (ppc_breakpoint_at) * linux-s390-low.cc (s390_get_hwcap) * linux-sh-low.cc (sh_breakpoint_at) * linux-sparc-low.cc (sparc_fill_gregset_to_stack) (sparc_store_gregset_from_stack) (sparc_breakpoint_at) * linux-tic6x-low.cc (tic6x_breakpoint_at) * linux-tile-low.cc (tile_breakpoint_at) * linux-x86-low.cc (x86_breakpoint_at) * linux-xtensa-low.cc (xtensa_breakpoint_at) * mem-break.cc (bp_size) (bp_opcode) (insert_memory_breakpoint) (set_raw_breakpoint_at) (delete_raw_breakpoint) (z_type_supported) (uninsert_raw_breakpoint) (reinsert_raw_breakpoint) (validate_inserted_breakpoint) * regcache.cc (regcache_read_pc) (regcache_write_pc) * remote-utils.cc (putpkt_binary_1) (input_interrupt) (getpkt) (prepare_resume_reply) * server.cc (handle_general_set) (handle_detach) (handle_qxfer_auxv) (handle_qxfer_exec_file) (handle_qxfer_libraries_svr4) (handle_qxfer_osdata) (handle_qxfer_siginfo) (handle_qxfer_fdpic) (handle_query) (resume) (handle_v_requests) (queue_stop_reply_callback) (captured_main) * target.cc (prepare_to_access_memory) (done_accessing_memory) (read_inferior_memory) (target_write_memory) (target_stop_and_wait) (target_wait) (target_mourn_inferior) (target_continue_no_signal) (target_continue) (target_supports_multi_process) (kill_inferior) * target.h (target_create_inferior) (target_post_create_inferior) (myattach) (target_supports_fork_events) (target_supports_vfork_events) (target_supports_exec_events) (target_handle_new_gdb_connection) (detach_inferior) (mythread_alive) (fetch_inferior_registers) (store_inferior_registers) (join_inferior) (target_supports_non_stop) (target_async) (target_process_qsupported) (target_supports_catch_syscall) (target_get_ipa_tdesc_idx) (target_supports_tracepoints) (target_supports_fast_tracepoints) (target_get_min_fast_tracepoint_insn_len) (target_thread_stopped) (target_pause_all) (target_unpause_all) (target_stabilize_threads) (target_install_fast_tracepoint_jump_pad) (target_emit_ops) (target_supports_disable_randomization) (target_supports_agent) (target_enable_btrace) (target_disable_btrace) (target_read_btrace) (target_read_btrace_conf) (target_supports_range_stepping) (target_supports_stopped_by_sw_breakpoint) (target_stopped_by_sw_breakpoint) (target_supports_stopped_by_hw_breakpoint) (target_supports_hardware_single_step) (target_stopped_by_hw_breakpoint) (target_breakpoint_kind_from_pc) (target_breakpoint_kind_from_current_state) (target_supports_software_single_step) (target_core_of_thread) (target_thread_name) (target_thread_handle) * win32-low.cc (do_initial_child_stuff) Rename target op default definitions listed below. * target.cc (process_target::post_create_inferior): Rename as ... (process_stratum_target::post_create_inferior): ... this. (process_target::prepare_to_access_memory): Rename as ... (process_stratum_target::prepare_to_access_memory): ... this. (process_target::done_accessing_memory): Rename as ... (process_stratum_target::done_accessing_memory): ... this. (process_target::look_up_symbols): Rename as ... (process_stratum_target::look_up_symbols): ... this. (process_target::supports_read_auxv): Rename as ... (process_stratum_target::supports_read_auxv): ... this. (process_target::read_auxv): Rename as ... (process_stratum_target::read_auxv): ... this. (process_target::supports_z_point_type): Rename as ... (process_stratum_target::supports_z_point_type): ... this. (process_target::insert_point): Rename as ... (process_stratum_target::insert_point): ... this. (process_target::remove_point): Rename as ... (process_stratum_target::remove_point): ... this. (process_target::stopped_by_sw_breakpoint): Rename as ... (process_stratum_target::stopped_by_sw_breakpoint): ... this. (process_target::supports_stopped_by_sw_breakpoint): Rename as ... (process_stratum_target::supports_stopped_by_sw_breakpoint): ... this. (process_target::stopped_by_hw_breakpoint): Rename as ... (process_stratum_target::stopped_by_hw_breakpoint): ... this. (process_target::supports_stopped_by_hw_breakpoint): Rename as ... (process_stratum_target::supports_stopped_by_hw_breakpoint): ... this. (process_target::supports_hardware_single_step): Rename as ... (process_stratum_target::supports_hardware_single_step): ... this. (process_target::stopped_by_watchpoint): Rename as ... (process_stratum_target::stopped_by_watchpoint): ... this. (process_target::stopped_data_address): Rename as ... (process_stratum_target::stopped_data_address): ... this. (process_target::supports_read_offsets): Rename as ... (process_stratum_target::supports_read_offsets): ... this. (process_target::read_offsets): Rename as ... (process_stratum_target::read_offsets): ... this. (process_target::supports_get_tls_address): Rename as ... (process_stratum_target::supports_get_tls_address): ... this. (process_target::get_tls_address): Rename as ... (process_stratum_target::get_tls_address): ... this. (process_target::hostio_last_error): Rename as ... (process_stratum_target::hostio_last_error): ... this. (process_target::supports_qxfer_osdata): Rename as ... (process_stratum_target::supports_qxfer_osdata): ... this. (process_target::qxfer_osdata): Rename as ... (process_stratum_target::qxfer_osdata): ... this. (process_target::supports_qxfer_siginfo): Rename as ... (process_stratum_target::supports_qxfer_siginfo): ... this. (process_target::qxfer_siginfo): Rename as ... (process_stratum_target::qxfer_siginfo): ... this. (process_target::supports_non_stop): Rename as ... (process_stratum_target::supports_non_stop): ... this. (process_target::async): Rename as ... (process_stratum_target::async): ... this. (process_target::start_non_stop): Rename as ... (process_stratum_target::start_non_stop): ... this. (process_target::supports_multi_process): Rename as ... (process_stratum_target::supports_multi_process): ... this. (process_target::supports_fork_events): Rename as ... (process_stratum_target::supports_fork_events): ... this. (process_target::supports_vfork_events): Rename as ... (process_stratum_target::supports_vfork_events): ... this. (process_target::supports_exec_events): Rename as ... (process_stratum_target::supports_exec_events): ... this. (process_target::handle_new_gdb_connection): Rename as ... (process_stratum_target::handle_new_gdb_connection): ... this. (process_target::handle_monitor_command): Rename as ... (process_stratum_target::handle_monitor_command): ... this. (process_target::core_of_thread): Rename as ... (process_stratum_target::core_of_thread): ... this. (process_target::supports_read_loadmap): Rename as ... (process_stratum_target::supports_read_loadmap): ... this. (process_target::read_loadmap): Rename as ... (process_stratum_target::read_loadmap): ... this. (process_target::process_qsupported): Rename as ... (process_stratum_target::process_qsupported): ... this. (process_target::supports_tracepoints): Rename as ... (process_stratum_target::supports_tracepoints): ... this. (process_target::read_pc): Rename as ... (process_stratum_target::read_pc): ... this. (process_target::write_pc): Rename as ... (process_stratum_target::write_pc): ... this. (process_target::supports_thread_stopped): Rename as ... (process_stratum_target::supports_thread_stopped): ... this. (process_target::thread_stopped): Rename as ... (process_stratum_target::thread_stopped): ... this. (process_target::supports_get_tib_address): Rename as ... (process_stratum_target::supports_get_tib_address): ... this. (process_target::get_tib_address): Rename as ... (process_stratum_target::get_tib_address): ... this. (process_target::pause_all): Rename as ... (process_stratum_target::pause_all): ... this. (process_target::unpause_all): Rename as ... (process_stratum_target::unpause_all): ... this. (process_target::stabilize_threads): Rename as ... (process_stratum_target::stabilize_threads): ... this. (process_target::supports_fast_tracepoints): Rename as ... (process_stratum_target::supports_fast_tracepoints): ... this. (process_target::get_min_fast_tracepoint_insn_len): Rename as ... (process_stratum_target::get_min_fast_tracepoint_insn_len): ... this. (process_target::emit_ops): Rename as ... (process_stratum_target::emit_ops): ... this. (process_target::supports_disable_randomization): Rename as ... (process_stratum_target::supports_disable_randomization): ... this. (process_target::supports_qxfer_libraries_svr4): Rename as ... (process_stratum_target::supports_qxfer_libraries_svr4): ... this. (process_target::qxfer_libraries_svr4): Rename as ... (process_stratum_target::qxfer_libraries_svr4): ... this. (process_target::supports_agent): Rename as ... (process_stratum_target::supports_agent): ... this. (process_target::enable_btrace): Rename as ... (process_stratum_target::enable_btrace): ... this. (process_target::disable_btrace): Rename as ... (process_stratum_target::disable_btrace): ... this. (process_target::read_btrace): Rename as ... (process_stratum_target::read_btrace): ... this. (process_target::read_btrace_conf): Rename as ... (process_stratum_target::read_btrace_conf): ... this. (process_target::supports_range_stepping): Rename as ... (process_stratum_target::supports_range_stepping): ... this. (process_target::supports_pid_to_exec_file): Rename as ... (process_stratum_target::supports_pid_to_exec_file): ... this. (process_target::pid_to_exec_file): Rename as ... (process_stratum_target::pid_to_exec_file): ... this. (process_target::supports_multifs): Rename as ... (process_stratum_target::supports_multifs): ... this. (process_target::multifs_open): Rename as ... (process_stratum_target::multifs_open): ... this. (process_target::multifs_unlink): Rename as ... (process_stratum_target::multifs_unlink): ... this. (process_target::multifs_readlink): Rename as ... (process_stratum_target::multifs_readlink): ... this. (process_target::breakpoint_kind_from_pc): Rename as ... (process_stratum_target::breakpoint_kind_from_pc): ... this. (process_target::breakpoint_kind_from_current_state): Rename as ... (process_stratum_target::breakpoint_kind_from_current_state): ... this. (process_target::thread_name): Rename as ... (process_stratum_target::thread_name): ... this. (process_target::thread_handle): Rename as ... (process_stratum_target::thread_handle): ... this. (process_target::supports_software_single_step): Rename as ... (process_stratum_target::supports_software_single_step): ... this. (process_target::supports_catch_syscall): Rename as ... (process_stratum_target::supports_catch_syscall): ... this. (process_target::get_ipa_tdesc_idx): Rename as ... (process_stratum_target::get_ipa_tdesc_idx): ... this.
2020-02-20gdbserver: turn breakpoint kind-related target ops into methodsTankut Baris Aktemur1-2/+2
gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's breakpoint_kind_from_pc, sw_breakpoint_from_kind, and breakpoint_kind_from_current_state ops into methods of process_target. * target.h (struct process_stratum_target): Remove the target op. (class process_target): Add the target op. (target_breakpoint_kind_from_pc): Update the macro. (target_breakpoint_kind_from_current_state): Update the macro. (default_breakpoint_kind_from_pc): Remove declaration. * target.cc (default_breakpoint_kind_from_pc): Turn into ... (process_target::breakpoint_kind_from_pc): ... this. (process_target::breakpoint_kind_from_current_state): Define. Update the derived classes and callers below. * mem-break.cc (bp_size): Update. (bp_opcode): Update. * linux-low.cc (linux_target_ops): Update. (linux_wait_1): Update. (linux_breakpoint_kind_from_pc): Turn into ... (linux_process_target::breakpoint_kind_from_pc): ... this. (linux_sw_breakpoint_from_kind): Turn into ... (linux_process_target::sw_breakpoint_from_kind): ... this. (linux_breakpoint_kind_from_current_state): Turn into ... (linux_process_target::breakpoint_kind_from_current_state): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. (lynx_process_target::sw_breakpoint_from_kind): Define. * lynx-low.h (class lynx_process_target): Update. * nto-low.cc (nto_target_ops): Update. (nto_sw_breakpoint_from_kind): Turn into ... (nto_process_target::sw_breakpoint_from_kind): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_sw_breakpoint_from_kind): Turn into ... (win32_process_target::sw_breakpoint_from_kind): ... this. * win32-low.h (class win32_process_target): Update.
2020-02-20gdbserver: turn target ops 'insert_point' and 'remove_point' into methodsTankut Baris Aktemur1-5/+5
gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's insert_point and remove_point ops into methods of process_target. * target.h (struct process_stratum_target): Remove the target ops. (class process_target): Add the target ops. * target.cc (process_target::insert_point): Define. (process_target::remove_point): Define. Update the derived classes and callers below. * mem-break.cc (set_raw_breakpoint_at): Update. (delete_raw_breakpoint): Update. (uninsert_raw_breakpoint): Update. (reinsert_raw_breakpoint): Update. * linux-low.cc (linux_target_ops): Update. (linux_insert_point): Turn into ... (linux_process_target::insert_point): ... this. (linux_remove_point): Turn into ... (linux_process_target::remove_point): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. * nto-low.cc (nto_target_ops): Update. (nto_insert_point): Turn into ... (nto_process_target::insert_point): ... this. (nto_remove_point): Turn into ... (nto_process_target::remove_point): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_insert_point): Turn into ... (win32_process_target::insert_point): ... this. (win32_remove_point): Turn into ... (win32_process_target::remove_point): ... this. * win32-low.h (class win32_process_target): Update.
2020-02-20gdbserver: turn target op 'supports_z_point_type' into a methodTankut Baris Aktemur1-2/+1
gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's supports_z_point_type op into a method of process_target. * target.h (struct process_stratum_target): Remove the target op. (class process_target): Add the target op. * target.cc (process_target::supports_z_point_type): Define. Update the derived classes and callers below. * mem-break.cc (z_type_supported): Update. * linux-low.cc (linux_target_ops): Update. (linux_supports_z_point_type): Turn into ... (linux_process_target::supports_z_point_type): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. * nto-low.cc (nto_target_ops): Update. (nto_supports_z_point_type): Turn into ... (nto_process_target::supports_z_point_type): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_supports_z_point_type): Turn into ... (win32_process_target::supports_z_point_type): ... this. * win32-low.h (class win32_process_target): Update.
2020-02-20gdbserver: turn target ops 'read_memory' and 'write_memory' into methodsTankut Baris Aktemur1-3/+3
gdbserver/ChangeLog: 2020-02-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn process_stratum_target's read_memory and write_memory ops into methods of process_target. * target.h (struct process_stratum_target): Remove the target ops. (class process_target): Add the target ops. Update the derived classes and callers below. * linux-aarch32-low.cc (arm_breakpoint_at): Update. * linux-aarch64-low.cc (aarch64_breakpoint_at): Update. * linux-arm-low.cc (arm_sigreturn_next_pc): Update. (arm_get_syscall_trapinfo): Update. * linux-cris-low.cc (cris_breakpoint_at): Update. * linux-crisv32-low.cc (cris_breakpoint_at): Update. * linux-m32r-low.cc (m32r_breakpoint_at): Update. * linux-mips-low.cc (mips_breakpoint_at): Update. * linux-nios2-low.cc (nios2_breakpoint_at): Update. * linux-ppc-low.cc (ppc_breakpoint_at): Update. * linux-sh-low.cc (sh_breakpoint_at): Update. * linux-sparc-low.cc (sparc_fill_gregset_to_stack): Update. (sparc_store_gregset_from_stack): Update. (sparc_breakpoint_at): Update. * linux-tic6x-low.cc (tic6x_breakpoint_at): Update. * linux-tile-low.cc (tile_breakpoint_at): Update. * linux-x86-low.cc (x86_breakpoint_at): Update. * linux-xtensa-low.cc (xtensa_breakpoint_at): Update. * mem-brea.cc (insert_memory_breakpoint): Update. (validate_inserted_breakpoint): Update. * target.cc (read_inferior_memory): Update. (target_write_memory): Update. * linux-low.cc (linux_target_ops): Update. (linux_read_memory): Make a wrapper around the read_memory target op call. (linux_process_target::read_memory): Rename from linux_read_memory. (linux_write_memory): Turn into ... (linux_process_target::write_memory): ... this. * linux-low.h (class linux_process_target): Update. * lynx-low.cc (lynx_target_ops): Update. (lynx_read_memory): Turn into ... (lynx_process_target::read_memory): ... this. (lynx_write_memory): Turn into ... (lynx_process_target::write_memory): ... this. * lynx-low.h (class lynx_process_target): Update. * nto-low.cc (nto_target_ops): Update. (nto_read_memory): Turn into ... (nto_process_target::read_memory): ... this. (nto_write_memory): Turn into ... (nto_process_target::write_memory): ... this. * nto-low.h (class nto_process_target): Update. * win32-low.cc (win32_target_ops): Update. (win32_read_inferior_memory): Turn into ... (win32_process_target::read_memory): ... this. (win32_write_inferior_memory): Turn into ... (win32_process_target::write_memory): ... this. * win32-low.h (class win32_process_target): Update.
2020-02-13gdbserver: rename source files to .ccSimon Marchi1-0/+2237
For the same reasons outlined in the previous patch, this patch renames gdbserver source files to .cc. I have moved the "-x c++" switch to only those rules that require it. gdbserver/ChangeLog: * Makefile.in: Rename source files from .c to .cc. * %.c: Rename to %.cc. * configure.ac: Rename server.c to server.cc. * configure: Re-generate.