From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 02/12]: Remove set_value_optimized_out
Date: Mon, 12 Aug 2013 12:18:00 -0000 [thread overview]
Message-ID: <5208D295.9010703@broadcom.com> (raw)
In-Reply-To: <5208D1DF.1090201@broadcom.com>
In this patch I change the API used to mark a value as optimized
out, the API now matches that used for marking a value unavailable.
This patch does revert a recent change by Pedro:
http://sourceware.org/ml/gdb-patches/2013-07/msg00178.html
however, later patches will change the code to be more acceptable.
OK to apply?
Thanks,
Andrew
gdb/ChangeLog
2013-08-08 Andrew Burgess <aburgess@broadcom.com>
* ada-lang.c (coerce_unspec_val_to_type): Switch to
mark_value_bytes_optimized_out, and only mark non-lazy values as
optimized out.
* dwarf2loc.c (read_pieced_value): Switch to use
mark_value_bytes_optimized_out, or mark_value_bits_optimized_out.
(write_pieced_value): Switch to use
mark_value_bytes_optimized_out.
* findvar.c (read_frame_register_value): Switch to use
mark_value_bytes_optimized_out.
(value_from_register): Likewise.
* value.c (allocate_optimized_out_value, value_fetch_lazy): Switch
to use mark_value_bytes_optimized_out.
(value_optimized_out_const, set_value_optimized_out): Remove.
(mark_value_bytes_optimized_out, mark_value_bits_optimized_out):
New function definition.
* value.h (value_optimized_out_const, set_value_optimized_out):
Remove.
(mark_value_bytes_optimized_out, mark_value_bits_optimized_out):
Add new declaration.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index ba59913..20a0f02 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -576,12 +576,13 @@ coerce_unspec_val_to_type (struct value *val,
struct type *type)
result = allocate_value (type);
memcpy (value_contents_raw (result), value_contents (val),
TYPE_LENGTH (type));
+ if (value_optimized_out (val))
+ mark_value_bytes_optimized_out (result, 0, TYPE_LENGTH (type));
}
set_value_component_location (result, val);
set_value_bitsize (result, value_bitsize (val));
set_value_bitpos (result, value_bitpos (val));
set_value_address (result, value_address (val));
- set_value_optimized_out (result, value_optimized_out_const (val));
return result;
}
}
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 3b843fa..36b80fb 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1694,7 +1694,7 @@ read_pieced_value (struct value *v)
memset (buffer, 0, this_size);
if (optim)
- set_value_optimized_out (v, 1);
+ mark_value_bytes_optimized_out (v, offset, this_size);
if (unavail)
mark_value_bytes_unavailable (v, offset, this_size);
}
@@ -1754,7 +1754,7 @@ read_pieced_value (struct value *v)
break;
case DWARF_VALUE_OPTIMIZED_OUT:
- set_value_optimized_out (v, 1);
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
break;
default:
@@ -1792,7 +1792,7 @@ write_pieced_value (struct value *to, struct value
*from)
if (frame == NULL)
{
- set_value_optimized_out (to, 1);
+ mark_value_bytes_optimized_out (to, 0, TYPE_LENGTH (value_type
(to)));
return;
}
@@ -1923,7 +1923,7 @@ write_pieced_value (struct value *to, struct
value *from)
source_buffer, this_size);
break;
default:
- set_value_optimized_out (to, 1);
+ mark_value_bytes_optimized_out (to, 0, TYPE_LENGTH (value_type (to)));
break;
}
offset += this_size_bits;
diff --git a/gdb/findvar.c b/gdb/findvar.c
index f586ce2..f2bb247 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -713,7 +713,11 @@ read_frame_register_value (struct value *value,
struct frame_info *frame)
if (value_optimized_out (regval))
{
- set_value_optimized_out (value, 1);
+ /* If any one of the component registers is marked optimized out
+ then we just mark the whole composite register as optimized
+ out. We could do better, but this style of composite register
+ passing is not standard, and is only used on a few targets. */
+ mark_value_bytes_optimized_out (value, 0, TYPE_LENGTH (value_type
(value)));
break;
}
@@ -762,7 +766,7 @@ value_from_register (struct type *type, int regnum,
struct frame_info *frame)
if (!ok)
{
if (optim)
- set_value_optimized_out (v, 1);
+ mark_value_bytes_optimized_out (v, 0, TYPE_LENGTH (type));
if (unavail)
mark_value_bytes_unavailable (v, 0, TYPE_LENGTH (type));
}
diff --git a/gdb/value.c b/gdb/value.c
index 09ab1bb..462244e 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -742,7 +742,7 @@ allocate_optimized_out_value (struct type *type)
{
struct value *retval = allocate_value_lazy (type);
- set_value_optimized_out (retval, 1);
+ mark_value_bytes_optimized_out (retval, 0, TYPE_LENGTH (type));
return retval;
}
@@ -1062,16 +1062,28 @@ value_optimized_out (struct value *value)
return value->optimized_out;
}
-int
-value_optimized_out_const (const struct value *value)
+/* Mark contents of VALUE as optimized out, starting at OFFSET bytes, and
+ the following LENGTH bytes. */
+
+void
+mark_value_bytes_optimized_out (struct value *value, int offset, int
length)
{
- return value->optimized_out;
+ mark_value_bits_optimized_out (value,
+ offset * TARGET_CHAR_BIT,
+ length * TARGET_CHAR_BIT);
}
+/* Mark contents of VALUE as optimized out, starting at OFFSET bits, and
+ the following LENGTH bits. */
+
void
-set_value_optimized_out (struct value *value, int val)
+mark_value_bits_optimized_out (struct value *value,
+ int offset ATTRIBUTE_UNUSED,
+ int length ATTRIBUTE_UNUSED)
{
- value->optimized_out = val;
+ /* For now just set the optimized out flag to indicate that part of the
+ value is optimized out, this will be expanded upon in later
patches. */
+ value->optimized_out = 1; }
int
@@ -3439,7 +3451,8 @@ value_fetch_lazy (struct value *val)
if (!value_bits_valid (parent,
TARGET_CHAR_BIT * offset + value_bitpos (val),
value_bitsize (val)))
- set_value_optimized_out (val, 1);
+ mark_value_bytes_optimized_out (val, value_embedded_offset (val),
+ TYPE_LENGTH (type));
else if (!unpack_value_bits_as_long (value_type (val),
value_contents_for_printing (parent),
offset,
@@ -3498,7 +3511,7 @@ value_fetch_lazy (struct value *val)
/* If the register was not saved, mark it optimized out. */
if (value_optimized_out (new_val))
- set_value_optimized_out (val, 1);
+ mark_value_bytes_optimized_out (val, 0, TYPE_LENGTH (value_type (val)));
else
{
set_value_lazy (val, 0);
diff --git a/gdb/value.h b/gdb/value.h
index 599850e..dd8a0c1 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -322,12 +322,18 @@ extern int value_contents_equal (struct value
*val1, struct value *val2);
exist in the program, at least partially. If the value is lazy,
this may fetch it now. */
extern int value_optimized_out (struct value *value);
-extern void set_value_optimized_out (struct value *value, int val);
-/* Like value_optimized_out, but don't fetch the value even if it is
- lazy. Mainly useful for constructing other values using VALUE as
- template. */
-extern int value_optimized_out_const (const struct value *value);
+/* Mark VALUE's content bytes starting at OFFSET and extending for
+ LENGTH bytes as optimized out. */
+
+extern void mark_value_bytes_optimized_out (struct value *value,
+ int offset, int length);
+
+/* Mark VALUE's content bits starting at OFFSET and extending for
+ LENGTH bits as optimized out. */
+
+extern void mark_value_bits_optimized_out (struct value *value,
+ int offset, int length);
/* Like value_optimized_out, but return false if any bit in the object
is valid. */
next prev parent reply other threads:[~2013-08-12 12:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 12:15 [RFC 00/12] Merge value optimized_out and unavailable Andrew Burgess
2013-08-12 12:16 ` [PATCH 01/12] Introduce is_unavailable_error Andrew Burgess
2013-08-12 12:18 ` Andrew Burgess [this message]
2013-08-12 12:20 ` [PATCH 03/12] Mark optimized out values as non-lazy Andrew Burgess
2013-11-26 16:38 ` Pedro Alves
2013-11-26 19:19 ` Andrew Burgess
2013-08-12 12:22 ` [PATCH 04/12] Introduce OPTIMIZED_OUT_ERROR Andrew Burgess
2013-08-12 12:24 ` [PATCH 05/12] Convert the unavailable to be bit based Andrew Burgess
2013-08-12 12:27 ` [PATCH 06/12] Delete value_bits_valid Andrew Burgess
2013-11-25 21:41 ` [PATCH] Print entirely unavailable struct/union values as a single <unavailable>. (Re: [PATCH 06/12] Delete value_bits_valid.) Pedro Alves
2013-11-26 10:13 ` Andrew Burgess
2013-11-28 20:14 ` Pedro Alves
2013-08-12 12:28 ` [PATCH 07/12] Generic print unavailable or optimized out function Andrew Burgess
2013-08-12 12:29 ` [PATCH 08/12] Replace some value_optimized_out with value_entirely_available Andrew Burgess
2013-11-27 17:52 ` [COMMITTED PATCH 0/2] "set debug frame 1" and not saved registers (was: Re: [PATCH 08/12] Replace some value_optimized_out with value_entirely_available) Pedro Alves
2013-11-27 18:14 ` [PATCH 1/2] Make "set debug frame 1" use the standard print routine for optimized out values Pedro Alves
2013-11-27 18:35 ` [PATCH 2/2] Make "set debug frame 1" output print <not saved> instead of <optimized out> Pedro Alves
2013-11-27 18:41 ` Pedro Alves
2013-11-27 18:53 ` [pushed] Fix type of not saved registers. (was: Re: [PATCH 2/2] Make "set debug frame 1" output print <not saved> instead of <optimized out>.) Pedro Alves
2013-08-12 12:30 ` [PATCH 09/12] DWARF value, mark unavailable in bits not bytes Andrew Burgess
2013-08-12 12:31 ` [PATCH 10/12] Merge optimized_out into unavailable vector Andrew Burgess
2013-08-12 12:32 ` [PATCH 11/12] Add test mechanism for value " Andrew Burgess
2013-08-12 12:33 ` [PATCH 12/12] Remove old lval check valid functions Andrew Burgess
2013-08-29 17:21 ` PING: Re: [RFC 00/12] Merge value optimized_out and unavailable Andrew Burgess
2013-11-12 9:37 ` Andrew Burgess
2013-11-29 22:31 ` Pedro Alves
2013-12-04 14:54 ` Andrew Burgess
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=5208D295.9010703@broadcom.com \
--to=aburgess@broadcom.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