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

📄 gdbint.texinfo

📁 这个是LINUX下的GDB调度工具的源码
💻 TEXINFO
📖 第 1 页 / 共 5 页
字号:
bits in the mirror images of the debug registers.  It doesn't affectthe actual debug registers in the inferior process.@end table@noindent@strong{Notes:}@enumerate 1@itemx86 processors support setting watchpoints on I/O reads or writes.However, since no target supports this (as of March 2001), and since@code{enum target_hw_bp_type} doesn't even have an enumeration for I/Owatchpoints, this feature is not yet available to @value{GDBN} runningon x86.@itemx86 processors can enable watchpoints locally, for the current taskonly, or globally, for all the tasks.  For each debug register,there's a bit in the DR7 Debug Control register that determineswhether the associated address is watched locally or globally.  Thecurrent implementation of x86 watchpoint support in @value{GDBN}always sets watchpoints to be locally enabled, since globalwatchpoints might interfere with the underlying OS and are probablyunavailable in many platforms.@end enumerate@section Observing changes in @value{GDBN} internals@cindex observer pattern interface@cindex notifications about changes in internalsIn order to function properly, several modules need to be notified whensome changes occur in the @value{GDBN} internals.  Traditionally, thesemodules have relied on several paradigms, the most common ones beinghooks and gdb-events.  Unfortunately, none of these paradigms wasversatile enough to become the standard notification mechanism in@value{GDBN}.  The fact that they only supported one ``client'' was alsoa strong limitation.A new paradigm, based on the Observer pattern of the @cite{DesignPatterns} book, has therefore been implemented.  The goal was to providea new interface overcoming the issues with the notification mechanismspreviously available.  This new interface needed to be strongly typed,easy to extend, and versatile enough to be used as the standardinterface when adding new notifications.See @ref{GDB Observers} for a brief description of the observerscurrently implemented in GDB. The rationale for the currentimplementation is also briefly discussed.@node User Interface@chapter User Interface@value{GDBN} has several user interfaces.  Although the command-line interfaceis the most common and most familiar, there are others.@section Command Interpreter@cindex command interpreter@cindex CLIThe command interpreter in @value{GDBN} is fairly simple.  It is designed toallow for the set of commands to be augmented dynamically, and alsohas a recursive subcommand capability, where the first argument toa command may itself direct a lookup on a different command list.For instance, the @samp{set} command just starts a lookup on the@code{setlist} command list, while @samp{set thread} recursesto the @code{set_thread_cmd_list}.@findex add_cmd@findex add_comTo add commands in general, use @code{add_cmd}.  @code{add_com} adds tothe main command list, and should be used for those commands.  The usualplace to add commands is in the @code{_initialize_@var{xyz}} routines atthe ends of most source files.@findex add_setshow_cmd@findex add_setshow_cmd_fullTo add paired @samp{set} and @samp{show} commands, use@code{add_setshow_cmd} or @code{add_setshow_cmd_full}.  The former isa slightly simpler interface which is useful when you don't need tofurther modify the new command structures, while the latter returnsthe new command structures for manipulation.@cindex deprecating commands@findex deprecate_cmdBefore removing commands from the command set it is a good idea todeprecate them for some time.  Use @code{deprecate_cmd} on commands oraliases to set the deprecated flag.  @code{deprecate_cmd} takes a@code{struct cmd_list_element} as it's first argument.  You can use thereturn value from @code{add_com} or @code{add_cmd} to deprecate thecommand immediately after it is created.The first time a command is used the user will be warned and offered areplacement (if one exists). Note that the replacement string passed to@code{deprecate_cmd} should be the full name of the command, i.e. theentire string the user should type at the command line.@section UI-Independent Output---the @code{ui_out} Functions@c This section is based on the documentation written by Fernando@c Nasser <fnasser@redhat.com>.@cindex @code{ui_out} functionsThe @code{ui_out} functions present an abstraction level for the@value{GDBN} output code.  They hide the specifics of different userinterfaces supported by @value{GDBN}, and thus free the programmerfrom the need to write several versions of the same code, one each forevery UI, to produce output.@subsection Overview and TerminologyIn general, execution of each @value{GDBN} command produces some sortof output, and can even generate an input request.Output can be generated for the following purposes:@itemize @bullet@itemto display a @emph{result} of an operation;@itemto convey @emph{info} or produce side-effects of a requestedoperation;@itemto provide a @emph{notification} of an asynchronous event (includingprogress indication of a prolonged asynchronous operation);@itemto display @emph{error messages} (including warnings);@itemto show @emph{debug data};@itemto @emph{query} or prompt a user for input (a special case).@end itemize@noindentThis section mainly concentrates on how to build result output,although some of it also applies to other kinds of output.Generation of output that displays the results of an operationinvolves one or more of the following:@itemize @bullet@itemoutput of the actual data@itemformatting the output as appropriate for console output, to make iteasily readable by humans@itemmachine oriented formatting--a more terse formatting to allow for easyparsing by programs which read @value{GDBN}'s output@itemannotation, whose purpose is to help legacy GUIs to identify interestingparts in the output@end itemizeThe @code{ui_out} routines take care of the first three aspects.Annotations are provided by separate annotation routines.  Note that useof annotations for an interface between a GUI and @value{GDBN} isdeprecated.Output can be in the form of a single item, which we call a @dfn{field};a @dfn{list} consisting of identical fields; a @dfn{tuple} consisting ofnon-identical fields; or a @dfn{table}, which is a tuple consisting of aheader and a body.  In a BNF-like form:@table @code@item <table> @expansion{}@code{<header> <body>}@item <header> @expansion{}@code{@{ <column> @}}@item <column> @expansion{}@code{<width> <alignment> <title>}@item <body> @expansion{}@code{@{<row>@}}@end table@subsection General ConventionsMost @code{ui_out} routines are of type @code{void}, the exceptions are@code{ui_out_stream_new} (which returns a pointer to the newly createdobject) and the @code{make_cleanup} routines.The first parameter is always the @code{ui_out} vector object, a pointerto a @code{struct ui_out}.The @var{format} parameter is like in @code{printf} family of functions.When it is present, there must also be a variable list of argumentssufficient used to satisfy the @code{%} specifiers in the suppliedformat.When a character string argument is not used in a @code{ui_out} functioncall, a @code{NULL} pointer has to be supplied instead.@subsection Table, Tuple and List Functions@cindex list output functions@cindex table output functions@cindex tuple output functionsThis section introduces @code{ui_out} routines for building lists,tuples and tables.  The routines to output the actual data items(fields) are presented in the next section.To recap: A @dfn{tuple} is a sequence of @dfn{fields}, each fieldcontaining information about an object; a @dfn{list} is a sequence offields where each field describes an identical object.Use the @dfn{table} functions when your output consists of a list ofrows (tuples) and the console output should include a heading.  Use thiseven when you are listing just one object but you still want the header.@cindex nesting level in @code{ui_out} functionsTables can not be nested.  Tuples and lists can be nested up to amaximum of five levels.The overall structure of the table output code is something like this:@smallexample  ui_out_table_begin    ui_out_table_header    @dots{}    ui_out_table_body      ui_out_tuple_begin        ui_out_field_*        @dots{}      ui_out_tuple_end      @dots{}  ui_out_table_end@end smallexampleHere is the description of table-, tuple- and list-related @code{ui_out}functions:@deftypefun void ui_out_table_begin (struct ui_out *@var{uiout}, int @var{nbrofcols}, int @var{nr_rows}, const char *@var{tblid})The function @code{ui_out_table_begin} marks the beginning of the outputof a table.  It should always be called before any other @code{ui_out}function for a given table.  @var{nbrofcols} is the number of columns inthe table. @var{nr_rows} is the number of rows in the table.@var{tblid} is an optional string identifying the table.  The stringpointed to by @var{tblid} is copied by the implementation of@code{ui_out_table_begin}, so the application can free the string if itwas @code{malloc}ed.The companion function @code{ui_out_table_end}, described below, marksthe end of the table's output.@end deftypefun@deftypefun void ui_out_table_header (struct ui_out *@var{uiout}, int @var{width}, enum ui_align @var{alignment}, const char *@var{colhdr})@code{ui_out_table_header} provides the header information for a singletable column.  You call this function several times, one each for everycolumn of the table, after @code{ui_out_table_begin}, but before@code{ui_out_table_body}.The value of @var{width} gives the column width in characters.  Thevalue of @var{alignment} is one of @code{left}, @code{center}, and@code{right}, and it specifies how to align the header: left-justify,center, or right-justify it.  @var{colhdr} points to a string thatspecifies the column header; the implementation copies that string, socolumn header strings in @code{malloc}ed storage can be freed after thecall.@end deftypefun@deftypefun void ui_out_table_body (struct ui_out *@var{uiout})This function delimits the table header from the table body.@end deftypefun@deftypefun void ui_out_table_end (struct ui_out *@var{uiout})This function signals the end of a table's output.  It should be calledafter the table body has been produced by the list and field outputfunctions.There should be exactly one call to @code{ui_out_table_end} for eachcall to @code{ui_out_table_begin}, otherwise the @code{ui_out} functionswill signal an internal error.@end deftypefunThe output of the tuples that represent the table rows must follow thecall to @code{ui_out_table_body} and precede the call to@code{ui_out_table_end}.  You build a tuple by calling@code{ui_out_tuple_begin} and @code{ui_out_tuple_end}, with suitablecalls to functions which actually output fields between them.@deftypefun void ui_out_tuple_begin (struct ui_out *@var{uiout}, const char *@var{id})This function marks the beginning of a tuple output.  @var{id} pointsto an optional string that identifies the tuple; it is copied by theimplementation, and so strings in @code{malloc}ed storage can be freedafter the call.@end deftypefun@deftypefun void ui_out_tuple_end (struct ui_out *@var{uiout})This function signals an end of a tuple output.  There should be exactlyone call to @code{ui_out_tuple_end} for each call to@code{ui_out_tuple_begin}, otherwise an internal @value{GDBN} error willbe signaled.@end deftypefun@deftypefun struct cleanup *make_cleanup_ui_out_tuple_begin_end (struct ui_out *@var{uiout}, const char *@var{id})This function first opens the tuple and then establishes a cleanup(@pxref{Coding, Cleanups}) to close the tuple.  It provides a convenientand correct implementation of the non-portable@footnote{The functioncast is not portable ISO C.} code sequence:@smallexamplestruct cleanup *old_cleanup;ui_out_tuple_begin (uiout, "...");old_cleanup = make_cleanup ((void(*)(void *)) ui_out_tuple_end,                            uiout);@end smallexample@end deftypefun@deftypefun void ui_out_list_begin (struct ui_out *@var{uiout}, const char *@var{id})This function marks the beginning of a list output.  @var{id} points toan optional string that identifies the list; it is copied by theimplementation, and so strings in @code{malloc}ed storage can be freedafter the call.@end deftypefun@deftypefun void ui_out_list_end (struct ui_out *@var{uiout})This function signals an end of a list output.  There should be exactlyone call to @code{ui_out_list_end} for each call to@code{ui_out_list_begin}, otherwise an internal @value{GDBN} error willbe signaled.@end deftypefun@deftypefun struct cleanup *make_cleanup_ui_out_list_begin_end (struct ui_out *@var{uiout}, const char *@var{id})Similar to @code{make_cleanup_ui_out_tuple_begin_end}, this functionopens a list and then establishes cleanup (@pxref{Coding, Cleanups})that will close the list.list.@end deftypefun@subsection Item Output Functions

⌨️ 快捷键说明

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