aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/event-loop.h
AgeCommit message (Collapse)AuthorFilesLines
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-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-08-18gdbsupport/event-loop: add a timeout parameter to gdb_do_one_eventPatrick Monnerat1-1/+1
Since commit b2d8657, having a per-interpreter event/command loop is not possible anymore. As Insight uses a GUI that has its own event loop, gdb and GUI event loops have then to be "merged" (i.e.: work together). But this is problematic as gdb_do_one_event is not aware of this alternate event loop and thus may wait forever. A solution is to delegate GUI events handling to the gdb events handler. Insight uses Tck/Tk as GUI and the latter offers a "notifier" feature to implement such a delegation. The Tcl notifier spec requires the event wait function to support a timeout parameter. Unfortunately gdb_do_one_event does not feature such a parameter. This timeout cannot be implemented externally with a gdb timer, because it would become an event by itself and thus can cause a legitimate event to be missed if the timeout is 0. Tcl implements "idle events" that are (internally) triggered only when no other event is pending. For this reason, it can call the event wait function with a 0 timeout quite often. This patch implements a wait timeout to gdb_do_one_event. The initial pending events monitoring is performed as before without the possibility to enter a wait state. If no pending event has been found during this phase, a timer is then created for the given timeout in order to re-use the implemented timeout logic and the event wait is then performed. This "internal" timer only limits the wait time and should never be triggered. It is deleted upon gdb_do_one_event exit. The new parameter defaults to "no timeout" (-1): as it is used by Insight only, there is no need to update calls from the gdb source tree.
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-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-12-11gdb: factor out debug_prefixed_printf_condSimon Marchi1-6/+2
The same pattern happens often to define a "debug_printf" macro: #define displaced_debug_printf(fmt, ...) \ do \ { \ if (debug_displaced) \ debug_prefixed_printf ("displaced", __func__, fmt, ##__VA_ARGS__); \ } \ while (0) Move this pattern behind a helper macro, debug_prefixed_printf_cond and update the existing macros to use it. gdb/ChangeLog: * displaced-stepping.h (displaced_debug_printf): Use debug_prefixed_printf_cond. * dwarf2/read.c (dwarf_read_debug_printf): Likewise. (dwarf_read_debug_printf_v): Likewise. * infrun.h (infrun_debug_printf): Likewise. * linux-nat.c (linux_nat_debug_printf): Likewise. gdbsupport/ChangeLog: * common-debug.h (debug_prefixed_printf_cond): New. * event-loop.h (event_loop_debug_printf): Use debug_prefixed_printf_cond. Change-Id: I1ff48b98b8d1cc405d1c7e8da8ceadf4e3a17f99
2020-10-31gdb, gdbsupport: add debug_prefixed_printf, remove boilerplate functionsSimon Marchi1-6/+6
The *_debug_print_1 functions are all very similar, the only difference being the subsystem name. Remove them all and make the logging macros use a new debug_prefixed_printf function directly. gdb/ChangeLog: * infrun.c (infrun_debug_printf_1): Remove. (displaced_debug_printf_1): Remove. (stop_all_threads): Use debug_prefixed_printf. * infrun.h (infrun_debug_printf_1): Remove. (infrun_debug_printf): Use debug_prefixed_printf. (displaced_debug_printf_1): Remove. (displaced_debug_printf): Use debug_prefixed_printf. * linux-nat.c (linux_nat_debug_printf_1): Remove. (linux_nat_debug_printf): Use debug_prefixed_printf. gdbsupport/ChangeLog: * common-debug.cc (debug_prefixed_printf): New. * common-debug.h (debug_prefixed_printf): New declaration. * event-loop.cc (event_loop_debug_printf_1): Remove. * event-loop.h (event_loop_debug_printf_1): Remove. (event_loop_debug_printf): Use debug_prefixed_printf. (event_loop_ui_debug_printf): Use debug_prefixed_printf. Change-Id: Ib323087c7257f0060121d302055c41eb64aa60c6
2020-10-02gdb: add debug prints in event loopSimon Marchi1-2/+42
Add debug printouts about event loop-related events: - When a file descriptor handler gets invoked - When an async event/signal handler gets invoked gdb/ChangeLog: * async-event.c (invoke_async_signal_handlers): Add debug print. (check_async_event_handlers): Likewise. * event-top.c (show_debug_event_loop): New function. (_initialize_event_top): Register "set debug event-loop" setting. gdbserver/ChangeLog: * server.cc (handle_monitor_command): Handle "set debug-event-loop". (captured_main): Handle "--debug-event-loop". (monitor_show_help): Mention new setting. (gdbserver_usage): Mention new flag. gdbsupport/ChangeLog: * event-loop.h (debug_event_loop): New variable declaration. (event_loop_debug_printf_1): New function declaration. (event_loop_debug_printf): New macro. * event-loop.cc (debug_event_loop): New variable. (handle_file_event): Add debug print. (event_loop_debug_printf_1): New function. Change-Id: If78ed3a69179881368e7895b42940ce13b6a1a05
2020-10-02gdb: give names to event loop file handlersSimon Marchi1-2/+12
Assign names to event loop file handlers. They will be used in debug messages when file handlers are invoked. In GDB, each UI used to get its own unique number, until commit cbe256847e19 ("Remove ui::num"). Re-introduce this field, and use it to make a unique name for the handler. I'm not too sure what goes on in ser-base.c, all I know is that it's what is used when debugging remotely. I've just named the main handler "serial". It would be good to have unique names there too. For instance when debugging with two different remote connections, we'd ideally want the handlers to have unique names. I didn't do it in this patch though. gdb/ChangeLog: * async-event.c (initialize_async_signal_handlers): Pass name to add_file_handler * event-top.c (ui_register_input_event_handler): Likewise. * linux-nat.c (linux_nat_target::async): Likewise. * run-on-main-thread.c (_initialize_run_on_main_thread): Likewise * ser-base.c (reschedule): Likewise. (ser_base_async): Likewise. * tui/tui-io.c: Likewise. * top.h (struct ui) <num>: New field. * top.c (highest_ui_num): New variable. (ui::ui): Initialize num. gdbserver/ChangeLog: * linux-low.cc (linux_process_target::async): Pass name to add_file_handler. * remote-utils.cc (handle_accept_event): Likewise. (remote_open): Likewise. gdbsupport/ChangeLog: * event-loop.h (add_file_handler): Add "name" parameter. * event-loop.cc (struct file_handler) <name>: New field. (create_file_handler): Add "name" parameter, assign it to file handler. (add_file_handler): Add "name" parameter. Change-Id: I9f1545f73888ebb6778eb653a618ca44d105f92c
2020-04-13Move event-loop.[ch] to gdbsupport/Tom Tromey1-0/+102
This moves event-loop.[ch] to gdbsupport/ and updates the uses in gdb. gdb/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * run-on-main-thread.c: Update include. * unittests/main-thread-selftests.c: Update include. * tui/tui-win.c: Update include. * tui/tui-io.c: Update include. * tui/tui-interp.c: Update include. * tui/tui-hooks.c: Update include. * top.h: Update include. * top.c: Update include. * ser-base.c: Update include. * remote.c: Update include. * remote-notif.c: Update include. * remote-fileio.c: Update include. * record-full.c: Update include. * record-btrace.c: Update include. * python/python.c: Update include. * posix-hdep.c: Update include. * mingw-hdep.c: Update include. * mi/mi-main.c: Update include. * mi/mi-interp.c: Update include. * main.c: Update include. * linux-nat.c: Update include. * interps.c: Update include. * infrun.c: Update include. * inf-loop.c: Update include. * event-top.c: Update include. * event-loop.c: Move to ../gdbsupport/. * event-loop.h: Move to ../gdbsupport/. * async-event.h: Update include. * Makefile.in (COMMON_SFILES, HFILES_NO_SRCDIR): Update. gdbsupport/ChangeLog 2020-04-13 Tom Tromey <tom@tromey.com> * event-loop.h: Move from ../gdb/. * event-loop.cc: Move from ../gdb/.