From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@ericsson.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix execution_direction's type
Date: Fri, 09 Oct 2015 17:26:00 -0000 [thread overview]
Message-ID: <5617F8D9.4080908@redhat.com> (raw)
In-Reply-To: <5617F611.4060301@ericsson.com>
On 10/09/2015 06:14 PM, Simon Marchi wrote:
> On 15-10-09 11:34 AM, Pedro Alves wrote:
>> @@ -3817,6 +3828,7 @@ fetch_inferior_event (void *client_data)
>> struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
>> struct cleanup *ts_old_chain;
>> int was_sync = sync_execution;
>> + enum exec_direction_kind save_exec_dir = execution_direction;
>> int cmd_done = 0;
>> ptid_t waiton_ptid = minus_one_ptid;
>>
>> @@ -3849,7 +3861,7 @@ fetch_inferior_event (void *client_data)
>> event. */
>> target_dcache_invalidate ();
>>
>> - make_cleanup_restore_integer (&execution_direction);
>> + make_cleanup (restore_execution_direction, &save_exec_dir);
>> execution_direction = target_execution_direction ();
>>
>> ecs->ptid = do_target_wait (waiton_ptid, &ecs->ws,
>
> Isn't it dangerous to record a cleanup with a pointer to a local variable?
>
> What if something throws the exception is caught in a parent frame? The
> content of the memory location pointed by the cleanup will be undefined
> at that time, won't it?
No, the cleanups are run _before_ the throwing scope is left (that is,
before longjmp), from within throw_exception.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-10-09 17:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 15:34 Pedro Alves
2015-10-09 17:15 ` Simon Marchi
2015-10-09 17:26 ` Pedro Alves [this message]
2015-10-13 18:44 ` Pedro Alves
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=5617F8D9.4080908@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
/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