diff options
author | Eli Zaretskii <eliz@gnu.org> | 2019-03-30 12:58:33 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2019-03-30 12:58:33 +0300 |
commit | 7734102d6d8b5a0ccea166f8e944f84dc896b9ae (patch) | |
tree | d5badcb54e32b5979a785ef7ead0254d5fc2658d /gdb | |
parent | c6f03bce79fd93f152749e2a299a03ab78421f5f (diff) | |
download | gdb-7734102d6d8b5a0ccea166f8e944f84dc896b9ae.zip gdb-7734102d6d8b5a0ccea166f8e944f84dc896b9ae.tar.gz gdb-7734102d6d8b5a0ccea166f8e944f84dc896b9ae.tar.bz2 |
Introduce new convenience variables $_gdb_major and $_gdb_minor
gdb/ChangeLog:
2019-03-30 Eli Zaretskii <eliz@gnu.org>
* NEWS: Announce $_gdb_major and $_gdb_minor.
* top.c (init_gdb_version_vars): New function.
(gdb_init): Call init_gdb_version_vars.
gdb/testsuite/ChangeLog:
2019-03-30 Simon Marchi <simark@simark.ca>
* gdb.base/default.exp: Add values for $_gdb_major and
$_gdb_minor.
gdb/doc/ChangeLog:
2019-03-30 Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Convenience Vars): Document $_gdb_major and
$_gdb_minor.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/NEWS | 6 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 13 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/default.exp | 2 | ||||
-rw-r--r-- | gdb/top.c | 39 |
7 files changed, 64 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a79a860..a3dfd31 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2019-03-30 Eli Zaretskii <eliz@gnu.org> + + * NEWS: Announce $_gdb_major and $_gdb_minor. + + * top.c (init_gdb_version_vars): New function. + (gdb_init): Call init_gdb_version_vars. + 2019-03-29 Tom Tromey <tromey@adacore.com> * printcmd.c (_initialize_printcmd): Add usage lines. Update some @@ -3,6 +3,12 @@ *** Changes since GDB 8.3 +* New built-in convenience variables $_gdb_major and $_gdb_minor + provide the GDB version. They are handy for conditionally using + features available only in or since specific GDB versions, in + scripts that should work error-free with many different versions, + such as in system-wide init files. + * GDB now supports Thread Local Storage (TLS) variables on several FreeBSD architectures (amd64, i386, powerpc, riscv). Other architectures require kernel changes. TLS is not yet supported for diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 87e20d3..c0d5aac 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2019-03-30 Eli Zaretskii <eliz@gnu.org> + + * gdb.texinfo (Convenience Vars): Document $_gdb_major and + $_gdb_minor. + 2019-03-26 Andrew Burgess <andrew.burgess@embecosm.com> * python.texi (Pretty Printing API): Document use of None for the diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 4c1d5e8..bb958cf 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -11197,7 +11197,7 @@ For example, it will be empty before you execute the @code{run} command. @vindex $_tlb@r{, convenience variable} The variable @code{$_tlb} is automatically set when debugging applications running on MS-Windows in native mode or connected to -gdbserver that supports the @code{qGetTIBAddr} request. +gdbserver that supports the @code{qGetTIBAddr} request. @xref{General Query Packets}. This variable contains the address of the thread information block. @@ -11211,6 +11211,17 @@ The thread number of the current thread. @xref{thread numbers}. @item $_gthread The global number of the current thread. @xref{global thread numbers}. +@item $_gdb_major +@itemx $_gdb_minor +@vindex $_gdb_major@r{, convenience variable} +@vindex $_gdb_minor@r{, convenience variable} +The major and minor version numbers of the running @value{GDBN}. +Development snapshots and pretest versions have their minor version +incremented by one; thus, @value{GDBN} pretest 9.11.90 will produce +the value 12 for @code{$_gdb_minor}. These variables allow you to +write scripts that work with different versions of @value{GDBN} +without errors caused by features unavailable in some of those +versions. @end table @node Convenience Funs diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c0310ca..75bb6c6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-30 Simon Marchi <simark@simark.ca> + + * gdb.base/default.exp: Add values for $_gdb_major and + $_gdb_minor. + 2019-03-29 Tom Tromey <tromey@adacore.com> * gdb.base/help.exp: Tighten apropos regexp. diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index ece1428..9ff5144 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -602,6 +602,8 @@ set show_conv_list \ {$_probe_arg10 = <error: No frame selected>} \ {$_probe_arg11 = <error: No frame selected>} \ {$_isvoid = <internal function _isvoid>} \ + {$_gdb_major = 8} \ + {$_gdb_minor = 4} \ } if ![skip_python_tests] { append show_conv_list \ @@ -147,22 +147,22 @@ int server_command; /* Timeout limit for response from target. */ -/* The default value has been changed many times over the years. It - was originally 5 seconds. But that was thought to be a long time +/* The default value has been changed many times over the years. It + was originally 5 seconds. But that was thought to be a long time to sit and wait, so it was changed to 2 seconds. That was thought - to be plenty unless the connection was going through some terminal + to be plenty unless the connection was going through some terminal server or multiplexer or other form of hairy serial connection. - In mid-1996, remote_timeout was moved from remote.c to top.c and + In mid-1996, remote_timeout was moved from remote.c to top.c and it began being used in other remote-* targets. It appears that the default was changed to 20 seconds at that time, perhaps because the Renesas E7000 ICE didn't always respond in a timely manner. But if 5 seconds is a long time to sit and wait for retransmissions, - 20 seconds is far worse. This demonstrates the difficulty of using + 20 seconds is far worse. This demonstrates the difficulty of using a single variable for all protocol timeouts. - As remote.c is used much more than remote-e7000.c, it was changed + As remote.c is used much more than remote-e7000.c, it was changed back to 2 seconds in 1999. */ int remote_timeout = 2; @@ -188,9 +188,9 @@ int (*deprecated_ui_loop_hook) (int); /* Called from print_frame_info to list the line we stopped in. */ -void (*deprecated_print_frame_info_listing_hook) (struct symtab * s, +void (*deprecated_print_frame_info_listing_hook) (struct symtab * s, int line, - int stopline, + int stopline, int noerror); /* Replaces most of query. */ @@ -237,7 +237,7 @@ ptid_t (*deprecated_target_wait_hook) (ptid_t ptid, /* Used by UI as a wrapper around command execution. May do various things like enabling/disabling buttons, etc... */ -void (*deprecated_call_command_hook) (struct cmd_list_element * c, +void (*deprecated_call_command_hook) (struct cmd_list_element * c, const char *cmd, int from_tty); /* Called when the current thread changes. Argument is thread id. */ @@ -1339,8 +1339,9 @@ There is NO WARRANTY, to the extent permitted by law."); resources online at:\n <http://www.gnu.org/software/gdb/documentation/>.")); fprintf_filtered (stream, "\n\n"); fprintf_filtered (stream, _("For help, type \"help\".\n")); - fprintf_filtered (stream, _("Type \"apropos word\" to search for \ -commands related to \"word\".")); + fprintf_filtered (stream, + _("Type \"apropos word\" to search for commands \ +related to \"word\".")); } /* Print the details of GDB build-time configuration. */ @@ -1608,7 +1609,7 @@ quit_force (int *exit_arg, int from_tty) undo_terminal_modifications_before_exit (); - /* An optional expression may be used to cause gdb to terminate with the + /* An optional expression may be used to cause gdb to terminate with the value of that expression. */ if (exit_arg) exit_code = *exit_arg; @@ -2003,6 +2004,17 @@ set_history_filename (const char *args, } static void +init_gdb_version_vars (void) +{ + struct internalvar *major_version_var = create_internalvar ("_gdb_major"); + struct internalvar *minor_version_var = create_internalvar ("_gdb_minor"); + int vmajor = 0, vminor = 0, vrevision = 0; + sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision); + set_internalvar_integer (major_version_var, vmajor); + set_internalvar_integer (minor_version_var, vminor + (vrevision > 0)); +} + +static void init_main (void) { struct cmd_list_element *c; @@ -2206,4 +2218,7 @@ gdb_init (char *argv0) prefix to be installed. Keep things simple and just do final script initialization here. */ finish_ext_lang_initialization (); + + /* Create $_gdb_major and $_gdb_minor convenience variables. */ + init_gdb_version_vars (); } |