* [rfc/patch] extract/store typed floating ()
@ 2001-09-20 15:36 Andrew Cagney
[not found] ` <s3i7kuqc9u5.fsf@soliton.wins.uva.nl>
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2001-09-20 15:36 UTC (permalink / raw)
To: gdb-patches
Hello,
This patch introduces two new functions:
extract_typed_floating()
store_typed_floating()
The new functions take a ``struct type'' that exactly describes the
floating point number to be extracted / stored.
The old extract/store floating functions:
extract_floating()
store_floating()
are documented as deprecated (outside of doublest.c). Several uses do
still remain:
o
targets still use them. I think is an obvious
fix and I'll add this to the ARI ready for
a rainy day.
o
symbol table readers and the XXX-lang.c code still
create ``struct type'' floats that specify just
the TYPE_LENGTH and not the TYPE_FLOATFORMAT (sigh).
Consequently extract/store typed floating() use them.
If you're wondering, the new functions take their names from a
combination of extract_typed_address(), extract_address() and
extract_floating().
Assuming that there are no concerns raised, I'll check this in in a few
days.
And the good news? This endith the core-gdb floating-point overhaul.
Just need to encourage target maintainers to make use of it and clean up
the loose ends :-)
Andrew
From dhoward@redhat.com Thu Sep 20 16:11:00 2001
From: Don Howard <dhoward@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Fernando Nasser <fnasser@cygnus.com>, Michael Snyder <msnyder@cygnus.com>, <gdb-patches@sources.redhat.com>
Subject: Re: [RFA] deleting breakpoints inside of 'commands' [Repost]
Date: Thu, 20 Sep 2001 16:11:00 -0000
Message-id: <Pine.LNX.4.33.0109201609080.9139-100000@theotherone>
References: <Pine.LNX.4.33.0109201305160.9139-100000@theotherone>
X-SW-Source: 2001-09/msg00281.html
Content-length: 3310
I thought of a problem with this patch: It could change a command list
(adding additional commands) if a breakpoint is hit while processing
another breakpoint. Bugger. Maybe I could add a field to struct
command_line for managing orphans?
On Thu, 20 Sep 2001, Don Howard wrote:
>
>
> Here is a patch that I hope will satisfy all sides. The patch below
> changes free_command_lines() to check if we are currently
> 'executing_breakpoint_commands'. If so, the command list is appended to
> a list of 'orphaned_command_lines'. When the execution of the command
> list completes, the orphaned_command_lines are then deleted.
>
> Should I make the global variables static and add accessor/mutator
> functions? What is the policy on globals?
>
> Comments?
>
>
>
> 2001-09-20 Don Howard <dhoward@redhat.com>
>
> * cli/cli-script.c (free_command_lines): Avoid deleting
> command_line lists while executing that list.
> * breakpoint.c: (executing_breakpoint_commands): Make this
> global visible to other compilation units.
> (orphaned_breakpoint_commands) New global.
> (bpstat_do_actions): Free orphaned command_line structures once
> done executing them.
>
>
> Index: gdb/breakpoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/breakpoint.c,v
> retrieving revision 1.53
> diff -p -u -w -r1.53 breakpoint.c
> --- breakpoint.c 2001/09/18 05:00:48 1.53
> +++ breakpoint.c 2001/09/20 22:18:17
> @@ -221,8 +221,11 @@ extern int addressprint; /* Print machin
> static int internal_breakpoint_number = -1;
>
> /* Are we executing breakpoint commands? */
> -static int executing_breakpoint_commands;
> +int executing_breakpoint_commands;
>
> +/* List of breakpoint commands to be cleaned up after we are done executing them. */
> +struct command_line * orphaned_breakpoint_commands;
> +
> /* Walk the following statement or block through all breakpoints.
> ALL_BREAKPOINTS_SAFE does so even if the statment deletes the current
> breakpoint. */
> @@ -1845,6 +1848,7 @@ top:
> }
>
> executing_breakpoint_commands = 0;
> + free_command_lines (&orphaned_breakpoint_commands);
> discard_cleanups (old_chain);
> }
>
> Index: gdb/cli/cli-script.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
> retrieving revision 1.7
> diff -p -u -w -r1.7 cli-script.c
> --- cli-script.c 2001/06/17 15:16:12 1.7
> +++ cli-script.c 2001/09/20 22:18:17
> @@ -1014,7 +1014,25 @@ free_command_lines (struct command_line
> register struct command_line *next;
> struct command_line **blist;
> int i;
> + extern int executing_breakpoint_commands;
> + extern struct command_line * orphaned_breakpoint_commands;
>
> + /* Avoid deleting command_line lists while executing that list. */
> + if (executing_breakpoint_commands)
> + {
> + struct command_line **b = NULL;
> +
> + /* Find the end of the orphaned_breakpoint_commands list */
> + for (b = &orphaned_breakpoint_commands; *b; b = &((*b)->next))
> + /* Nothing */
> + ;
> +
> + /* Append the passed-in list */
> + *b = *lptr;
> + *lptr = NULL;
> + return;
> + }
> +
> while (l)
> {
> if (l->body_count > 0)
>
>
>
--
-Don
dhoward@redhat.com
gdb engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfc/patch] extract/store typed floating ()
[not found] ` <s3i7kuqc9u5.fsf@soliton.wins.uva.nl>
@ 2001-09-23 13:06 ` Andrew Cagney
2001-09-24 10:21 ` Andrew Cagney
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2001-09-23 13:06 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
>
> I'm not sure whether zeroing out the buffer in store_typed_floating()
> is desirable. I've (almost) convinced myself that it isn't. Here's a
> part of a comment that I added to the doublest.c in my current tree:
>
> /* ...
>
> It is debatable whether we should zero out any remaining
> bytes in the target buffer, when converting from a type that
> has a smaller length than the target type. Right now we
> don't do that. A typical case where this situation arises is
> when we convert a i387 floating-point register to a `long
> double' in memory. On the target, that operation only stores
> the first 10 bytes, and leaves alone the remaining 2 bytes.
> It makes sense to mimick this behaviour here. */
>
> This comment comes from a function convert_floating() that I intend to
> add to doublest.c. I'll submit a patch after you've checked yours in.
Don't forget that the routines are expecting to manipulate a GDB
internal buffer freshly allocated from the heap and not target memory.
Failing to initialize it would leave it containing complete garbage
(perhaphs I should set it to 0xdeadbeef). That garbage would then be
written back to the target since (well from memory) GDB writes all
length bytes from a value buffer.
To ``do the write thing'', I suspect ``struct value'' and the value <->
memory transfer routines would all need to be modified so that they only
write a sub-section of the buffer. Other ideas also come to mind:
edit_typed_floating() that edits an floating point buffer in place; add
an ``old buffer'' parameter that can be used to optionally initialize
unused bytes; or use the raw floatformat routines(1) where needed.
The case that would worry me is with i387 registers. For that, I think
the target should just specify the 10 byte FP type so that GDB won't
touch any padding bytes.
Andrew
(1) Would need to fix the problem of TYPE_FLOATFORMAT not always being
initialized.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfc/patch] extract/store typed floating ()
[not found] ` <s3i7kuqc9u5.fsf@soliton.wins.uva.nl>
2001-09-23 13:06 ` Andrew Cagney
@ 2001-09-24 10:21 ` Andrew Cagney
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2001-09-24 10:21 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
> Andrew Cagney <ac131313@cygnus.com> writes:
>
>
>> Hello,
>>
>> This patch introduces two new functions:
>>
>> extract_typed_floating()
>> store_typed_floating()
>>
>> The new functions take a ``struct type'' that exactly describes the
>> floating point number to be extracted / stored.
>
>
> The new names sound a lot better than the extract_doublest() you
> proposed earlier. I'd say, go for it [:-)] .
It is in. (Some times I think the hardest thing about hacking on GDB is
comming up with reasonable names for files and functional interfaces :-)
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-09-24 10:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-20 15:36 [rfc/patch] extract/store typed floating () Andrew Cagney
[not found] ` <s3i7kuqc9u5.fsf@soliton.wins.uva.nl>
2001-09-23 13:06 ` Andrew Cagney
2001-09-24 10:21 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox