[review v2] Fix crash with core + TUI + run
Sergio Durigan Junior (Code Review)
gerrit@gnutoolchain-gerrit.osci.io
Tue Nov 19 00:12:00 GMT 2019
Sergio Durigan Junior has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/483
......................................................................
Patch Set 2:
(2 comments)
Thanks for the review. I updated the commit message and will push the patch.
| --- /dev/null
| +++ /COMMIT_MSG
| @@ -1,0 +74,20 @@ have a target already, and tries to close it (from target.c):
| + target_close (prev); // <-- here
| + }
| + ...
| +
| +When the current target ('core_target') is being closed, it checks for
| +possible observers registered with it and calls them. TUI is one of
| +those observers, it gets called, tries to update the status line, and
| +GDB crashes.
| +
| +The real problem is that we are calling 'target_close' too soon,
| +before we actually have the new target on top of the stack.
PS2, Line 84:
Done.
| +Interestingly, this scenario is covered in 'target_stack::unpush', but
| +for some reason we are not calling it here. The fix, therefore, is to
| +call 'unpush' if there's a target on the stack.
| +
| +This patch has been tested on the Buildbot and no regressions have
| +been found. I'm also submitting a testcase for it.
| +
| +gdb/ChangeLog:
| +2019-11-08 Sergio Durigan Junior <sergiodj@redhat.com>
| --- gdb/target.c
| +++ gdb/target.c
| @@ -569,14 +566,18 @@ target_stack::push (target_ops *t)
| - }
| + prev = m_stack[stratum];
|
| /* Now add the new one. */
| m_stack[stratum] = t;
|
| + /* And close the previous one, if it exists. */
| + if (prev != nullptr)
| + target_close (prev);
| +
PS1, Line 574:
Done
| if (m_top < stratum)
| m_top = stratum;
| }
|
| /* See target.h. */
|
| void
| push_target (struct target_ops *t)
| {
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I39e2f8b538c580c8ea5bf1d657ee877e47746c8f
Gerrit-Change-Number: 483
Gerrit-PatchSet: 2
Gerrit-Owner: Sergio Durigan Junior <sergiodj@redhat.com>
Gerrit-Reviewer: Pedro Alves <palves@redhat.com>
Gerrit-Reviewer: Sergio Durigan Junior <sergiodj@redhat.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Tue, 19 Nov 2019 00:11:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Pedro Alves <palves@redhat.com>
Comment-In-Reply-To: Sergio Durigan Junior <sergiodj@redhat.com>
Gerrit-MessageType: comment
More information about the Gdb-patches
mailing list