forked from Imagelibrary/binutils-gdb
Compare commits
249 Commits
users/mmet
...
gdb-12-bra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4418a9c6f | ||
|
|
bd499e7e64 | ||
|
|
060ea40670 | ||
|
|
827a303bfd | ||
|
|
d14c822f09 | ||
|
|
63ba84b864 | ||
|
|
e4594519f2 | ||
|
|
0ac0e85243 | ||
|
|
ed9b90db51 | ||
|
|
3f7f5a866f | ||
|
|
5af1bbb8c0 | ||
|
|
3bbf1d7c22 | ||
|
|
4369e04787 | ||
|
|
b7bbae0ac3 | ||
|
|
287094e02d | ||
|
|
2269e714cc | ||
|
|
017aa4a1e9 | ||
|
|
1aefce82fd | ||
|
|
8c28fd36e9 | ||
|
|
0fd7bbc901 | ||
|
|
d35062e449 | ||
|
|
af9f3d376e | ||
|
|
5091924da9 | ||
|
|
e15378735d | ||
|
|
1160e4820e | ||
|
|
ab415edbe5 | ||
|
|
64849597cd | ||
|
|
b72f03e8d1 | ||
|
|
b285c25a4c | ||
|
|
948a94b341 | ||
|
|
7c3c18ec17 | ||
|
|
07008ecd59 | ||
|
|
a406981ad4 | ||
|
|
2e43daba15 | ||
|
|
6aa09dec40 | ||
|
|
bfd95a985f | ||
|
|
f227993960 | ||
|
|
7ba6dca126 | ||
|
|
103403b7a6 | ||
|
|
cfac150a9f | ||
|
|
c9f1c82c99 | ||
|
|
fba2722740 | ||
|
|
e6fc732433 | ||
|
|
d6e758a5f6 | ||
|
|
7c9a9652ad | ||
|
|
7d5f6667be | ||
|
|
7785134302 | ||
|
|
e2a06f322d | ||
|
|
04e493a8f0 | ||
|
|
01b6e375c8 | ||
|
|
d980b7acc8 | ||
|
|
bd23a7e40e | ||
|
|
f04f3368ac | ||
|
|
0895f52b6d | ||
|
|
d95e9bbbc8 | ||
|
|
632bc25920 | ||
|
|
23293598d0 | ||
|
|
4d8d9f983d | ||
|
|
396b80c6f1 | ||
|
|
b69d4c94ae | ||
|
|
3b6cdc18fc | ||
|
|
341f73897e | ||
|
|
f023b86fc5 | ||
|
|
9c437ad2a9 | ||
|
|
9920e89237 | ||
|
|
eab53d6ab8 | ||
|
|
f6b4043b4e | ||
|
|
ae72bcc22b | ||
|
|
4ef1fd2346 | ||
|
|
6dd3c48731 | ||
|
|
2218307e9b | ||
|
|
09f01041b9 | ||
|
|
17112c08b7 | ||
|
|
7bba87613e | ||
|
|
b0ad857775 | ||
|
|
81e1d654fe | ||
|
|
ebbafc41ad | ||
|
|
dbac5b57d8 | ||
|
|
01c9cd44d7 | ||
|
|
ce2cb0f4db | ||
|
|
b61628002a | ||
|
|
f3d9d5f097 | ||
|
|
7b33812e1d | ||
|
|
421440cf34 | ||
|
|
1d83251910 | ||
|
|
8a8906debf | ||
|
|
cb6780e38d | ||
|
|
a2add1757e | ||
|
|
a26cd6a7d4 | ||
|
|
5af45adfd2 | ||
|
|
940941aa4c | ||
|
|
91ce1797ed | ||
|
|
a7662984b1 | ||
|
|
eb5082d26e | ||
|
|
eb9c4ec9ac | ||
|
|
5807a31f6c | ||
|
|
d2c5346b58 | ||
|
|
623d7912d4 | ||
|
|
ab8119af6f | ||
|
|
2732a26ff7 | ||
|
|
eb4889aa8f | ||
|
|
7538cdd2bb | ||
|
|
a1bb0c2286 | ||
|
|
a433c55d7c | ||
|
|
6f504ec469 | ||
|
|
6a56aeaa62 | ||
|
|
4622ac7547 | ||
|
|
c7362d7e28 | ||
|
|
053e1e630f | ||
|
|
9d8655dd9e | ||
|
|
3de16c3fef | ||
|
|
5fc023ad2f | ||
|
|
1cd80001f2 | ||
|
|
093172f8cc | ||
|
|
605cfdff4d | ||
|
|
f343506ba0 | ||
|
|
940ddfe84b | ||
|
|
d2bf65bc01 | ||
|
|
1e032d8e37 | ||
|
|
66b16256c6 | ||
|
|
be809566a4 | ||
|
|
8386c80666 | ||
|
|
c2ac354248 | ||
|
|
18999431bd | ||
|
|
2f7a8c5713 | ||
|
|
593e6dbfa5 | ||
|
|
475b809dc3 | ||
|
|
bba7ae6c87 | ||
|
|
8d64760955 | ||
|
|
b381a5f0a0 | ||
|
|
3bad6c0231 | ||
|
|
60f562d852 | ||
|
|
3db7a38804 | ||
|
|
a9d4faaab1 | ||
|
|
331fb99750 | ||
|
|
31abca2bb0 | ||
|
|
855ae71fe2 | ||
|
|
c12d23e5f4 | ||
|
|
5dae8d106f | ||
|
|
655b22a054 | ||
|
|
58fbf063b2 | ||
|
|
8f4ecf37e0 | ||
|
|
95b8a31afc | ||
|
|
643f73257f | ||
|
|
7f70cce769 | ||
|
|
2c2a9c098c | ||
|
|
4887c2b748 | ||
|
|
aebe1b66b7 | ||
|
|
eac484d883 | ||
|
|
b8032fc585 | ||
|
|
163a4d7cc7 | ||
|
|
c3a9f79c8e | ||
|
|
a47c713db8 | ||
|
|
f0641f4e27 | ||
|
|
56958fe98b | ||
|
|
7491e9665e | ||
|
|
f9b0582219 | ||
|
|
28b7a50c23 | ||
|
|
8fae712426 | ||
|
|
d8edb0dee8 | ||
|
|
e705ad3b71 | ||
|
|
15696e4045 | ||
|
|
d9bc750c92 | ||
|
|
d528966466 | ||
|
|
36b7043630 | ||
|
|
54e3ab40ae | ||
|
|
0fe74cb9ad | ||
|
|
5adafe7d8a | ||
|
|
55357c09ee | ||
|
|
89705e474d | ||
|
|
69a63eee25 | ||
|
|
14d8b4fb8d | ||
|
|
46b5376f27 | ||
|
|
176b5961ce | ||
|
|
9c9114ea34 | ||
|
|
741d8b0429 | ||
|
|
4d905b269f | ||
|
|
d7e8e50d42 | ||
|
|
bb517c99b9 | ||
|
|
f916230ad2 | ||
|
|
723f6eafe4 | ||
|
|
4f0027f03c | ||
|
|
c47836066d | ||
|
|
25622428e9 | ||
|
|
4a0f8275ab | ||
|
|
16cd607461 | ||
|
|
70158ce8e0 | ||
|
|
6388cd0ce2 | ||
|
|
3efdda735c | ||
|
|
8ebd11a342 | ||
|
|
4e89bb12c2 | ||
|
|
e692cf2dc4 | ||
|
|
f7aaf3c25f | ||
|
|
6edaa538a3 | ||
|
|
03b9347271 | ||
|
|
78f29594ad | ||
|
|
594883b3b7 | ||
|
|
fb68c8adc4 | ||
|
|
795e17aa6a | ||
|
|
0096540077 | ||
|
|
364d1397ec | ||
|
|
f485331189 | ||
|
|
7858d22eb9 | ||
|
|
6f4449e6fc | ||
|
|
0e24a7ce39 | ||
|
|
ff62190fb0 | ||
|
|
a71bd1ba0d | ||
|
|
27ae093049 | ||
|
|
0f99116612 | ||
|
|
c639949eb1 | ||
|
|
1f0c30994a | ||
|
|
b2d1d9af50 | ||
|
|
135cfbc082 | ||
|
|
5790e687e5 | ||
|
|
b2ac3d7001 | ||
|
|
10e4383acb | ||
|
|
785a855000 | ||
|
|
7620f5f0f3 | ||
|
|
072f31aed6 | ||
|
|
6d279a2c3d | ||
|
|
e53a8e8685 | ||
|
|
4324e94471 | ||
|
|
e312dfbe95 | ||
|
|
3ab22dba1b | ||
|
|
f0072f79e1 | ||
|
|
04f521a6ef | ||
|
|
d063203192 | ||
|
|
db7127461e | ||
|
|
7b5e70a921 | ||
|
|
74f8cb8887 | ||
|
|
013dbf15db | ||
|
|
f48fc32448 | ||
|
|
d4c9e8f583 | ||
|
|
4f538bcbb7 | ||
|
|
1ab8f3967d | ||
|
|
0349d33f1d | ||
|
|
81f81faa8f | ||
|
|
aba6eff2e0 | ||
|
|
4393855615 | ||
|
|
810db22c7f | ||
|
|
b86dbc4c45 | ||
|
|
09ab0d2eec | ||
|
|
95c82cbf7e | ||
|
|
7685884a38 | ||
|
|
eb3ec1b698 | ||
|
|
9d7105d14c | ||
|
|
fc8b2d4b5d | ||
|
|
5dd959bace | ||
|
|
5e8b7e78b6 |
@@ -16,7 +16,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Controls whether to enable development-mode features by default.
|
# Controls whether to enable development-mode features by default.
|
||||||
development=true
|
development=false
|
||||||
|
|
||||||
# Indicate whether this is a release branch.
|
# Indicate whether this is a release branch.
|
||||||
experimental=true
|
experimental=true
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
In releases, the date is not included in either version strings or
|
In releases, the date is not included in either version strings or
|
||||||
sonames. */
|
sonames. */
|
||||||
#define BFD_VERSION_DATE 20220320
|
#define BFD_VERSION_DATE 20221218
|
||||||
#define BFD_VERSION @bfd_version@
|
#define BFD_VERSION @bfd_version@
|
||||||
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
|
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
|
||||||
#define REPORT_BUGS_TO @report_bugs_to@
|
#define REPORT_BUGS_TO @report_bugs_to@
|
||||||
|
|||||||
2
gdb/NEWS
2
gdb/NEWS
@@ -1,7 +1,7 @@
|
|||||||
What has changed in GDB?
|
What has changed in GDB?
|
||||||
(Organized release by release)
|
(Organized release by release)
|
||||||
|
|
||||||
*** Changes since GDB 11
|
*** Changes in GDB 12
|
||||||
|
|
||||||
* DBX mode is deprecated, and will be removed in GDB 13
|
* DBX mode is deprecated, and will be removed in GDB 13
|
||||||
|
|
||||||
|
|||||||
@@ -434,11 +434,11 @@ processInt (struct parser_state *par_state, const char *base0,
|
|||||||
return FLOAT;
|
return FLOAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_mpz maxval (ULONGEST_MAX / base);
|
gdb_mpz maxval (ULONGEST_MAX);
|
||||||
if (mpz_cmp (result.val, maxval.val) > 0)
|
if (mpz_cmp (result.val, maxval.val) > 0)
|
||||||
error (_("Integer literal out of range"));
|
error (_("Integer literal out of range"));
|
||||||
|
|
||||||
LONGEST value = result.as_integer<LONGEST> ();
|
ULONGEST value = result.as_integer<ULONGEST> ();
|
||||||
if ((value >> (gdbarch_int_bit (par_state->gdbarch ())-1)) == 0)
|
if ((value >> (gdbarch_int_bit (par_state->gdbarch ())-1)) == 0)
|
||||||
yylval.typed_val.type = type_int (par_state);
|
yylval.typed_val.type = type_int (par_state);
|
||||||
else if ((value >> (gdbarch_long_bit (par_state->gdbarch ())-1)) == 0)
|
else if ((value >> (gdbarch_long_bit (par_state->gdbarch ())-1)) == 0)
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ public:
|
|||||||
|
|
||||||
private: /* per-core data */
|
private: /* per-core data */
|
||||||
|
|
||||||
|
/* Get rid of the core inferior. */
|
||||||
|
void clear_core ();
|
||||||
|
|
||||||
/* The core's section table. Note that these target sections are
|
/* The core's section table. Note that these target sections are
|
||||||
*not* mapped in the current address spaces' set of target
|
*not* mapped in the current address spaces' set of target
|
||||||
sections --- those should come only from pure executable or
|
sections --- those should come only from pure executable or
|
||||||
@@ -290,10 +293,8 @@ core_target::build_file_mappings ()
|
|||||||
/* An arbitrary identifier for the core inferior. */
|
/* An arbitrary identifier for the core inferior. */
|
||||||
#define CORELOW_PID 1
|
#define CORELOW_PID 1
|
||||||
|
|
||||||
/* Close the core target. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
core_target::close ()
|
core_target::clear_core ()
|
||||||
{
|
{
|
||||||
if (core_bfd)
|
if (core_bfd)
|
||||||
{
|
{
|
||||||
@@ -307,6 +308,14 @@ core_target::close ()
|
|||||||
|
|
||||||
current_program_space->cbfd.reset (nullptr);
|
current_program_space->cbfd.reset (nullptr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the core target. */
|
||||||
|
|
||||||
|
void
|
||||||
|
core_target::close ()
|
||||||
|
{
|
||||||
|
clear_core ();
|
||||||
|
|
||||||
/* Core targets are heap-allocated (see core_target_open), so here
|
/* Core targets are heap-allocated (see core_target_open), so here
|
||||||
we delete ourselves. */
|
we delete ourselves. */
|
||||||
@@ -592,9 +601,15 @@ core_target_open (const char *arg, int from_tty)
|
|||||||
void
|
void
|
||||||
core_target::detach (inferior *inf, int from_tty)
|
core_target::detach (inferior *inf, int from_tty)
|
||||||
{
|
{
|
||||||
/* Note that 'this' is dangling after this call. unpush_target
|
/* Get rid of the core. Don't rely on core_target::close doing it,
|
||||||
closes the target, and our close implementation deletes
|
because target_detach may be called with core_target's refcount > 1,
|
||||||
'this'. */
|
meaning core_target::close may not be called yet by the
|
||||||
|
unpush_target call below. */
|
||||||
|
clear_core ();
|
||||||
|
|
||||||
|
/* Note that 'this' may be dangling after this call. unpush_target
|
||||||
|
closes the target if the refcount reaches 0, and our close
|
||||||
|
implementation deletes 'this'. */
|
||||||
inf->unpush_target (this);
|
inf->unpush_target (this);
|
||||||
|
|
||||||
/* Clear the register cache and the frame cache. */
|
/* Clear the register cache and the frame cache. */
|
||||||
|
|||||||
@@ -18014,7 +18014,6 @@ to be difficult.
|
|||||||
* Ada Tasks and Core Files:: Tasking Support when Debugging Core Files
|
* Ada Tasks and Core Files:: Tasking Support when Debugging Core Files
|
||||||
* Ravenscar Profile:: Tasking Support when using the Ravenscar
|
* Ravenscar Profile:: Tasking Support when using the Ravenscar
|
||||||
Profile
|
Profile
|
||||||
* Ada Settings:: New settable GDB parameters for Ada.
|
|
||||||
* Ada Source Character Set:: Character set of Ada source files.
|
* Ada Source Character Set:: Character set of Ada source files.
|
||||||
* Ada Glitches:: Known peculiarities of Ada mode.
|
* Ada Glitches:: Known peculiarities of Ada mode.
|
||||||
@end menu
|
@end menu
|
||||||
@@ -18748,37 +18747,6 @@ it isn't currently possible to single-step through the runtime
|
|||||||
initialization sequence. If you need to debug this code, you should
|
initialization sequence. If you need to debug this code, you should
|
||||||
use @code{set ravenscar task-switching off}.
|
use @code{set ravenscar task-switching off}.
|
||||||
|
|
||||||
@node Ada Settings
|
|
||||||
@subsubsection Ada Settings
|
|
||||||
@cindex Ada settings
|
|
||||||
|
|
||||||
@table @code
|
|
||||||
@kindex set varsize-limit
|
|
||||||
@item set varsize-limit @var{size}
|
|
||||||
Prevent @value{GDBN} from attempting to evaluate objects whose size
|
|
||||||
is above the given limit (@var{size}) when those sizes are computed
|
|
||||||
from run-time quantities. This is typically the case when the object
|
|
||||||
has a variable size, such as an array whose bounds are not known at
|
|
||||||
compile time for example. Setting @var{size} to @code{unlimited}
|
|
||||||
removes the size limitation. By default, the limit is about 65KB.
|
|
||||||
|
|
||||||
The purpose of having such a limit is to prevent @value{GDBN} from
|
|
||||||
trying to grab enormous chunks of virtual memory when asked to evaluate
|
|
||||||
a quantity whose bounds have been corrupted or have not yet been fully
|
|
||||||
initialized. The limit applies to the results of some subexpressions
|
|
||||||
as well as to complete expressions. For example, an expression denoting
|
|
||||||
a simple integer component, such as @code{x.y.z}, may fail if the size of
|
|
||||||
@code{x.y} is variable and exceeds @code{size}. On the other hand,
|
|
||||||
@value{GDBN} is sometimes clever; the expression @code{A(i)}, where
|
|
||||||
@code{A} is an array variable with non-constant size, will generally
|
|
||||||
succeed regardless of the bounds on @code{A}, as long as the component
|
|
||||||
size is less than @var{size}.
|
|
||||||
|
|
||||||
@kindex show varsize-limit
|
|
||||||
@item show varsize-limit
|
|
||||||
Show the limit on types whose size is determined by run-time quantities.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@node Ada Source Character Set
|
@node Ada Source Character Set
|
||||||
@subsubsection Ada Source Character Set
|
@subsubsection Ada Source Character Set
|
||||||
@cindex Ada, source character set
|
@cindex Ada, source character set
|
||||||
|
|||||||
@@ -821,19 +821,6 @@ gdb_readline_no_editing_callback (gdb_client_data client_data)
|
|||||||
FILE *stream = ui->instream != nullptr ? ui->instream : ui->stdin_stream;
|
FILE *stream = ui->instream != nullptr ? ui->instream : ui->stdin_stream;
|
||||||
gdb_assert (stream != nullptr);
|
gdb_assert (stream != nullptr);
|
||||||
|
|
||||||
/* Unbuffer the input stream, so that, later on, the calls to fgetc
|
|
||||||
fetch only one char at the time from the stream. The fgetc's will
|
|
||||||
get up to the first newline, but there may be more chars in the
|
|
||||||
stream after '\n'. If we buffer the input and fgetc drains the
|
|
||||||
stream, getting stuff beyond the newline as well, a select, done
|
|
||||||
afterwards will not trigger.
|
|
||||||
|
|
||||||
This unbuffering was, at one point, not applied if the input stream
|
|
||||||
was a tty, however, the buffering can cause problems, even for a tty,
|
|
||||||
in some cases. Please ensure that any changes in this area run the MI
|
|
||||||
tests with the FORCE_SEPARATE_MI_TTY=1 flag being passed. */
|
|
||||||
setbuf (stream, NULL);
|
|
||||||
|
|
||||||
/* We still need the while loop here, even though it would seem
|
/* We still need the while loop here, even though it would seem
|
||||||
obvious to invoke gdb_readline_no_editing_callback at every
|
obvious to invoke gdb_readline_no_editing_callback at every
|
||||||
character entered. If not using the readline library, the
|
character entered. If not using the readline library, the
|
||||||
|
|||||||
@@ -1974,27 +1974,51 @@ struct user_selected_context
|
|||||||
{
|
{
|
||||||
/* Constructor. */
|
/* Constructor. */
|
||||||
user_selected_context ()
|
user_selected_context ()
|
||||||
: m_previous_ptid (inferior_ptid),
|
: m_previous_ptid (inferior_ptid)
|
||||||
m_previous_frame (deprecated_safe_get_selected_frame ())
|
{
|
||||||
{ /* Nothing. */ }
|
save_selected_frame (&m_previous_frame_id, &m_previous_frame_level);
|
||||||
|
}
|
||||||
|
|
||||||
/* Return true if the user selected context has changed since this object
|
/* Return true if the user selected context has changed since this object
|
||||||
was created. */
|
was created. */
|
||||||
bool has_changed () const
|
bool has_changed () const
|
||||||
{
|
{
|
||||||
return ((m_previous_ptid != null_ptid
|
/* Did the selected thread change? */
|
||||||
&& inferior_ptid != null_ptid
|
if (m_previous_ptid != null_ptid && inferior_ptid != null_ptid
|
||||||
&& m_previous_ptid != inferior_ptid)
|
&& m_previous_ptid != inferior_ptid)
|
||||||
|| m_previous_frame != deprecated_safe_get_selected_frame ());
|
return true;
|
||||||
|
|
||||||
|
/* Grab details of the currently selected frame, for comparison. */
|
||||||
|
frame_id current_frame_id;
|
||||||
|
int current_frame_level;
|
||||||
|
save_selected_frame (¤t_frame_id, ¤t_frame_level);
|
||||||
|
|
||||||
|
/* Did the selected frame level change? */
|
||||||
|
if (current_frame_level != m_previous_frame_level)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* Did the selected frame id change? If the innermost frame is
|
||||||
|
selected then the level will be -1, and the frame-id will be
|
||||||
|
null_frame_id. As comparing null_frame_id with itself always
|
||||||
|
reports not-equal, we only do the equality test if we have something
|
||||||
|
other than the innermost frame selected. */
|
||||||
|
if (current_frame_level != -1
|
||||||
|
&& !frame_id_eq (current_frame_id, m_previous_frame_id))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* Nothing changed! */
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
/* The previously selected thread. This might be null_ptid if there was
|
/* The previously selected thread. This might be null_ptid if there was
|
||||||
no previously selected thread. */
|
no previously selected thread. */
|
||||||
ptid_t m_previous_ptid;
|
ptid_t m_previous_ptid;
|
||||||
|
|
||||||
/* The previously selected frame. This might be nullptr if there was no
|
/* The previously selected frame. If the innermost frame is selected, or
|
||||||
previously selected frame. */
|
no frame is selected, then the frame_id will be null_frame_id, and the
|
||||||
frame_info *m_previous_frame;
|
level will be -1. */
|
||||||
|
frame_id m_previous_frame_id;
|
||||||
|
int m_previous_frame_level;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -201,6 +201,8 @@ handle_exception (struct target_waitstatus *ourstatus, bool debug_exceptions)
|
|||||||
thread_rec (ptid_t (current_event.dwProcessId, current_event.dwThreadId, 0),
|
thread_rec (ptid_t (current_event.dwProcessId, current_event.dwThreadId, 0),
|
||||||
DONT_SUSPEND);
|
DONT_SUSPEND);
|
||||||
|
|
||||||
|
last_sig = GDB_SIGNAL_0;
|
||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
@@ -261,8 +263,10 @@ handle_exception (struct target_waitstatus *ourstatus, bool debug_exceptions)
|
|||||||
on startup, first a BREAKPOINT for the 64bit ntdll.dll,
|
on startup, first a BREAKPOINT for the 64bit ntdll.dll,
|
||||||
then a WX86_BREAKPOINT for the 32bit ntdll.dll.
|
then a WX86_BREAKPOINT for the 32bit ntdll.dll.
|
||||||
Here we only care about the WX86_BREAKPOINT's. */
|
Here we only care about the WX86_BREAKPOINT's. */
|
||||||
|
DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT - ignore_first_breakpoint");
|
||||||
ourstatus->set_spurious ();
|
ourstatus->set_spurious ();
|
||||||
ignore_first_breakpoint = false;
|
ignore_first_breakpoint = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (wow64_process)
|
else if (wow64_process)
|
||||||
{
|
{
|
||||||
@@ -273,7 +277,7 @@ handle_exception (struct target_waitstatus *ourstatus, bool debug_exceptions)
|
|||||||
gdb lets the target process continue.
|
gdb lets the target process continue.
|
||||||
So handle it as SIGINT instead, then the target is stopped
|
So handle it as SIGINT instead, then the target is stopped
|
||||||
unconditionally. */
|
unconditionally. */
|
||||||
DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
|
DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT - wow64_process");
|
||||||
rec->ExceptionCode = DBG_CONTROL_C;
|
rec->ExceptionCode = DBG_CONTROL_C;
|
||||||
ourstatus->set_stopped (GDB_SIGNAL_INT);
|
ourstatus->set_stopped (GDB_SIGNAL_INT);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
#include "observable.h"
|
#include "observable.h"
|
||||||
#include "gdbsupport/scoped_fd.h"
|
#include "gdbsupport/scoped_fd.h"
|
||||||
#include "gdbsupport/pathstuff.h"
|
#include "gdbsupport/pathstuff.h"
|
||||||
|
#include "gdbsupport/buildargv.h"
|
||||||
|
|
||||||
/* This module provides the interface between GDB and the
|
/* This module provides the interface between GDB and the
|
||||||
/proc file system, which is used on many versions of Unix
|
/proc file system, which is used on many versions of Unix
|
||||||
|
|||||||
10
gdb/remote.c
10
gdb/remote.c
@@ -1968,15 +1968,17 @@ add_packet_config_cmd (struct packet_config *config, const char *name,
|
|||||||
/* set/show remote NAME-packet {auto,on,off} -- legacy. */
|
/* set/show remote NAME-packet {auto,on,off} -- legacy. */
|
||||||
if (legacy)
|
if (legacy)
|
||||||
{
|
{
|
||||||
/* It's not clear who should take ownership of this string, so, for
|
/* It's not clear who should take ownership of the LEGACY_NAME string
|
||||||
now, make it static, and give copies to each of the add_alias_cmd
|
created below, so, for now, place the string into a static vector
|
||||||
calls below. */
|
which ensures the strings is released when GDB exits. */
|
||||||
static gdb::unique_xmalloc_ptr<char> legacy_name
|
static std::vector<gdb::unique_xmalloc_ptr<char>> legacy_names;
|
||||||
|
gdb::unique_xmalloc_ptr<char> legacy_name
|
||||||
= xstrprintf ("%s-packet", name);
|
= xstrprintf ("%s-packet", name);
|
||||||
add_alias_cmd (legacy_name.get (), cmds.set, class_obscure, 0,
|
add_alias_cmd (legacy_name.get (), cmds.set, class_obscure, 0,
|
||||||
&remote_set_cmdlist);
|
&remote_set_cmdlist);
|
||||||
add_alias_cmd (legacy_name.get (), cmds.show, class_obscure, 0,
|
add_alias_cmd (legacy_name.get (), cmds.show, class_obscure, 0,
|
||||||
&remote_show_cmdlist);
|
&remote_show_cmdlist);
|
||||||
|
legacy_names.emplace_back (std::move (legacy_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -271,7 +271,10 @@ struct rust_parser
|
|||||||
operation_up parse_entry_point ()
|
operation_up parse_entry_point ()
|
||||||
{
|
{
|
||||||
lex ();
|
lex ();
|
||||||
return parse_expr ();
|
operation_up result = parse_expr ();
|
||||||
|
if (current_token != 0)
|
||||||
|
error (_("Syntax error near '%s'"), pstate->prev_lexptr);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
operation_up parse_tuple ();
|
operation_up parse_tuple ();
|
||||||
@@ -2020,6 +2023,7 @@ rust_parser::parse_atom (bool required)
|
|||||||
|
|
||||||
case STRING:
|
case STRING:
|
||||||
result = parse_string ();
|
result = parse_string ();
|
||||||
|
lex ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BYTESTRING:
|
case BYTESTRING:
|
||||||
|
|||||||
@@ -1453,11 +1453,6 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
|
|||||||
if (objfile == current_program_space->symfile_object_file)
|
if (objfile == current_program_space->symfile_object_file)
|
||||||
return info->main_lm_addr;
|
return info->main_lm_addr;
|
||||||
|
|
||||||
/* If OBJFILE is a separate debug object file, look for the
|
|
||||||
original object file. */
|
|
||||||
if (objfile->separate_debug_objfile_backlink != NULL)
|
|
||||||
objfile = objfile->separate_debug_objfile_backlink;
|
|
||||||
|
|
||||||
/* The other link map addresses may be found by examining the list
|
/* The other link map addresses may be found by examining the list
|
||||||
of shared libraries. */
|
of shared libraries. */
|
||||||
for (struct so_list *so : current_program_space->solibs ())
|
for (struct so_list *so : current_program_space->solibs ())
|
||||||
|
|||||||
19
gdb/target.c
19
gdb/target.c
@@ -908,6 +908,15 @@ add_deprecated_target_alias (const target_info &tinfo, const char *alias)
|
|||||||
void
|
void
|
||||||
target_kill (void)
|
target_kill (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* If the commit_resume_state of the to-be-killed-inferior's process stratum
|
||||||
|
is true, and this inferior is the last live inferior with resumed threads
|
||||||
|
of that target, then we want to leave commit_resume_state to false, as the
|
||||||
|
target won't have any resumed threads anymore. We achieve this with
|
||||||
|
this scoped_disable_commit_resumed. On construction, it will set the flag
|
||||||
|
to false. On destruction, it will only set it to true if there are resumed
|
||||||
|
threads left. */
|
||||||
|
scoped_disable_commit_resumed disable ("killing");
|
||||||
current_inferior ()->top_target ()->kill ();
|
current_inferior ()->top_target ()->kill ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1296,6 +1305,11 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
|
|||||||
struct target_ops *target = current_inferior ()->top_target ();
|
struct target_ops *target = current_inferior ()->top_target ();
|
||||||
struct gdbarch *gdbarch = target_gdbarch ();
|
struct gdbarch *gdbarch = target_gdbarch ();
|
||||||
|
|
||||||
|
/* If OBJFILE is a separate debug object file, look for the
|
||||||
|
original object file. */
|
||||||
|
if (objfile->separate_debug_objfile_backlink != NULL)
|
||||||
|
objfile = objfile->separate_debug_objfile_backlink;
|
||||||
|
|
||||||
if (gdbarch_fetch_tls_load_module_address_p (gdbarch))
|
if (gdbarch_fetch_tls_load_module_address_p (gdbarch))
|
||||||
{
|
{
|
||||||
ptid_t ptid = inferior_ptid;
|
ptid_t ptid = inferior_ptid;
|
||||||
@@ -2553,6 +2567,9 @@ target_preopen (int from_tty)
|
|||||||
void
|
void
|
||||||
target_detach (inferior *inf, int from_tty)
|
target_detach (inferior *inf, int from_tty)
|
||||||
{
|
{
|
||||||
|
/* Thread's don't need to be resumed until the end of this function. */
|
||||||
|
scoped_disable_commit_resumed disable_commit_resumed ("detaching");
|
||||||
|
|
||||||
/* After we have detached, we will clear the register cache for this inferior
|
/* After we have detached, we will clear the register cache for this inferior
|
||||||
by calling registers_changed_ptid. We must save the pid_ptid before
|
by calling registers_changed_ptid. We must save the pid_ptid before
|
||||||
detaching, as the target detach method will clear inf->pid. */
|
detaching, as the target detach method will clear inf->pid. */
|
||||||
@@ -2583,6 +2600,8 @@ target_detach (inferior *inf, int from_tty)
|
|||||||
inferior_ptid matches save_pid_ptid, but in our case, it does not
|
inferior_ptid matches save_pid_ptid, but in our case, it does not
|
||||||
call it, as inferior_ptid has been reset. */
|
call it, as inferior_ptid has been reset. */
|
||||||
reinit_frame_cache ();
|
reinit_frame_cache ();
|
||||||
|
|
||||||
|
disable_commit_resumed.reset_and_commit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ private:
|
|||||||
char *execd_pathname;
|
char *execd_pathname;
|
||||||
/* Syscall number */
|
/* Syscall number */
|
||||||
int syscall_number;
|
int syscall_number;
|
||||||
} m_value;
|
} m_value {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Extended reasons that can explain why a target/thread stopped for a
|
/* Extended reasons that can explain why a target/thread stopped for a
|
||||||
|
|||||||
@@ -49,27 +49,56 @@ foreach_with_prefix scenario {all minimal} {
|
|||||||
|
|
||||||
gdb_test "ptype string_access" "= access array \\(<>\\) of character"
|
gdb_test "ptype string_access" "= access array \\(<>\\) of character"
|
||||||
|
|
||||||
set kfail_int128support_re \
|
# GNAT >= 12.0 has the needed fix here.
|
||||||
"That operation is not available on integers of more than 8 bytes\\."
|
set xfail_expected 0
|
||||||
set kfail_packed_array_range_re \
|
if {$scenario == "minimal" && ![test_compiler_info {gcc-1[2-9]-*}]} {
|
||||||
|
set xfail_expected 1
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_test_multiple "print pa_ptr.all" "" {
|
||||||
|
-re -wrap " = \\(10, 20, 30, 40, 50, 60, 62, 63, -23, 42\\)" {
|
||||||
|
pass $gdb_test_name
|
||||||
|
}
|
||||||
|
-re -wrap " = \[0-9\]+" {
|
||||||
|
if { $xfail_expected } {
|
||||||
|
xfail $gdb_test_name
|
||||||
|
} else {
|
||||||
|
fail $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set xfail_cannot_subscript_re \
|
||||||
"cannot subscript or call something of type `foo__packed_array_ptr'"
|
"cannot subscript or call something of type `foo__packed_array_ptr'"
|
||||||
|
|
||||||
# GNAT >= 12.0 has the needed fix here.
|
gdb_test_multiple "print pa_ptr(3)" "" {
|
||||||
if {$scenario == "minimal" && ![test_compiler_info {gcc-1[2-9]-*}]} {
|
-re -wrap " = 30" {
|
||||||
setup_kfail "minimal encodings" *-*-*
|
pass $gdb_test_name
|
||||||
}
|
|
||||||
gdb_test "print pa_ptr.all" \
|
|
||||||
" = \\(10, 20, 30, 40, 50, 60, 62, 63, -23, 42\\)"
|
|
||||||
|
|
||||||
# GNAT >= 12.0 has the needed fix here.
|
}
|
||||||
if {$scenario == "minimal" && ![test_compiler_info {gcc-1[2-9]-*}]} {
|
-re -wrap $xfail_cannot_subscript_re {
|
||||||
setup_kfail "minimal encodings" *-*-*
|
if { $xfail_expected } {
|
||||||
|
xfail $gdb_test_name
|
||||||
|
} else {
|
||||||
|
fail $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gdb_test "print pa_ptr(3)" " = 30"
|
|
||||||
|
|
||||||
# GNAT >= 12.0 has the needed fix here.
|
set xfail_attempt_to_index_re \
|
||||||
if {$scenario == "minimal" && ![test_compiler_info {gcc-1[2-9]-*}]} {
|
"Attempt to index or call something other than an array or function"
|
||||||
setup_kfail "minimal encodings" *-*-*
|
|
||||||
|
gdb_test_multiple "print pa_ptr.all(3)" "" {
|
||||||
|
-re -wrap " = 30" {
|
||||||
|
pass $gdb_test_name
|
||||||
|
|
||||||
|
}
|
||||||
|
-re -wrap $xfail_attempt_to_index_re {
|
||||||
|
if { $xfail_expected } {
|
||||||
|
xfail $gdb_test_name
|
||||||
|
} else {
|
||||||
|
fail $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gdb_test "print pa_ptr.all(3)" " = 30"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,12 +42,29 @@ gdb_test "print val_double := 16lf#bc0d83c94fb6d2ac#" " = -2.0e-19"
|
|||||||
gdb_test "print val_double" " = -2.0e-19" \
|
gdb_test "print val_double" " = -2.0e-19" \
|
||||||
"print val_double after assignment"
|
"print val_double after assignment"
|
||||||
|
|
||||||
gdb_test "print 16llf#7FFFF7FF4054A56FA5B99019A5C8#" " = 5.0e\\+25"
|
set 16llf_supported 0
|
||||||
|
gdb_test_multiple "ptype long_long_float" "" {
|
||||||
|
-re -wrap "<16-byte float>" {
|
||||||
|
set 16llf_supported 1
|
||||||
|
pass $gdb_test_name
|
||||||
|
}
|
||||||
|
-re -wrap "<\\d+-byte float>" {
|
||||||
|
pass $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $16llf_supported } {
|
||||||
|
gdb_test "print 16llf#7FFFF7FF4054A56FA5B99019A5C8#" " = 5.0e\\+25"
|
||||||
|
}
|
||||||
gdb_test "print val_long_double" " = 5.0e\\+25"
|
gdb_test "print val_long_double" " = 5.0e\\+25"
|
||||||
gdb_test "print val_long_double := 16llf#7FFFF7FF4054A56FA5B99019A5C8#" \
|
if { $16llf_supported } {
|
||||||
" = 5.0e\\+25"
|
gdb_test "print val_long_double := 16llf#7FFFF7FF4054A56FA5B99019A5C8#" \
|
||||||
|
" = 5.0e\\+25"
|
||||||
|
}
|
||||||
gdb_test "print val_long_double" " = 5.0e\\+25" \
|
gdb_test "print val_long_double" " = 5.0e\\+25" \
|
||||||
"print val_long_double after assignment"
|
"print val_long_double after assignment"
|
||||||
|
|
||||||
gdb_test "print 16llf#a56fa5b99019a5c800007ffff7ff4054#" \
|
if { $16llf_supported } {
|
||||||
" = <invalid float value>"
|
gdb_test "print 16llf#a56fa5b99019a5c800007ffff7ff4054#" \
|
||||||
|
" = <invalid float value>"
|
||||||
|
}
|
||||||
|
|||||||
@@ -34,3 +34,6 @@ gdb_test "print 2e1000" "Integer literal out of range"
|
|||||||
gdb_test "print 16#ffff#" " = 65535"
|
gdb_test "print 16#ffff#" " = 65535"
|
||||||
gdb_test "print 16#f#e1" " = 240"
|
gdb_test "print 16#f#e1" " = 240"
|
||||||
gdb_test "print 16#1#e10" " = 1099511627776"
|
gdb_test "print 16#1#e10" " = 1099511627776"
|
||||||
|
|
||||||
|
gdb_test "print/x 16#7fffffffffffffff#" " = 0x7fffffffffffffff"
|
||||||
|
gdb_test "print 16#ffffffffffffffff#" " = -1"
|
||||||
|
|||||||
@@ -128,41 +128,66 @@ gdb_test_multiple "info break" "breakpoint info" {
|
|||||||
set binexp [string_to_regexp $binfile]
|
set binexp [string_to_regexp $binfile]
|
||||||
|
|
||||||
set warning_slow_re \
|
set warning_slow_re \
|
||||||
"warning: File transfers from remote targets can be slow\[^\r\n\]+"
|
"warning: File transfers from remote targets can be slow\[^\r\n\]+\r\n"
|
||||||
set warning_gdb_index_re \
|
set warning_gdb_index_re \
|
||||||
[multi_line \
|
[multi_line \
|
||||||
"warning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+" \
|
"warning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+" \
|
||||||
"Do \"set use-deprecated-index-sections on\" before the file is read" \
|
"Do \"set use-deprecated-index-sections on\" before the file is read" \
|
||||||
"to use the section anyway\\."]
|
"to use the section anyway\\.\r\n"]
|
||||||
set reading_re \
|
set reading_re \
|
||||||
"Reading \[^\r\n\]+"
|
"Reading \[^\r\n\]+\r\n"
|
||||||
set libthread_db_re \
|
set libthread_db_re \
|
||||||
[multi_line \
|
[multi_line \
|
||||||
"\\\[Thread debugging using libthread_db enabled\\\]" \
|
"\\\[Thread debugging using libthread_db enabled\\\]" \
|
||||||
"Using host libthread_db library \[^\r\n\]+"]
|
"Using host libthread_db library \[^\r\n\]+\r\n"]
|
||||||
|
|
||||||
|
set optional_re \
|
||||||
|
[list \
|
||||||
|
"\(" \
|
||||||
|
"\($reading_re)" \
|
||||||
|
"|" \
|
||||||
|
"\($warning_slow_re\)" \
|
||||||
|
"|" \
|
||||||
|
"\($libthread_db_re\)" \
|
||||||
|
"|" \
|
||||||
|
"\(\r\n$warning_gdb_index_re\)?" \
|
||||||
|
"\)*"]
|
||||||
|
set optional_re [join $optional_re ""]
|
||||||
|
|
||||||
set run_re \
|
set run_re \
|
||||||
[list \
|
[list \
|
||||||
"\r\n\032\032post-prompt\r\nStarting program: $binexp " \
|
"\r\n\032\032post-prompt\r\n" \
|
||||||
"\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \
|
"Starting program: $binexp \r\n" \
|
||||||
"\(\r\n$warning_gdb_index_re\)?" \
|
$optional_re \
|
||||||
"\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
|
"\(\r\n\032\032breakpoints-invalid\r\n\)?" \
|
||||||
"\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)|\r\n$libthread_db_re\)*" \
|
$optional_re \
|
||||||
"\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
|
"\r\n\032\032starting\r\n" \
|
||||||
"\032\032breakpoint 1\r\n\r\n" \
|
$optional_re \
|
||||||
"Breakpoint 1, \r\n" \
|
"\r\n\032\032frames-invalid\r\n" \
|
||||||
"\032\032frame-begin 0 $hex\r\n\r\n" \
|
$optional_re \
|
||||||
"\032\032frame-function-name\r\n" \
|
"\r\n\032\032breakpoints-invalid\r\n" \
|
||||||
"main\r\n" \
|
$optional_re \
|
||||||
"\032\032frame-args\r\n \\(\\)\r\n" \
|
"\r\n\032\032breakpoint 1\r\n" \
|
||||||
"\032\032frame-source-begin\r\n at \r\n" \
|
"\r\n" \
|
||||||
"\032\032frame-source-file\r\n.*annota1.c\r\n" \
|
"Breakpoint 1, " \
|
||||||
"\032\032frame-source-file-end\r\n:\r\n" \
|
"\r\n\032\032frame-begin 0 $hex\r\n" \
|
||||||
"\032\032frame-source-line\r\n$main_line\r\n" \
|
"\r\n\032\032frame-function-name\r\n" \
|
||||||
"\032\032frame-source-end\r\n\r\n\r\n" \
|
"main" \
|
||||||
"\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \
|
"\r\n\032\032frame-args\r\n" \
|
||||||
"\032\032frame-end\r\n\r\n" \
|
" \\(\\)" \
|
||||||
"\032\032stopped"]
|
"\r\n\032\032frame-source-begin\r\n" \
|
||||||
|
" at " \
|
||||||
|
"\r\n\032\032frame-source-file\r\n" \
|
||||||
|
".*annota1.c" \
|
||||||
|
"\r\n\032\032frame-source-file-end\r\n" \
|
||||||
|
":" \
|
||||||
|
"\r\n\032\032frame-source-line\r\n" \
|
||||||
|
"$main_line" \
|
||||||
|
"\r\n\032\032frame-source-end\r\n" \
|
||||||
|
"\r\n" \
|
||||||
|
"\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n" \
|
||||||
|
"\r\n\032\032frame-end\r\n" \
|
||||||
|
"\r\n\032\032stopped\r\n"]
|
||||||
|
|
||||||
set run_re [join $run_re ""]
|
set run_re [join $run_re ""]
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,16 @@ gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (
|
|||||||
|
|
||||||
gdb_test "core" "No core file now."
|
gdb_test "core" "No core file now."
|
||||||
|
|
||||||
|
# Test that we can unload the core with the "detach" command.
|
||||||
|
|
||||||
|
proc_with_prefix corefile_detach {} {
|
||||||
|
clean_restart $::binfile
|
||||||
|
|
||||||
|
gdb_test "core-file $::corefile" "Core was generated by .*" "load core"
|
||||||
|
gdb_test "detach" "No core file now\\." "detach core"
|
||||||
|
}
|
||||||
|
|
||||||
|
corefile_detach
|
||||||
|
|
||||||
# Test a run (start) command will clear any loaded core file.
|
# Test a run (start) command will clear any loaded core file.
|
||||||
|
|
||||||
@@ -222,6 +232,8 @@ proc corefile_test_run {} {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clean_restart $::binfile
|
||||||
|
|
||||||
gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
|
gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
|
||||||
gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
|
gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
|
||||||
|
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ set show_conv_list \
|
|||||||
{$_gdb_setting_str = <internal function _gdb_setting_str>} \
|
{$_gdb_setting_str = <internal function _gdb_setting_str>} \
|
||||||
{$_gdb_setting = <internal function _gdb_setting>} \
|
{$_gdb_setting = <internal function _gdb_setting>} \
|
||||||
{$_gdb_major = 12} \
|
{$_gdb_major = 12} \
|
||||||
{$_gdb_minor = 1} \
|
{$_gdb_minor = 2} \
|
||||||
{$_shell_exitsignal = void} \
|
{$_shell_exitsignal = void} \
|
||||||
{$_shell_exitcode = 0} \
|
{$_shell_exitcode = 0} \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,4 +195,9 @@ gdb_test_no_output "set remote hardware-breakpoint-limit -1"
|
|||||||
gdb_test_no_output "set remote hardware-watchpoint-limit 2147483647"
|
gdb_test_no_output "set remote hardware-watchpoint-limit 2147483647"
|
||||||
gdb_test_no_output "set remote hardware-breakpoint-limit 2147483647"
|
gdb_test_no_output "set remote hardware-breakpoint-limit 2147483647"
|
||||||
|
|
||||||
|
# Check the X/P/p alias commands display the correct packet names.
|
||||||
|
foreach pkt {X P p} {
|
||||||
|
gdb_test "show remote ${pkt}-packet" "Support for the `${pkt}' packet is.*"
|
||||||
|
}
|
||||||
|
|
||||||
gdb_exit
|
gdb_exit
|
||||||
|
|||||||
33
gdb/testsuite/gdb.base/run-control-while-bg-execution.c
Normal file
33
gdb/testsuite/gdb.base/run-control-while-bg-execution.c
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* This testcase is part of GDB, the GNU debugger.
|
||||||
|
|
||||||
|
Copyright 2020-2022 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
//
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
static pid_t mypid = -1;
|
||||||
|
|
||||||
|
static void
|
||||||
|
after_getpid (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
mypid = getpid ();
|
||||||
|
after_getpid ();
|
||||||
|
sleep (30);
|
||||||
|
}
|
||||||
122
gdb/testsuite/gdb.base/run-control-while-bg-execution.exp
Normal file
122
gdb/testsuite/gdb.base/run-control-while-bg-execution.exp
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
# Copyright 2022 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# This test aims at testing various operations after getting rid of an inferior
|
||||||
|
# that was running in background, or while we have an inferior running in
|
||||||
|
# background. The original intent was to expose cases where the commit-resumed
|
||||||
|
# state of the process stratum target was not reset properly after killing an
|
||||||
|
# inferior running in background, which would be a problem when trying to run
|
||||||
|
# again. The test was expanded to test various combinations of
|
||||||
|
# run-control-related actions done with an inferior running in background.
|
||||||
|
|
||||||
|
if {[use_gdb_stub]} {
|
||||||
|
unsupported "test requires running"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
standard_testfile
|
||||||
|
|
||||||
|
if {[build_executable "failed to prepare" $testfile $srcfile]} {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run one variation of the test:
|
||||||
|
#
|
||||||
|
# 1. Start an inferior in the background with "run &"
|
||||||
|
# 2. Do action 1
|
||||||
|
# 3. Do action 2
|
||||||
|
#
|
||||||
|
# Action 1 indicates what to do with the inferior running in background:
|
||||||
|
#
|
||||||
|
# - kill: kill it
|
||||||
|
# - detach: detach it
|
||||||
|
# - add: add a new inferior and switch to it, leave the inferior running in
|
||||||
|
# background alone
|
||||||
|
# - none: do nothing, leave the inferior running in background alone
|
||||||
|
#
|
||||||
|
# Action 2 indicates what to do after that:
|
||||||
|
#
|
||||||
|
# - start: use the start command
|
||||||
|
# - run: use the run command
|
||||||
|
# - attach: start a process outside of GDB and attach it
|
||||||
|
proc do_test { action1 action2 } {
|
||||||
|
save_vars { ::GDBFLAGS } {
|
||||||
|
append ::GDBFLAGS " -ex \"maintenance set target-non-stop on\""
|
||||||
|
clean_restart $::binfile
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure we are at least after the getpid call, should we need it.
|
||||||
|
if { ![runto "after_getpid"] } {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Some commands below ask for confirmation. Turn that off for simplicity.
|
||||||
|
gdb_test "set confirm off"
|
||||||
|
gdb_test_multiple "continue &" "" {
|
||||||
|
-re ".*\r\n$::gdb_prompt " {
|
||||||
|
pass $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $action1 == "kill" } {
|
||||||
|
gdb_test "kill" "Inferior 1 .* killed.*"
|
||||||
|
} elseif { $action1 == "detach" } {
|
||||||
|
set child_pid [get_integer_valueof "mypid" -1]
|
||||||
|
if { $child_pid == -1 } {
|
||||||
|
fail "failed to extract child pid"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_test "detach" "Inferior 1 .* detached.*" "detach from first instance"
|
||||||
|
|
||||||
|
# Kill the detached process, to avoid hanging when exiting GDBserver,
|
||||||
|
# when testing with the native-extended-gdbserver board.
|
||||||
|
remote_exec target "kill $child_pid"
|
||||||
|
} elseif { $action1 == "add" } {
|
||||||
|
gdb_test "add-inferior -exec $::binfile" \
|
||||||
|
"Added inferior 2 on connection 1.*" "add-inferior"
|
||||||
|
gdb_test "inferior 2" "Switching to inferior 2 .*"
|
||||||
|
} elseif { $action1 == "none" } {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
error "invalid action 1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $action2 == "start" } {
|
||||||
|
gdb_test "start" "Temporary breakpoint $::decimal\(?:\.$::decimal\)?, main .*"
|
||||||
|
} elseif { $action2 == "run" } {
|
||||||
|
gdb_test "break main" "Breakpoint $::decimal at $::hex.*"
|
||||||
|
gdb_test "run" "Breakpoint $::decimal\(?:\.$::decimal\)?, main .*"
|
||||||
|
} elseif { $action2 == "attach" } {
|
||||||
|
set test_spawn_id [spawn_wait_for_attach $::binfile]
|
||||||
|
set test_pid [spawn_id_get_pid $test_spawn_id]
|
||||||
|
|
||||||
|
if { [gdb_attach $test_pid] } {
|
||||||
|
gdb_test "detach" "Inferior $::decimal .* detached.*" \
|
||||||
|
"detach from second instance"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Detach and kill this inferior so we don't leave it around.
|
||||||
|
kill_wait_spawned_process $test_spawn_id
|
||||||
|
} else {
|
||||||
|
error "invalid action 2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach_with_prefix action1 { kill detach add none } {
|
||||||
|
foreach_with_prefix action2 { start run attach } {
|
||||||
|
do_test $action1 $action2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,10 +42,10 @@ proc stap_test {exec_name {args ""}} {
|
|||||||
"check argument not at probe point"
|
"check argument not at probe point"
|
||||||
|
|
||||||
if {[string first "-DUSE_SEMAPHORES" $args] != -1} {
|
if {[string first "-DUSE_SEMAPHORES" $args] != -1} {
|
||||||
gdb_test "info probes stap" \
|
gdb_test_lines "info probes stap" "" \
|
||||||
"test *user *$hex *$hex .*"
|
"test *user *$hex *$hex .*"
|
||||||
} else {
|
} else {
|
||||||
gdb_test "info probes stap" \
|
gdb_test_lines "info probes stap" "" \
|
||||||
"test *user *$hex .*"
|
"test *user *$hex .*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ gdb_breakpoint "foo"
|
|||||||
gdb_continue_to_breakpoint "foo"
|
gdb_continue_to_breakpoint "foo"
|
||||||
|
|
||||||
gdb_test_multiple "return 35" "" {
|
gdb_test_multiple "return 35" "" {
|
||||||
-re ".*Function 'foo' does not follow the target calling convention.\r\nIf you continue, setting the return value will probably lead to unpredictable behaviors.\r\nMake foo return now?.*\\(y or n\\) $" {
|
-re "Function 'foo' does not follow the target calling convention.\r\nIf you continue, setting the return value will probably lead to unpredictable behaviors.\r\nMake foo return now\\? \\(y or n\\) $" {
|
||||||
send_gdb "n\n"
|
|
||||||
pass $gdb_test_name
|
pass $gdb_test_name
|
||||||
|
gdb_test "n" "Not confirmed" "cancel return"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ if {![dwarf2_support]} {
|
|||||||
|
|
||||||
standard_testfile .S -main.c
|
standard_testfile .S -main.c
|
||||||
|
|
||||||
|
set binfile_stripped ${binfile}-stripped
|
||||||
|
|
||||||
if { [prepare_for_testing "failed to prepare" "${testfile}" \
|
if { [prepare_for_testing "failed to prepare" "${testfile}" \
|
||||||
[list $srcfile2 $srcfile] {nodebug}] } {
|
[list $srcfile2 $srcfile] {nodebug nopie}] } {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +42,7 @@ gdb_unload
|
|||||||
# Strip out any labels there as they could corrupt the `main' name.
|
# Strip out any labels there as they could corrupt the `main' name.
|
||||||
|
|
||||||
set objcopy_program [gdb_find_objcopy]
|
set objcopy_program [gdb_find_objcopy]
|
||||||
set command "$objcopy_program -N block_start -N block_end -N break_at ${binfile}"
|
set command "$objcopy_program -N block_start -N block_end -N break_at ${binfile} ${binfile_stripped}"
|
||||||
verbose -log "Executing: $command"
|
verbose -log "Executing: $command"
|
||||||
set result [catch "exec $command" output]
|
set result [catch "exec $command" output]
|
||||||
verbose "result is $result"
|
verbose "result is $result"
|
||||||
@@ -49,7 +51,7 @@ if {$result != 0} {
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_load ${binfile}
|
gdb_load ${binfile_stripped}
|
||||||
|
|
||||||
if ![runto "*${break_at}"] {
|
if ![runto "*${break_at}"] {
|
||||||
return -1
|
return -1
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ proc test_1 { _cv _cdw64 _lv _ldw64 {_string_form ""}} {
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_breakpoint "bar"
|
gdb_breakpoint "bar_label"
|
||||||
gdb_continue_to_breakpoint "foo \\(1\\)"
|
gdb_continue_to_breakpoint "foo \\(1\\)"
|
||||||
|
|
||||||
gdb_test "next" "foo \\(2\\).*" "next to foo (2)"
|
gdb_test "next" "foo \\(2\\).*" "next to foo (2)"
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ gdb_test_multiple "maintenance print symbols" "" {
|
|||||||
-re "^\r\n void main.T.Bar\[^\r\n\]*(?=\r\n)" {
|
-re "^\r\n void main.T.Bar\[^\r\n\]*(?=\r\n)" {
|
||||||
exp_continue
|
exp_continue
|
||||||
}
|
}
|
||||||
-re "\r\n$gdb_prompt $" {
|
-re "^\r\n$gdb_prompt $" {
|
||||||
pass $gdb_test_name
|
pass $gdb_test_name
|
||||||
}
|
}
|
||||||
-re "\r\n\[^\r\n\]*(?=\r\n)" {
|
-re "\r\n\[^\r\n\]*(?=\r\n)" {
|
||||||
|
|||||||
73
gdb/testsuite/gdb.mi/mi-cmd-user-context.c
Normal file
73
gdb/testsuite/gdb.mi/mi-cmd-user-context.c
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/* This testcase is part of GDB, the GNU debugger.
|
||||||
|
|
||||||
|
Copyright 2016-2022 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define NUM_THREADS 2
|
||||||
|
|
||||||
|
static volatile int unblock_main[NUM_THREADS];
|
||||||
|
|
||||||
|
static void
|
||||||
|
child_sub_function (int child_idx)
|
||||||
|
{
|
||||||
|
volatile int dummy = 0;
|
||||||
|
|
||||||
|
unblock_main[child_idx] = 1;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
/* Dummy loop body to allow setting breakpoint. */
|
||||||
|
dummy = !dummy; /* thread loop line */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
child_function (void *args)
|
||||||
|
{
|
||||||
|
int child_idx = (int) (uintptr_t) args;
|
||||||
|
|
||||||
|
child_sub_function (child_idx); /* thread caller line */
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
pthread_t threads[NUM_THREADS];
|
||||||
|
|
||||||
|
/* Make the test exit eventually. */
|
||||||
|
alarm (20);
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_THREADS; i++)
|
||||||
|
pthread_create (&threads[i], NULL, child_function, (void *) (uintptr_t) i);
|
||||||
|
|
||||||
|
/* Wait for child threads to reach child_sub_function. */
|
||||||
|
for (i = 0; i < NUM_THREADS; i++)
|
||||||
|
while (!unblock_main[i])
|
||||||
|
;
|
||||||
|
|
||||||
|
volatile int dummy = 0;
|
||||||
|
while (1)
|
||||||
|
/* Dummy loop body to allow setting breakpoint. */
|
||||||
|
dummy = !dummy; /* main break line */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
load_lib mi-support.exp
|
load_lib mi-support.exp
|
||||||
|
|
||||||
standard_testfile user-selected-context-sync.c
|
standard_testfile
|
||||||
|
|
||||||
if {[build_executable $testfile.exp $testfile ${srcfile} "debug pthreads"] == -1} {
|
if {[build_executable $testfile.exp $testfile ${srcfile} "debug pthreads"] == -1} {
|
||||||
untested "failed to compile"
|
untested "failed to compile"
|
||||||
@@ -79,7 +79,7 @@ mi_gdb_test "thread" \
|
|||||||
|
|
||||||
# Check we're in frame 0.
|
# Check we're in frame 0.
|
||||||
mi_gdb_test "frame" \
|
mi_gdb_test "frame" \
|
||||||
".*#0 0x.*" \
|
".*#0 .*child_sub_function .*" \
|
||||||
"frame 1"
|
"frame 1"
|
||||||
|
|
||||||
# Ask about a different frame in the current thread, the current frame
|
# Ask about a different frame in the current thread, the current frame
|
||||||
@@ -93,7 +93,7 @@ mi_gdb_test "thread" \
|
|||||||
"info thread 6"
|
"info thread 6"
|
||||||
|
|
||||||
mi_gdb_test "frame" \
|
mi_gdb_test "frame" \
|
||||||
".*#0 0x.*" \
|
".*#0 .*child_sub_function.*" \
|
||||||
"frame 2"
|
"frame 2"
|
||||||
|
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ mi_gdb_test "thread" \
|
|||||||
"info thread 7"
|
"info thread 7"
|
||||||
|
|
||||||
mi_gdb_test "frame" \
|
mi_gdb_test "frame" \
|
||||||
".*#0 0x.*" \
|
".*#0 .*child_sub_function.*" \
|
||||||
"frame 3"
|
"frame 3"
|
||||||
|
|
||||||
# Select a different frame in the current thread. Despite the use of
|
# Select a different frame in the current thread. Despite the use of
|
||||||
@@ -123,7 +123,7 @@ mi_gdb_test "thread" \
|
|||||||
"info thread 8"
|
"info thread 8"
|
||||||
|
|
||||||
mi_gdb_test "frame" \
|
mi_gdb_test "frame" \
|
||||||
".*#1 0x.*" \
|
".*#1 .*child_function.*" \
|
||||||
"frame 4"
|
"frame 4"
|
||||||
|
|
||||||
# Similar to the previous test, but this time the --frame option is
|
# Similar to the previous test, but this time the --frame option is
|
||||||
|
|||||||
26
gdb/testsuite/gdb.multi/attach-while-running.c
Normal file
26
gdb/testsuite/gdb.multi/attach-while-running.c
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/* This testcase is part of GDB, the GNU debugger.
|
||||||
|
|
||||||
|
Copyright 2022 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int global_var = 123;
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
sleep (30);
|
||||||
|
}
|
||||||
73
gdb/testsuite/gdb.multi/attach-while-running.exp
Normal file
73
gdb/testsuite/gdb.multi/attach-while-running.exp
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# Copyright 2022 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# This test was introduced to reproduce a specific bug in GDBserver, where
|
||||||
|
# attaching an inferior while another one was running would trigger a segfault
|
||||||
|
# in GDBserver. Reproducing the bug required specific circumstances:
|
||||||
|
#
|
||||||
|
# - The first process must be far enough to have loaded its libc or
|
||||||
|
# libpthread (whatever triggers the loading of libthread_db), such that
|
||||||
|
# its proc->priv->thread_db is not nullptr
|
||||||
|
#
|
||||||
|
# - However, its lwp must still be in the `!lwp->thread_known` state,
|
||||||
|
# meaning GDBserver hasn't asked libthread_db to compute the thread
|
||||||
|
# handle yet. That means, GDB must not have refreshed the thread list
|
||||||
|
# yet, since that would cause the thread handles to be computed. That
|
||||||
|
# means, no stopping on a breakpoint, since that causes a thread list
|
||||||
|
# update. That's why the first inferior needs to be started with "run
|
||||||
|
# &".
|
||||||
|
#
|
||||||
|
# - Attaching the second process would segfault GDBserver.
|
||||||
|
#
|
||||||
|
# All of this to say, if modifying this test, please keep in mind the original
|
||||||
|
# intent.
|
||||||
|
|
||||||
|
standard_testfile
|
||||||
|
|
||||||
|
if [use_gdb_stub] {
|
||||||
|
unsupported "test requires running"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [build_executable "failed to prepare" ${testfile} ${srcfile}] } {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
proc do_test {} {
|
||||||
|
save_vars { $::GDBFLAGS } {
|
||||||
|
append ::GDBFLAGS " -ex \"maint set target-non-stop on\""
|
||||||
|
clean_restart $::binfile
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_test_multiple "run &" "" {
|
||||||
|
-re ".*$::gdb_prompt " {
|
||||||
|
pass $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gdb_test "add-inferior" "Added inferior 2 on connection 1 .*"
|
||||||
|
gdb_test "inferior 2" "Switching to inferior 2 .*"
|
||||||
|
|
||||||
|
set spawn_id [spawn_wait_for_attach $::binfile]
|
||||||
|
set pid [spawn_id_get_pid $spawn_id]
|
||||||
|
|
||||||
|
# This call would crash GDBserver.
|
||||||
|
gdb_attach $pid
|
||||||
|
|
||||||
|
# Read a variable from the inferior, just to make sure the attach worked
|
||||||
|
# fine.
|
||||||
|
gdb_test "print global_var" " = 123"
|
||||||
|
}
|
||||||
|
|
||||||
|
do_test
|
||||||
@@ -76,6 +76,9 @@ proc test_value_creation {} {
|
|||||||
|
|
||||||
# Test address attribute is None in a non-addressable value
|
# Test address attribute is None in a non-addressable value
|
||||||
gdb_test "python print ('result = %s' % i.address)" "= None" "test address attribute in non-addressable value"
|
gdb_test "python print ('result = %s' % i.address)" "= None" "test address attribute in non-addressable value"
|
||||||
|
|
||||||
|
# Test creating / printing an optimized out value
|
||||||
|
gdb_test "python print(gdb.Value(gdb.Value(5).type.optimized_out()))"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that we can call gdb.Value.__init__ to change a value.
|
# Check that we can call gdb.Value.__init__ to change a value.
|
||||||
|
|||||||
@@ -145,3 +145,5 @@ gdb_test "print 0x0 as fn(i64) -> ()" " = \\\(\\*mut fn \\\(i64\\\) -> \\\(\\\)\
|
|||||||
gdb_test "print r#" "No symbol 'r' in current context"
|
gdb_test "print r#" "No symbol 'r' in current context"
|
||||||
|
|
||||||
gdb_test "printf \"%d %d\\n\", 23+1, 23-1" "24 22"
|
gdb_test "printf \"%d %d\\n\", 23+1, 23-1" "24 22"
|
||||||
|
|
||||||
|
gdb_test "print 5," "Syntax error near ','"
|
||||||
|
|||||||
@@ -56,46 +56,165 @@ standard_testfile
|
|||||||
|
|
||||||
set bp_lineno [gdb_get_line_number "Set breakpoint here"]
|
set bp_lineno [gdb_get_line_number "Set breakpoint here"]
|
||||||
|
|
||||||
# The test proper. See description above.
|
# Number of threads started by the program.
|
||||||
proc test {condition_eval target_non_stop non_stop displaced} {
|
set n_threads 10
|
||||||
global binfile srcfile
|
|
||||||
global gdb_prompt
|
|
||||||
global decimal
|
|
||||||
global bp_lineno
|
|
||||||
global GDBFLAGS
|
|
||||||
|
|
||||||
# Number of threads started by the program.
|
# Start GDB, configuring various settings according to the arguments.
|
||||||
set n_threads 10
|
proc start_gdb_for_test {condition_eval target_non_stop non_stop displaced} {
|
||||||
|
save_vars { ::GDBFLAGS } {
|
||||||
save_vars { GDBFLAGS } {
|
append ::GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\""
|
||||||
append GDBFLAGS " -ex \"maint set target-non-stop $target_non_stop\""
|
append ::GDBFLAGS " -ex \"set non-stop $non_stop\""
|
||||||
append GDBFLAGS " -ex \"set non-stop $non_stop\""
|
append ::GDBFLAGS " -ex \"set displaced $displaced\""
|
||||||
append GDBFLAGS " -ex \"set displaced $displaced\""
|
append ::GDBFLAGS " -ex \"set schedule-multiple on\""
|
||||||
append GDBFLAGS " -ex \"set schedule-multiple on\""
|
clean_restart $::binfile
|
||||||
clean_restart $binfile
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set test_spawn_id [spawn_wait_for_attach $binfile]
|
gdb_test_no_output "set breakpoint condition-evaluation $condition_eval"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use the 'attach' command to attach to process with pid TESTPID. Return true
|
||||||
|
# if we believe GDB has attached and we are back at the GDB prompt, otherwise,
|
||||||
|
# return false.
|
||||||
|
proc attach_to {testpid} {
|
||||||
|
with_timeout_factor 2 {
|
||||||
|
set attached 0
|
||||||
|
set saw_attaching 0
|
||||||
|
gdb_test_multiple "attach $testpid" "attach" {
|
||||||
|
-re "Attaching to program.*process $testpid\r\n" {
|
||||||
|
set saw_attaching 1
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
-re "new threads in iteration" {
|
||||||
|
# Seen when "set debug libthread_db" is on.
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
-re "Reading symbols from|Expanding full symbols from" {
|
||||||
|
# Prevent -readnow timeout.
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
-re "is a zombie - the process has already terminated.*$::gdb_prompt " {
|
||||||
|
fail $gdb_test_name
|
||||||
|
}
|
||||||
|
-re "Unable to attach: .*$::gdb_prompt " {
|
||||||
|
fail $gdb_test_name
|
||||||
|
}
|
||||||
|
-re "\r\n$::gdb_prompt " {
|
||||||
|
if { $saw_attaching } {
|
||||||
|
set attached 1
|
||||||
|
pass $gdb_test_name
|
||||||
|
} else {
|
||||||
|
fail $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $attached
|
||||||
|
}
|
||||||
|
|
||||||
|
# After attaching to a multi-threaded inferior in non-stop mode, we expect to
|
||||||
|
# see a stop message from each thread. This proc waits for all of these stop
|
||||||
|
# messages. TID_RE is a regexp used to match the thread-id of the stopped
|
||||||
|
# thread.
|
||||||
|
#
|
||||||
|
# Return true if we saw a stop from each of the expected threads (based on the
|
||||||
|
# global N_THREADS value), otherwise, return false.
|
||||||
|
proc check_stops_after_non_stop_attach {tid_re} {
|
||||||
|
set any "\[^\r\n\]*"
|
||||||
|
|
||||||
|
# In non-stop, we will see one stop per thread after the prompt.
|
||||||
|
set stops 0
|
||||||
|
set test "seen all stops"
|
||||||
|
for {set thread 1} { $thread <= $::n_threads } { incr thread } {
|
||||||
|
if {[gdb_test_multiple "" $test {
|
||||||
|
-re "Thread ${tid_re} ${any} stopped" {
|
||||||
|
incr stops
|
||||||
|
}
|
||||||
|
}] != 0} {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# If we haven't seen all stops, then the
|
||||||
|
# gdb_test_multiple in the loop above will have
|
||||||
|
# already issued a FAIL.
|
||||||
|
if {$stops != $::n_threads} {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
pass $test
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prepare for a single test iteration. TESTPID is the pid of the process GDB
|
||||||
|
# will be attached too. NON_STOP indicates if GDB is configured in non-stop
|
||||||
|
# mode or not. ATTEMPT is the current attempt number, and ATTEMPTS is the
|
||||||
|
# maximum number of attempts we plan to run. TID_RE is a string used to match
|
||||||
|
# against a thread-id in GDB's stop messages.
|
||||||
|
#
|
||||||
|
# Return true if everything is prepared correctly, otherwise return false.
|
||||||
|
proc prepare_test_iter {testpid non_stop attempt attempts tid_re} {
|
||||||
|
if {![attach_to $testpid]} {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$non_stop} {
|
||||||
|
if {![check_stops_after_non_stop_attach $tid_re]} {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_test "break ${::srcfile}:${::bp_lineno} if 0" "Breakpoint.*" \
|
||||||
|
"break LOC if 0"
|
||||||
|
|
||||||
|
if {$attempt < $attempts} {
|
||||||
|
# Kick the time out timer for another round.
|
||||||
|
gdb_test "print again = 1" " = 1" "reset timer in the inferior"
|
||||||
|
# Show the time we had left in the logs, in case
|
||||||
|
# something goes wrong.
|
||||||
|
gdb_test "print seconds_left" " = .*"
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$non_stop} {
|
||||||
|
set cont_cmd "continue -a &"
|
||||||
|
} else {
|
||||||
|
set cont_cmd "continue &"
|
||||||
|
}
|
||||||
|
|
||||||
|
set cont_cmd_re [string_to_regexp $cont_cmd]
|
||||||
|
gdb_test_multiple $cont_cmd "" {
|
||||||
|
-re "^$cont_cmd_re\r\nContinuing\.\r\n$::gdb_prompt " {
|
||||||
|
pass $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait a bit, to give time for the threads to hit the
|
||||||
|
# breakpoint.
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
# The test proper. See the description at the top of the file.
|
||||||
|
proc_with_prefix test_detach_command {condition_eval target_non_stop non_stop displaced} {
|
||||||
|
set test_spawn_id [spawn_wait_for_attach $::binfile]
|
||||||
set testpid [spawn_id_get_pid $test_spawn_id]
|
set testpid [spawn_id_get_pid $test_spawn_id]
|
||||||
|
|
||||||
set any "\[^\r\n\]*"
|
start_gdb_for_test $condition_eval $target_non_stop $non_stop $displaced
|
||||||
|
|
||||||
gdb_test "add-inferior" "Added inferior 2.*"
|
gdb_test "add-inferior" "Added inferior 2.*"
|
||||||
gdb_test "inferior 2" "Switching to .*"
|
gdb_test "inferior 2" "Switching to .*"
|
||||||
|
|
||||||
gdb_load $binfile
|
gdb_load $::binfile
|
||||||
if ![runto setup_done] then {
|
if ![runto setup_done] then {
|
||||||
fail "can't run to setup_done"
|
fail "can't run to setup_done"
|
||||||
kill_wait_spawned_process $test_spawn_id
|
kill_wait_spawned_process $test_spawn_id
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
gdb_test_no_output "set breakpoint condition-evaluation $condition_eval"
|
|
||||||
|
|
||||||
# Get the PID of the test process.
|
# Get the PID of the test process.
|
||||||
set pid_inf2 ""
|
set pid_inf2 ""
|
||||||
gdb_test_multiple "p mypid" "get pid of inferior 2" {
|
gdb_test_multiple "p mypid" "get pid of inferior 2" {
|
||||||
-re " = ($decimal)\r\n$gdb_prompt $" {
|
-re " = ($::decimal)\r\n$::gdb_prompt $" {
|
||||||
set pid_inf2 $expect_out(1,string)
|
set pid_inf2 $expect_out(1,string)
|
||||||
pass $gdb_test_name
|
pass $gdb_test_name
|
||||||
}
|
}
|
||||||
@@ -106,101 +225,12 @@ proc test {condition_eval target_non_stop non_stop displaced} {
|
|||||||
with_test_prefix "iter $attempt" {
|
with_test_prefix "iter $attempt" {
|
||||||
gdb_test "inferior 1" "Switching to .*"
|
gdb_test "inferior 1" "Switching to .*"
|
||||||
|
|
||||||
with_timeout_factor 2 {
|
if {![prepare_test_iter $testpid $non_stop \
|
||||||
set attached 0
|
$attempt $attempts "$::decimal\.$::decimal"]} {
|
||||||
set saw_attaching 0
|
|
||||||
set eperm 0
|
|
||||||
set test "attach"
|
|
||||||
gdb_test_multiple "attach $testpid" $test {
|
|
||||||
-re "Attaching to program.*process $testpid\r\n" {
|
|
||||||
set saw_attaching 1
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "new threads in iteration" {
|
|
||||||
# Seen when "set debug libthread_db" is on.
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "Reading symbols from|Expanding full symbols from" {
|
|
||||||
# Prevent -readnow timeout.
|
|
||||||
exp_continue
|
|
||||||
}
|
|
||||||
-re "is a zombie - the process has already terminated.*$gdb_prompt " {
|
|
||||||
fail $gdb_test_name
|
|
||||||
}
|
|
||||||
-re "Unable to attach: .*$gdb_prompt " {
|
|
||||||
fail $gdb_test_name
|
|
||||||
}
|
|
||||||
-re "\r\n$gdb_prompt " {
|
|
||||||
if { $saw_attaching } {
|
|
||||||
set attached 1
|
|
||||||
pass $test
|
|
||||||
} else {
|
|
||||||
fail $test
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if {!$attached} {
|
|
||||||
kill_wait_spawned_process $test_spawn_id
|
kill_wait_spawned_process $test_spawn_id
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if {$non_stop} {
|
|
||||||
# In non-stop, we will see one stop per thread after
|
|
||||||
# the prompt.
|
|
||||||
set stops 0
|
|
||||||
set tid_re "$::decimal\.$::decimal"
|
|
||||||
set test "seen all stops"
|
|
||||||
for {set thread 1} { $thread <= $n_threads } { incr thread } {
|
|
||||||
if {[gdb_test_multiple "" $test {
|
|
||||||
-re "Thread ${tid_re} ${any} stopped" {
|
|
||||||
incr stops
|
|
||||||
}
|
|
||||||
}] != 0} {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# If we haven't seen all stops, then the
|
|
||||||
# gdb_test_multiple in the loop above will have
|
|
||||||
# already issued a FAIL.
|
|
||||||
if {$stops != $n_threads} {
|
|
||||||
kill_wait_spawned_process $test_spawn_id
|
|
||||||
return
|
|
||||||
}
|
|
||||||
pass $test
|
|
||||||
}
|
|
||||||
|
|
||||||
# Set threads stepping over a breakpoint continuously.
|
|
||||||
gdb_test "break $srcfile:$bp_lineno if 0" "Breakpoint.*" \
|
|
||||||
"break LOC if 0"
|
|
||||||
|
|
||||||
if {$attempt < $attempts} {
|
|
||||||
# Kick the time out timer for another round.
|
|
||||||
gdb_test "print again = 1" " = 1" "reset timer in the inferior"
|
|
||||||
# Show the time we had left in the logs, in case
|
|
||||||
# something goes wrong.
|
|
||||||
gdb_test "print seconds_left" " = .*"
|
|
||||||
}
|
|
||||||
|
|
||||||
if {$non_stop} {
|
|
||||||
set cont_cmd "continue -a &"
|
|
||||||
} else {
|
|
||||||
set cont_cmd "continue &"
|
|
||||||
}
|
|
||||||
|
|
||||||
set cont_cmd_re [string_to_regexp $cont_cmd]
|
|
||||||
gdb_test_multiple $cont_cmd "" {
|
|
||||||
-re "^$cont_cmd_re\r\nContinuing\.\r\n$gdb_prompt " {
|
|
||||||
pass $gdb_test_name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Wait a bit, to give time for the threads to hit the
|
|
||||||
# breakpoint.
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
set running_count 0
|
set running_count 0
|
||||||
set interrupted 0
|
set interrupted 0
|
||||||
gdb_test_multiple "info threads" "all threads running" {
|
gdb_test_multiple "info threads" "all threads running" {
|
||||||
@@ -208,14 +238,14 @@ proc test {condition_eval target_non_stop non_stop displaced} {
|
|||||||
incr running_count
|
incr running_count
|
||||||
exp_continue
|
exp_continue
|
||||||
}
|
}
|
||||||
-re "Cannot execute this command while the target is running.*$gdb_prompt $" {
|
-re "Cannot execute this command while the target is running.*$::gdb_prompt $" {
|
||||||
# Testing against a remote server that doesn't do
|
# Testing against a remote server that doesn't do
|
||||||
# non-stop mode. Explicitly interrupt. This
|
# non-stop mode. Explicitly interrupt. This
|
||||||
# doesn't test the same code paths in GDB, but
|
# doesn't test the same code paths in GDB, but
|
||||||
# it's still something.
|
# it's still something.
|
||||||
set interrupted 1
|
set interrupted 1
|
||||||
gdb_test_multiple "interrupt" "" {
|
gdb_test_multiple "interrupt" "" {
|
||||||
-re "$gdb_prompt " {
|
-re "$::gdb_prompt " {
|
||||||
gdb_test_multiple "" $gdb_test_name {
|
gdb_test_multiple "" $gdb_test_name {
|
||||||
-re "received signal SIGINT, Interrupt" {
|
-re "received signal SIGINT, Interrupt" {
|
||||||
pass $gdb_test_name
|
pass $gdb_test_name
|
||||||
@@ -224,8 +254,9 @@ proc test {condition_eval target_non_stop non_stop displaced} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-re "$gdb_prompt $" {
|
-re "$::gdb_prompt $" {
|
||||||
gdb_assert {$running_count == ($n_threads + 1) * 2} $gdb_test_name
|
gdb_assert {$running_count == ($::n_threads + 1) * 2} \
|
||||||
|
$gdb_test_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,6 +284,56 @@ proc test {condition_eval target_non_stop non_stop displaced} {
|
|||||||
kill_wait_spawned_process $test_spawn_id
|
kill_wait_spawned_process $test_spawn_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Similar to the proc above, but this time, instead of detaching using
|
||||||
|
# the 'detach' command, we quit GDB, this will also trigger a detach, but
|
||||||
|
# through a slightly different path, which can expose different bugs.
|
||||||
|
proc_with_prefix test_detach_quit {condition_eval target_non_stop \
|
||||||
|
non_stop displaced} {
|
||||||
|
# If debugging with target remote, check whether the all-stop variant
|
||||||
|
# of the RSP is being used. If so, we can't run the background tests.
|
||||||
|
if {!$non_stop
|
||||||
|
&& [target_info exists gdb_protocol]
|
||||||
|
&& ([target_info gdb_protocol] == "remote"
|
||||||
|
|| [target_info gdb_protocol] == "extended-remote")} {
|
||||||
|
start_gdb_for_test $condition_eval $target_non_stop \
|
||||||
|
$non_stop $displaced
|
||||||
|
|
||||||
|
gdb_test_multiple "maint show target-non-stop" "" {
|
||||||
|
-wrap -re "(is|currently) on.*" {
|
||||||
|
}
|
||||||
|
-wrap -re "(is|currently) off.*" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set test_spawn_id [spawn_wait_for_attach $::binfile]
|
||||||
|
set testpid [spawn_id_get_pid $test_spawn_id]
|
||||||
|
|
||||||
|
set attempts 3
|
||||||
|
for {set attempt 1} { $attempt <= $attempts } { incr attempt } {
|
||||||
|
with_test_prefix "iter $attempt" {
|
||||||
|
|
||||||
|
start_gdb_for_test $condition_eval $target_non_stop \
|
||||||
|
$non_stop $displaced
|
||||||
|
|
||||||
|
if {![prepare_test_iter $testpid $non_stop \
|
||||||
|
$attempt $attempts "$::decimal"]} {
|
||||||
|
kill_wait_spawned_process $test_spawn_id
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_test_multiple "with confirm off -- quit" "" {
|
||||||
|
eof {
|
||||||
|
pass $gdb_test_name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kill_wait_spawned_process $test_spawn_id
|
||||||
|
}
|
||||||
|
|
||||||
# The test program exits after a while, in case GDB crashes. Make it
|
# The test program exits after a while, in case GDB crashes. Make it
|
||||||
# wait at least as long as we may wait before declaring a time out
|
# wait at least as long as we may wait before declaring a time out
|
||||||
# failure.
|
# failure.
|
||||||
@@ -298,7 +379,10 @@ foreach_with_prefix breakpoint-condition-evaluation {"host" "target"} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach_with_prefix displaced {"off" "auto"} {
|
foreach_with_prefix displaced {"off" "auto"} {
|
||||||
test ${breakpoint-condition-evaluation} ${target-non-stop} ${non-stop} ${displaced}
|
test_detach_command ${breakpoint-condition-evaluation} \
|
||||||
|
${target-non-stop} ${non-stop} ${displaced}
|
||||||
|
test_detach_quit ${breakpoint-condition-evaluation} \
|
||||||
|
${target-non-stop} ${non-stop} ${displaced}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5151,6 +5151,32 @@ gdb_caching_proc can_spawn_for_attach {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Centralize the failure checking of "attach" command.
|
||||||
|
# Return 0 if attach failed, otherwise return 1.
|
||||||
|
|
||||||
|
proc gdb_attach { testpid args } {
|
||||||
|
parse_args {
|
||||||
|
{pattern ""}
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [llength $args] != 0 } {
|
||||||
|
error "Unexpected arguments: $args"
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_test_multiple "attach $testpid" "attach" {
|
||||||
|
-re -wrap "Attaching to.*ptrace: Operation not permitted\\." {
|
||||||
|
unsupported "$gdb_test_name (Operation not permitted)"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
-re -wrap "$pattern" {
|
||||||
|
pass $gdb_test_name
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# Kill a progress previously started with spawn_wait_for_attach, and
|
# Kill a progress previously started with spawn_wait_for_attach, and
|
||||||
# reap its wait status. PROC_SPAWN_ID is the spawn id associated with
|
# reap its wait status. PROC_SPAWN_ID is the spawn id associated with
|
||||||
# the process.
|
# the process.
|
||||||
@@ -8302,6 +8328,29 @@ gdb_caching_proc have_mpx {
|
|||||||
|
|
||||||
remote_file build delete $obj
|
remote_file build delete $obj
|
||||||
|
|
||||||
|
if { $status == 0 } {
|
||||||
|
verbose "$me: returning $status" 2
|
||||||
|
return $status
|
||||||
|
}
|
||||||
|
|
||||||
|
# Compile program with -mmpx -fcheck-pointer-bounds, try to trigger
|
||||||
|
# 'No MPX support', in other words, see if kernel supports mpx.
|
||||||
|
set src { int main (void) { return 0; } }
|
||||||
|
set comp_flags {}
|
||||||
|
append comp_flags " additional_flags=-mmpx"
|
||||||
|
append comp_flags " additional_flags=-fcheck-pointer-bounds"
|
||||||
|
if {![gdb_simple_compile $me-2 $src executable $comp_flags]} {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
set result [remote_exec target $obj]
|
||||||
|
set status [lindex $result 0]
|
||||||
|
set output [lindex $result 1]
|
||||||
|
set status [expr ($status == 0) \
|
||||||
|
&& ![string equal $output "No MPX support\r\n"]]
|
||||||
|
|
||||||
|
remote_file build delete $obj
|
||||||
|
|
||||||
verbose "$me: returning $status" 2
|
verbose "$me: returning $status" 2
|
||||||
return $status
|
return $status
|
||||||
}
|
}
|
||||||
|
|||||||
39
gdb/top.c
39
gdb/top.c
@@ -260,6 +260,41 @@ void (*deprecated_context_hook) (int id);
|
|||||||
/* The highest UI number ever assigned. */
|
/* The highest UI number ever assigned. */
|
||||||
static int highest_ui_num;
|
static int highest_ui_num;
|
||||||
|
|
||||||
|
/* Unbuffer STREAM. This is a wrapper around setbuf(STREAM, nullptr)
|
||||||
|
which applies some special rules for MS-Windows hosts. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
unbuffer_stream (FILE *stream)
|
||||||
|
{
|
||||||
|
/* Unbuffer the input stream so that in gdb_readline_no_editing_callback,
|
||||||
|
the calls to fgetc fetch only one char at the time from STREAM.
|
||||||
|
|
||||||
|
This is important because gdb_readline_no_editing_callback will read
|
||||||
|
from STREAM up to the first '\n' character, after this GDB returns to
|
||||||
|
the event loop and relies on a select on STREAM indicating that more
|
||||||
|
input is pending.
|
||||||
|
|
||||||
|
If STREAM is buffered then the fgetc calls may have moved all the
|
||||||
|
pending input from the kernel into a local buffer, after which the
|
||||||
|
select will not indicate that more input is pending, and input after
|
||||||
|
the first '\n' will not be processed immediately.
|
||||||
|
|
||||||
|
Please ensure that any changes in this area run the MI tests with the
|
||||||
|
FORCE_SEPARATE_MI_TTY=1 flag being passed. */
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
/* With MS-Windows runtime, making stdin unbuffered when it's
|
||||||
|
connected to the terminal causes it to misbehave. */
|
||||||
|
if (!ISATTY (stream))
|
||||||
|
setbuf (stream, nullptr);
|
||||||
|
#else
|
||||||
|
/* On GNU/Linux the issues described above can impact GDB even when
|
||||||
|
dealing with input from a terminal. For now we unbuffer the input
|
||||||
|
stream for everyone except MS-Windows. */
|
||||||
|
setbuf (stream, nullptr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* See top.h. */
|
/* See top.h. */
|
||||||
|
|
||||||
ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)
|
ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)
|
||||||
@@ -286,6 +321,8 @@ ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)
|
|||||||
{
|
{
|
||||||
buffer_init (&line_buffer);
|
buffer_init (&line_buffer);
|
||||||
|
|
||||||
|
unbuffer_stream (instream_);
|
||||||
|
|
||||||
if (ui_list == NULL)
|
if (ui_list == NULL)
|
||||||
ui_list = this;
|
ui_list = this;
|
||||||
else
|
else
|
||||||
@@ -415,6 +452,8 @@ read_command_file (FILE *stream)
|
|||||||
{
|
{
|
||||||
struct ui *ui = current_ui;
|
struct ui *ui = current_ui;
|
||||||
|
|
||||||
|
unbuffer_stream (stream);
|
||||||
|
|
||||||
scoped_restore save_instream
|
scoped_restore save_instream
|
||||||
= make_scoped_restore (&ui->instream, stream);
|
= make_scoped_restore (&ui->instream, stream);
|
||||||
|
|
||||||
|
|||||||
27
gdb/value.c
27
gdb/value.c
@@ -343,8 +343,10 @@ struct value
|
|||||||
LONGEST embedded_offset = 0;
|
LONGEST embedded_offset = 0;
|
||||||
LONGEST pointed_to_offset = 0;
|
LONGEST pointed_to_offset = 0;
|
||||||
|
|
||||||
/* Actual contents of the value. Target byte-order. NULL or not
|
/* Actual contents of the value. Target byte-order.
|
||||||
valid if lazy is nonzero. */
|
|
||||||
|
May be nullptr if the value is lazy or is entirely optimized out.
|
||||||
|
Guaranteed to be non-nullptr otherwise. */
|
||||||
gdb::unique_xmalloc_ptr<gdb_byte> contents;
|
gdb::unique_xmalloc_ptr<gdb_byte> contents;
|
||||||
|
|
||||||
/* Unavailable ranges in CONTENTS. We mark unavailable ranges,
|
/* Unavailable ranges in CONTENTS. We mark unavailable ranges,
|
||||||
@@ -1725,8 +1727,10 @@ value_copy (const value *arg)
|
|||||||
val->stack = arg->stack;
|
val->stack = arg->stack;
|
||||||
val->is_zero = arg->is_zero;
|
val->is_zero = arg->is_zero;
|
||||||
val->initialized = arg->initialized;
|
val->initialized = arg->initialized;
|
||||||
|
val->unavailable = arg->unavailable;
|
||||||
|
val->optimized_out = arg->optimized_out;
|
||||||
|
|
||||||
if (!value_lazy (val))
|
if (!value_lazy (val) && !value_entirely_optimized_out (val))
|
||||||
{
|
{
|
||||||
gdb_assert (arg->contents != nullptr);
|
gdb_assert (arg->contents != nullptr);
|
||||||
ULONGEST length = TYPE_LENGTH (value_enclosing_type (arg));
|
ULONGEST length = TYPE_LENGTH (value_enclosing_type (arg));
|
||||||
@@ -1735,8 +1739,6 @@ value_copy (const value *arg)
|
|||||||
copy (arg_view, value_contents_all_raw (val));
|
copy (arg_view, value_contents_all_raw (val));
|
||||||
}
|
}
|
||||||
|
|
||||||
val->unavailable = arg->unavailable;
|
|
||||||
val->optimized_out = arg->optimized_out;
|
|
||||||
val->parent = arg->parent;
|
val->parent = arg->parent;
|
||||||
if (VALUE_LVAL (val) == lval_computed)
|
if (VALUE_LVAL (val) == lval_computed)
|
||||||
{
|
{
|
||||||
@@ -4271,6 +4273,20 @@ test_insert_into_bit_range_vector ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_value_copy ()
|
||||||
|
{
|
||||||
|
type *type = builtin_type (current_inferior ()->gdbarch)->builtin_int;
|
||||||
|
|
||||||
|
/* Verify that we can copy an entirely optimized out value, that may not have
|
||||||
|
its contents allocated. */
|
||||||
|
value_ref_ptr val = release_value (allocate_optimized_out_value (type));
|
||||||
|
value_ref_ptr copy = release_value (value_copy (val.get ()));
|
||||||
|
|
||||||
|
SELF_CHECK (value_entirely_optimized_out (val.get ()));
|
||||||
|
SELF_CHECK (value_entirely_optimized_out (copy.get ()));
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace selftests */
|
} /* namespace selftests */
|
||||||
#endif /* GDB_SELF_TEST */
|
#endif /* GDB_SELF_TEST */
|
||||||
|
|
||||||
@@ -4355,6 +4371,7 @@ and exceeds this limit will cause an error."),
|
|||||||
selftests::register_test ("ranges_contain", selftests::test_ranges_contain);
|
selftests::register_test ("ranges_contain", selftests::test_ranges_contain);
|
||||||
selftests::register_test ("insert_into_bit_range_vector",
|
selftests::register_test ("insert_into_bit_range_vector",
|
||||||
selftests::test_insert_into_bit_range_vector);
|
selftests::test_insert_into_bit_range_vector);
|
||||||
|
selftests::register_test ("value_copy", selftests::test_value_copy);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
12.0.50.DATE-git
|
12.1.90.DATE-git
|
||||||
|
|||||||
@@ -155,30 +155,35 @@ thread_db_state_str (td_thr_state_e state)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Get thread info about PTID, accessing memory via the current
|
/* Get thread info about PTID. */
|
||||||
thread. */
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_one_thread (ptid_t ptid)
|
find_one_thread (ptid_t ptid)
|
||||||
{
|
{
|
||||||
td_thrhandle_t th;
|
|
||||||
td_thrinfo_t ti;
|
|
||||||
td_err_e err;
|
|
||||||
struct lwp_info *lwp;
|
|
||||||
struct thread_db *thread_db = current_process ()->priv->thread_db;
|
|
||||||
int lwpid = ptid.lwp ();
|
|
||||||
|
|
||||||
thread_info *thread = find_thread_ptid (ptid);
|
thread_info *thread = find_thread_ptid (ptid);
|
||||||
lwp = get_thread_lwp (thread);
|
lwp_info *lwp = get_thread_lwp (thread);
|
||||||
if (lwp->thread_known)
|
if (lwp->thread_known)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Get information about this thread. */
|
/* Get information about this thread. libthread_db will need to read some
|
||||||
err = thread_db->td_ta_map_lwp2thr_p (thread_db->thread_agent, lwpid, &th);
|
memory, which will be done on the current process, so make PTID's process
|
||||||
|
the current one. */
|
||||||
|
process_info *proc = find_process_pid (ptid.pid ());
|
||||||
|
gdb_assert (proc != nullptr);
|
||||||
|
|
||||||
|
scoped_restore_current_thread restore_thread;
|
||||||
|
switch_to_process (proc);
|
||||||
|
|
||||||
|
thread_db *thread_db = proc->priv->thread_db;
|
||||||
|
td_thrhandle_t th;
|
||||||
|
int lwpid = ptid.lwp ();
|
||||||
|
td_err_e err = thread_db->td_ta_map_lwp2thr_p (thread_db->thread_agent, lwpid,
|
||||||
|
&th);
|
||||||
if (err != TD_OK)
|
if (err != TD_OK)
|
||||||
error ("Cannot get thread handle for LWP %d: %s",
|
error ("Cannot get thread handle for LWP %d: %s",
|
||||||
lwpid, thread_db_err_str (err));
|
lwpid, thread_db_err_str (err));
|
||||||
|
|
||||||
|
td_thrinfo_t ti;
|
||||||
err = thread_db->td_thr_get_info_p (&th, &ti);
|
err = thread_db->td_thr_get_info_p (&th, &ti);
|
||||||
if (err != TD_OK)
|
if (err != TD_OK)
|
||||||
error ("Cannot get thread info for LWP %d: %s",
|
error ("Cannot get thread info for LWP %d: %s",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
# Copyright (C) 2019-2021 Free Software Foundation, Inc.
|
# Copyright (C) 2019-2022 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This file is part of GDB.
|
# This file is part of GDB.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<!-- Parent-Version: 1.78 -->
|
<!-- Parent-Version: 1.78 -->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (C) 2006-2022 Free Software Foundation, Inc.
|
Copyright (C) 2006-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without modification,
|
Copying and distribution of this file, with or without modification,
|
||||||
are permitted in any medium without royalty provided the copyright
|
are permitted in any medium without royalty provided the copyright
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (C) 2007-2022 Free Software Foundation, Inc.
|
Copyright (C) 2007-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without modification,
|
Copying and distribution of this file, with or without modification,
|
||||||
are permitted in any medium without royalty provided the copyright
|
are permitted in any medium without royalty provided the copyright
|
||||||
|
|||||||
@@ -743,6 +743,8 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifndef WINDOWS32
|
#ifndef WINDOWS32
|
||||||
|
/* Recognize ~user as a shorthand for the specified user's home
|
||||||
|
directory. */
|
||||||
char *end_name = strchr (dirname, '/');
|
char *end_name = strchr (dirname, '/');
|
||||||
char *user_name;
|
char *user_name;
|
||||||
int malloc_user_name = 0;
|
int malloc_user_name = 0;
|
||||||
@@ -881,7 +883,22 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
|
|||||||
}
|
}
|
||||||
scratch_buffer_free (&pwtmpbuf);
|
scratch_buffer_free (&pwtmpbuf);
|
||||||
}
|
}
|
||||||
#endif /* !WINDOWS32 */
|
#else /* WINDOWS32 */
|
||||||
|
/* On native Windows, access to a user's home directory
|
||||||
|
(via GetUserProfileDirectory) or to a user's environment
|
||||||
|
variables (via ExpandEnvironmentStringsForUser) requires
|
||||||
|
the credentials of the user. Therefore we cannot support
|
||||||
|
the ~user syntax on this platform.
|
||||||
|
Handling ~user specially (and treat it like plain ~) if
|
||||||
|
user is getenv ("USERNAME") would not be a good idea,
|
||||||
|
since it would make people think that ~user is supported
|
||||||
|
in general. */
|
||||||
|
if (flags & GLOB_TILDE_CHECK)
|
||||||
|
{
|
||||||
|
retval = GLOB_NOMATCH;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
#endif /* WINDOWS32 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -530,12 +530,13 @@ restart:
|
|||||||
if (h != handle_array[nhandles])
|
if (h != handle_array[nhandles])
|
||||||
{
|
{
|
||||||
/* Perform handle->descriptor mapping. */
|
/* Perform handle->descriptor mapping. */
|
||||||
WSAEventSelect ((SOCKET) h, NULL, 0);
|
SOCKET s = (SOCKET) h;
|
||||||
if (FD_ISSET (h, &handle_rfds))
|
WSAEventSelect (s, NULL, 0);
|
||||||
|
if (FD_ISSET (s, &handle_rfds))
|
||||||
FD_SET (i, rfds);
|
FD_SET (i, rfds);
|
||||||
if (FD_ISSET (h, &handle_wfds))
|
if (FD_ISSET (s, &handle_wfds))
|
||||||
FD_SET (i, wfds);
|
FD_SET (i, wfds);
|
||||||
if (FD_ISSET (h, &handle_xfds))
|
if (FD_ISSET (s, &handle_xfds))
|
||||||
FD_SET (i, xfds);
|
FD_SET (i, xfds);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2033,9 +2033,17 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
|
|||||||
# undef swab
|
# undef swab
|
||||||
# define swab _swab
|
# define swab _swab
|
||||||
# endif
|
# endif
|
||||||
_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
|
/* Need to cast, because in old mingw the arguments are
|
||||||
|
(const char *from, char *to, size_t n). */
|
||||||
|
_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
|
||||||
# else
|
# else
|
||||||
|
# if defined __hpux /* HP-UX */
|
||||||
|
_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
|
||||||
|
# elif defined __sun && !defined _XPG4 /* Solaris */
|
||||||
|
_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
|
||||||
|
# else
|
||||||
_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
|
_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
_GL_CXXALIASWARN (swab);
|
_GL_CXXALIASWARN (swab);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
49
gnulib/patches/0002-glob-tilde-check
Normal file
49
gnulib/patches/0002-glob-tilde-check
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
commit 38d0749a3077b03fda46567510b1217fb5e4e170
|
||||||
|
Author: Bruno Haible <bruno@clisp.org>
|
||||||
|
Date: Fri Apr 2 17:34:46 2021 +0200
|
||||||
|
|
||||||
|
glob: Reject ~user syntax, when flag GLOB_TILDE_CHECK is given.
|
||||||
|
|
||||||
|
Reported and patch suggested by Eli Zaretskii <eliz@gnu.org> in
|
||||||
|
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00136.html>.
|
||||||
|
|
||||||
|
* lib/glob.c (__glob) [WINDOWS32]: If flag GLOB_TILDE_CHECK is given, do
|
||||||
|
error handling like when ~user is allowed by the user is unknown.
|
||||||
|
|
||||||
|
diff --git a/gnulib/import/glob.c b/gnulib/import/glob.c
|
||||||
|
index 775911ef5b..e148f8d761 100644
|
||||||
|
--- a/gnulib/import/glob.c
|
||||||
|
+++ b/gnulib/import/glob.c
|
||||||
|
@@ -743,6 +743,8 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifndef WINDOWS32
|
||||||
|
+ /* Recognize ~user as a shorthand for the specified user's home
|
||||||
|
+ directory. */
|
||||||
|
char *end_name = strchr (dirname, '/');
|
||||||
|
char *user_name;
|
||||||
|
int malloc_user_name = 0;
|
||||||
|
@@ -881,7 +883,22 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
|
||||||
|
}
|
||||||
|
scratch_buffer_free (&pwtmpbuf);
|
||||||
|
}
|
||||||
|
-#endif /* !WINDOWS32 */
|
||||||
|
+#else /* WINDOWS32 */
|
||||||
|
+ /* On native Windows, access to a user's home directory
|
||||||
|
+ (via GetUserProfileDirectory) or to a user's environment
|
||||||
|
+ variables (via ExpandEnvironmentStringsForUser) requires
|
||||||
|
+ the credentials of the user. Therefore we cannot support
|
||||||
|
+ the ~user syntax on this platform.
|
||||||
|
+ Handling ~user specially (and treat it like plain ~) if
|
||||||
|
+ user is getenv ("USERNAME") would not be a good idea,
|
||||||
|
+ since it would make people think that ~user is supported
|
||||||
|
+ in general. */
|
||||||
|
+ if (flags & GLOB_TILDE_CHECK)
|
||||||
|
+ {
|
||||||
|
+ retval = GLOB_NOMATCH;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+#endif /* WINDOWS32 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
36
gnulib/patches/0003-unistd-h-fix
Normal file
36
gnulib/patches/0003-unistd-h-fix
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
commit c7b1e060d17023065c776757da406d728310cc38
|
||||||
|
Author: Bruno Haible <bruno@clisp.org>
|
||||||
|
Date: Sun Jun 20 17:18:26 2021 +0200
|
||||||
|
|
||||||
|
unistd: Avoid compilation error in C++ mode on Solaris, HP-UX, mingw.
|
||||||
|
|
||||||
|
Reported by Eli Zaretskii <eliz@gnu.org> in
|
||||||
|
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00135.html>.
|
||||||
|
|
||||||
|
* lib/unistd.in.h (swab): Consider different declarations on Solaris,
|
||||||
|
HP-UX, and old mingw.
|
||||||
|
|
||||||
|
diff --git a/gnulib/import/unistd.in.h b/gnulib/import/unistd.in.h
|
||||||
|
index d4d4ba7743..73c882f97b 100644
|
||||||
|
--- a/gnulib/import/unistd.in.h
|
||||||
|
+++ b/gnulib/import/unistd.in.h
|
||||||
|
@@ -2034,9 +2034,17 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
|
||||||
|
# undef swab
|
||||||
|
# define swab _swab
|
||||||
|
# endif
|
||||||
|
-_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
|
||||||
|
-# else
|
||||||
|
+/* Need to cast, because in old mingw the arguments are
|
||||||
|
+ (const char *from, char *to, size_t n). */
|
||||||
|
+_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
|
||||||
|
+# else
|
||||||
|
+# if defined __hpux /* HP-UX */
|
||||||
|
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
|
||||||
|
+# elif defined __sun && !defined _XPG4 /* Solaris */
|
||||||
|
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
|
||||||
|
+# else
|
||||||
|
_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
|
||||||
|
+# endif
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIASWARN (swab);
|
||||||
|
#endif
|
||||||
33
gnulib/patches/0004-select-mingw
Normal file
33
gnulib/patches/0004-select-mingw
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
commit 21fccfa0451ba59fba479e439465da9c360353d3
|
||||||
|
Author: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Thu Jul 8 10:00:30 2021 -0700
|
||||||
|
|
||||||
|
select: port better to MinGW
|
||||||
|
|
||||||
|
Problem reported by Eli Zaretskii in:
|
||||||
|
https://lists.gnu.org/r/bug-gnulib/2021-07/msg00017.html
|
||||||
|
* lib/select.c (rpl_select) [_WIN32 && !__CYGWIN__]:
|
||||||
|
Pass a SOCKET, not a HANDLE, to FD_ISSET.
|
||||||
|
|
||||||
|
diff --git a/gnulib/import/select.c b/gnulib/import/select.c
|
||||||
|
index 2fe6a18064..eddac4b61f 100644
|
||||||
|
--- a/gnulib/import/select.c
|
||||||
|
+++ b/gnulib/import/select.c
|
||||||
|
@@ -530,12 +530,13 @@ restart:
|
||||||
|
if (h != handle_array[nhandles])
|
||||||
|
{
|
||||||
|
/* Perform handle->descriptor mapping. */
|
||||||
|
- WSAEventSelect ((SOCKET) h, NULL, 0);
|
||||||
|
- if (FD_ISSET (h, &handle_rfds))
|
||||||
|
+ SOCKET s = (SOCKET) h;
|
||||||
|
+ WSAEventSelect (s, NULL, 0);
|
||||||
|
+ if (FD_ISSET (s, &handle_rfds))
|
||||||
|
FD_SET (i, rfds);
|
||||||
|
- if (FD_ISSET (h, &handle_wfds))
|
||||||
|
+ if (FD_ISSET (s, &handle_wfds))
|
||||||
|
FD_SET (i, wfds);
|
||||||
|
- if (FD_ISSET (h, &handle_xfds))
|
||||||
|
+ if (FD_ISSET (s, &handle_xfds))
|
||||||
|
FD_SET (i, xfds);
|
||||||
|
}
|
||||||
|
else
|
||||||
@@ -180,6 +180,7 @@ fi
|
|||||||
# Apply our local patches.
|
# Apply our local patches.
|
||||||
apply_patches ()
|
apply_patches ()
|
||||||
{
|
{
|
||||||
|
echo "Applying $1..."
|
||||||
patch -p2 -f -i "$1"
|
patch -p2 -f -i "$1"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to apply some patches. Aborting."
|
echo "Failed to apply some patches. Aborting."
|
||||||
@@ -188,6 +189,9 @@ apply_patches ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply_patches "patches/0001-use-windows-stat"
|
apply_patches "patches/0001-use-windows-stat"
|
||||||
|
apply_patches "patches/0002-glob-tilde-check"
|
||||||
|
apply_patches "patches/0003-unistd-h-fix"
|
||||||
|
apply_patches "patches/0004-select-mingw"
|
||||||
|
|
||||||
# Regenerate all necessary files...
|
# Regenerate all necessary files...
|
||||||
aclocal &&
|
aclocal &&
|
||||||
|
|||||||
Reference in New Issue
Block a user