From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 1/5] Use new and delete for struct infcall_suspend_state
Date: Wed, 11 Jul 2018 14:15:00 -0000 [thread overview]
Message-ID: <20180711141552.10136-2-tom@tromey.com> (raw)
In-Reply-To: <20180711141552.10136-1-tom@tromey.com>
This changes infrun.c to use new and delete for infcall_suspend_state.
This enables the coming cleanups.
gdb/ChangeLog
2018-07-11 Tom Tromey <tom@tromey.com>
* infrun.c (struct infcall_suspend_state): Add initializers.
(save_infcall_suspend_state): Use new.
(discard_infcall_suspend_state): Use delete.
---
gdb/ChangeLog | 6 ++++++
gdb/infrun.c | 12 ++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7c74c87d8c5..8c0d7b5f6a9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-11 Tom Tromey <tom@tromey.com>
+
+ * infrun.c (struct infcall_suspend_state): Add initializers.
+ (save_infcall_suspend_state): Use new.
+ (discard_infcall_suspend_state): Use delete.
+
2018-07-11 Alan Hayward <alan.hayward@arm.com>
* target-descriptions.c (tdesc_register_bitsize): Rename.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index dd7e69e718e..da71f3132a0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8810,18 +8810,18 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
struct infcall_suspend_state
{
- struct thread_suspend_state thread_suspend;
+ struct thread_suspend_state thread_suspend {};
/* Other fields: */
- readonly_detached_regcache *registers;
+ readonly_detached_regcache *registers = nullptr;
/* Format of SIGINFO_DATA or NULL if it is not present. */
- struct gdbarch *siginfo_gdbarch;
+ struct gdbarch *siginfo_gdbarch = nullptr;
/* The inferior format depends on SIGINFO_GDBARCH and it has a length of
TYPE_LENGTH (gdbarch_get_siginfo_type ()). For different gdbarch the
content would be invalid. */
- gdb_byte *siginfo_data;
+ gdb_byte *siginfo_data = nullptr;
};
struct infcall_suspend_state *
@@ -8853,7 +8853,7 @@ save_infcall_suspend_state (void)
}
}
- inf_state = XCNEW (struct infcall_suspend_state);
+ inf_state = new struct infcall_suspend_state;
if (siginfo_data)
{
@@ -8919,7 +8919,7 @@ discard_infcall_suspend_state (struct infcall_suspend_state *inf_state)
{
delete inf_state->registers;
xfree (inf_state->siginfo_data);
- xfree (inf_state);
+ delete inf_state;
}
readonly_detached_regcache *
--
2.17.1
next prev parent reply other threads:[~2018-07-11 14:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 14:16 [RFA 0/5] remove some infrun-related cleanups Tom Tromey
2018-07-11 14:15 ` [RFA 4/5] Remove two infrun cleanups Tom Tromey
2018-07-11 14:15 ` Tom Tromey [this message]
2018-07-11 15:33 ` [RFA 1/5] Use new and delete for struct infcall_suspend_state Simon Marchi
2018-07-11 14:16 ` [RFA 5/5] Remove release_stop_context_cleanup Tom Tromey
2018-07-11 14:16 ` [RFA 3/5] Use new and delete for struct infcall_control_state Tom Tromey
2018-07-11 15:36 ` Simon Marchi
2018-07-11 15:42 ` Simon Marchi
2018-07-11 14:16 ` [RFA 2/5] Remove cleanup from infrun.c Tom Tromey
2018-07-11 14:54 ` [RFA 0/5] remove some infrun-related cleanups Pedro Alves
2018-07-11 15:16 ` Simon Marchi
2018-07-11 19:29 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180711141552.10136-2-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox