From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 01/12] Introduce is_unavailable_error
Date: Mon, 12 Aug 2013 12:16:00 -0000 [thread overview]
Message-ID: <5208D22C.3090701@broadcom.com> (raw)
In-Reply-To: <5208D1DF.1090201@broadcom.com>
Is some places we specifically check for the NOT_AVAILABLE_ERROR error
code, in a later patch I'll be adding a new error for optimized out
values and I'll want to detect both error codes at the same time.
In preparation for this upcoming change I add a new function for
detecting the NOT_AVAILABLE_ERROR code, this is just a refactor.
OK to apply?
Thanks,
Andrew
gdb/ChangeLog
2013-08-08 Andrew Burgess <aburgess@broadcom.com>
* exceptions.c (is_unavailable_error): New function definition.
* exceptions.h (is_unavailable_error): New function declaration.
* cp-abi.c (baseclass_offset): Switch to use
is_unavailable_error, and rethrow whatever error we recieved
rather than a specific error code.
* amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache)
(amd64_epilogue_frame_cache): Switch to use
is_unavailable_error.
* cp-valprint.c (cp_print_value): Likewise.
* dwarf2-frame.c (dwarf2_frame_cache): Likewise.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Likewise.
* frame-unwind.c (frame_unwind_find_by_frame): Likewise.
* frame.c (frame_unwind_pc_if_available)
(get_frame_address_in_block_if_available): Likewise.
* i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache)
(i386_sigtramp_frame_cache): Likewise.
* infcmd.c (post_create_inferior): Likewise.
* p-valprint.c (pascal_object_print_value): Likewise.
* stack.c (get_frame_language): Likewise.
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 3ab74f0..71525b8 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2366,7 +2366,7 @@ amd64_frame_cache (struct frame_info *this_frame,
void **this_cache)
{
amd64_frame_cache_1 (this_frame, cache);
}
- if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && !is_unavailable_error (ex.error))
throw_exception (ex);
return cache;
@@ -2490,7 +2490,7 @@ amd64_sigtramp_frame_cache (struct frame_info
*this_frame, void **this_cache)
cache->base_p = 1;
}
- if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && !is_unavailable_error (ex.error))
throw_exception (ex);
*this_cache = cache;
@@ -2658,10 +2658,9 @@ amd64_epilogue_frame_cache (struct frame_info
*this_frame, void **this_cache)
/* The saved %eip will be at cache->base plus 8. */
cache->saved_regs[AMD64_RIP_REGNUM] = cache->base + 8;
-
cache->base_p = 1;
}
- if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && !is_unavailable_error (ex.error))
throw_exception (ex);
return cache;
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 2540eca..fbc68a4 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -85,8 +85,8 @@ baseclass_offset (struct type *type, int index, const
gdb_byte *valaddr,
address, val);
}
- if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
- throw_error (NOT_AVAILABLE_ERROR,
+ if (ex.reason < 0 && is_unavailable_error (ex.error))
+ throw_error (ex.error,
_("Cannot determine virtual baseclass offset "
"of incomplete object"));
else if (ex.reason < 0)
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index e83d979..795b7b0 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -519,7 +519,7 @@ cp_print_value (struct type *type, struct type
*real_type,
{
boffset = baseclass_offset (type, i, valaddr, offset, address, val);
}
- if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && is_unavailable_error (ex.error))
skip = -1;
else if (ex.reason < 0)
skip = 1;
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 5c88b03..b709d3b 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1117,7 +1117,7 @@ dwarf2_frame_cache (struct frame_info *this_frame,
void **this_cache)
}
if (ex.reason < 0)
{
- if (ex.error == NOT_AVAILABLE_ERROR)
+ if (is_unavailable_error (ex.error))
{
cache->unavailable_retaddr = 1;
do_cleanups (old_chain);
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 02afcdf..3b843fa 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2237,7 +2237,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type,
struct frame_info *frame,
}
if (ex.reason < 0)
{
- if (ex.error == NOT_AVAILABLE_ERROR)
+ if (is_unavailable_error (ex.error))
{
do_cleanups (old_chain);
retval = allocate_value (type);
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index c4c1e57..134d918 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -571,3 +571,11 @@ catch_command_errors_const
(catch_command_errors_const_ftype *command,
return 0;
return 1;
}
+
+/* Return true if this is an error indicating a value was unavailable. */
+
+int
+is_unavailable_error (const enum errors error)
+{
+ return error == NOT_AVAILABLE_ERROR;
+}
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index bf41860..1baecf4 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -101,6 +101,10 @@ struct gdb_exception
const char *message;
};
+/* Return true for those errors relating to value unavailability. */
+
+extern int is_unavailable_error (enum errors error);
+
/* A pre-defined non-exception. */
extern const struct gdb_exception exception_none;
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index ce2f6da..25b1e08 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -112,7 +112,7 @@ frame_unwind_find_by_frame (struct frame_info
*this_frame, void **this_cache)
res = entry->unwinder->sniffer (entry->unwinder, this_frame,
this_cache);
}
- if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && is_unavailable_error (ex.error))
{
/* This usually means that not even the PC is available,
thus most unwinders aren't able to determine if they're
diff --git a/gdb/frame.c b/gdb/frame.c
index d52c26a..54f828c 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -721,7 +721,7 @@ frame_unwind_pc_if_available (struct frame_info
*this_frame, CORE_ADDR *pc)
{
pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
}
- if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && is_unavailable_error (ex.error))
{
this_frame->prev_pc.p = -1;
@@ -2064,7 +2064,7 @@ get_frame_pc_if_available (struct frame_info
*frame, CORE_ADDR *pc)
}
if (ex.reason < 0)
{
- if (ex.error == NOT_AVAILABLE_ERROR)
+ if (is_unavailable_error (ex.error))
return 0;
else
throw_exception (ex);
@@ -2145,7 +2145,7 @@ get_frame_address_in_block_if_available (struct
frame_info *this_frame,
{
*pc = get_frame_address_in_block (this_frame);
}
- if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && is_unavailable_error (ex.error))
return 0;
else if (ex.reason < 0)
throw_exception (ex);
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index b159b49..1c9fa68 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1834,7 +1834,7 @@ i386_frame_cache (struct frame_info *this_frame,
void **this_cache)
{
i386_frame_cache_1 (this_frame, cache);
}
- if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && !is_unavailable_error (ex.error))
throw_exception (ex);
return cache;
@@ -2004,7 +2004,7 @@ i386_epilogue_frame_cache (struct frame_info
*this_frame, void **this_cache)
cache->base_p = 1;
}
- if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && !is_unavailable_error (ex.error))
throw_exception (ex);
return cache;
@@ -2197,7 +2197,7 @@ i386_sigtramp_frame_cache (struct frame_info
*this_frame, void **this_cache)
cache->base_p = 1;
}
- if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && !is_unavailable_error (ex.error))
throw_exception (ex);
*this_cache = cache;
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 154cde2..ed9ec5e 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -422,7 +422,7 @@ post_create_inferior (struct target_ops *target, int
from_tty)
{
stop_pc = regcache_read_pc (get_current_regcache ());
}
- if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && !is_unavailable_error (ex.error))
throw_exception (ex);
if (exec_bfd)
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 05d4c6f..cfafe99 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -754,7 +754,7 @@ pascal_object_print_value (struct type *type, const
gdb_byte *valaddr,
{
boffset = baseclass_offset (type, i, valaddr, offset, address, val);
}
- if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
+ if (ex.reason < 0 && is_unavailable_error (ex.error))
skip = -1;
else if (ex.reason < 0)
skip = 1;
diff --git a/gdb/stack.c b/gdb/stack.c
index 7d97dc8..af05f84 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2558,7 +2558,7 @@ get_frame_language (void)
}
if (ex.reason < 0)
{
- if (ex.error != NOT_AVAILABLE_ERROR)
+ if (!is_unavailable_error (ex.error))
throw_exception (ex);
}
else
next prev parent reply other threads:[~2013-08-12 12:16 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 ` Andrew Burgess [this message]
2013-08-12 12:18 ` [PATCH 02/12]: Remove set_value_optimized_out Andrew Burgess
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=5208D22C.3090701@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