⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 observer.texi

📁 这个是LINUX下的GDB调度工具的源码
💻 TEXI
字号:
@c -*-texinfo-*-@node GDB Observers@appendix @value{GDBN} Currently available observers@section Implementation rationale@cindex observers implementation rationaleAn @dfn{observer} is an entity which is interested in being notifiedwhen GDB reaches certain states, or certain events occur in GDB.The entity being observed is called the @dfn{subject}.  To receivenotifications, the observer attaches a callback to the subject.One subject can have several observers.@file{observer.c} implements an internal generic low-level eventnotification mechanism.  This generic event notification mechanism isthen re-used to implement the exported high-level notificationmanagement routines for all possible notifications.The current implementation of the generic observer provides supportfor contextual data.  This contextual data is given to the subjectwhen attaching the callback.  In return, the subject will providethis contextual data back to the observer as a parameter of thecallback.Note that the current support for the contextual data is only partial,as it lacks a mechanism that would deallocate this data when thecallback is detached.  This is not a problem so far, as this contextualdata is only used internally to hold a function pointer.  Later on, ifa certain observer needs to provide support for user-level contextualdata, then the generic notification mechanism will need to beenhanced to allow the observer to provide a routine to deallocate thedata when attaching the callback.The observer implementation is also currently not reentrant.In particular, it is therefore not possible to call the attachor detach routines during a notification.@section DebuggingObserver notifications can be traced using the command @samp{set debugobserver 1} (@pxref{Debugging Output, , Optional messages aboutinternal happenings, gdb, Debugging with @var{GDBN}}).@section @code{normal_stop} Notifications@cindex @code{normal_stop} observer@cindex notification about inferior execution stop@value{GDBN} notifies all @code{normal_stop} observers when theinferior execution has just stopped, the associated messages andannotations have been printed, and the control is about to be returnedto the user. Note that the @code{normal_stop} notification is not emitted whenthe execution stops due to a breakpoint, and this breakpoint hasa condition that is not met.  If the breakpoint has any associatedcommands list, the commands are executed after the notificationis emitted.The following interfaces are available to manage observers:@deftypefun extern struct observer *observer_attach_@var{event} (observer_@var{event}_ftype *@var{f})Using the function @var{f}, create an observer that is notified whenever @var{event} occures, return the observer.@end deftypefun@deftypefun extern void observer_detach_@var{event} (struct observer *@var{observer});Remove @var{observer} from the list of observers to be notified when@var{event} occurs.@end deftypefun@deftypefun extern void observer_notify_@var{event} (void);Send a notification to all @var{event} observers.@end deftypefunThe following observable events are defined:@c note: all events must take at least one parameter.@deftypefun void normal_stop (struct bpstats *@var{bs})The inferior has stopped for real.@end deftypefun@deftypefun void target_changed (struct target_ops *@var{target})The target's register contents have changed.@end deftypefun@deftypefun void inferior_created (struct target_ops *@var{objfile}, int @var{from_tty})@value{GDBN} has just connected to an inferior.  For @samp{run},@value{GDBN} calls this observer while the inferior is still stoppedat the entry-point instruction.  For @samp{attach} and @samp{core},@value{GDBN} calls this observer immediately after connecting to theinferior, and before any information on the inferior has been printed.@end deftypefun@deftypefun void solib_unloaded (struct so_list *@var{solib})The specified shared library has been discovered to be unloaded.@end deftypefun

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -