diff options
author | Joel Brobecker <brobecker@adacore.com> | 2018-09-08 16:45:25 -0500 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2018-09-08 17:45:25 -0400 |
commit | fb44b1a737ee7d53d5d88c4f2a3d449e8084d6c2 (patch) | |
tree | 7be20d09258dbc2824d25ff1d392a6314efc12f7 | |
parent | 2a62dfa93f1980fd8d5b0651753c550942fa30b6 (diff) | |
download | gdb-fb44b1a737ee7d53d5d88c4f2a3d449e8084d6c2.zip gdb-fb44b1a737ee7d53d5d88c4f2a3d449e8084d6c2.tar.gz gdb-fb44b1a737ee7d53d5d88c4f2a3d449e8084d6c2.tar.bz2 |
(Ada) infinite loop when hitting unhandled exception catchpoint
When debugging a program compiled with an older version of GNAT,
hitting a catchpoint on unhandled exceptions can caused GDB to
got into an infinite loop. This happens while trying to find
the name of the exception that was raised. For that, it searches
for a frame corresponding to a specific function we know gets
called during the exeption handling.
In our particular case, the compiler was too old, and so GDB never
found that frame, and eventually got past the "main" subprogram,
all the way to system frames, where no symbol was available.
As a result, the code addresses could not be resolved into
a function name, leading to the infinite loop because of
a misplaced update of our loop variable "fi":
while (fi != NULL)
{
char *func_name;
enum language func_lang;
find_frame_funname (fi, &func_name, &func_lang, NULL);
if (func_name != NULL)
{
make_cleanup (xfree, func_name);
if (strcmp (func_name,
data->exception_info->catch_exception_sym) == 0)
break; /* We found the frame we were looking for... */
fi = get_prev_frame (fi);
}
}
If FUNC_NAME is NULL, then FI never gets updated ever after!
gdb/ChangeLog:
* ada-lang.c (ada_unhandled_exception_name_addr_from_raise):
Move update of loop variable "fi".
No testcase added, as the existing testcase gdb.ada/catch_ex.exp
should trigger it when using an older version of GNAT as the Ada
compiler.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ada-lang.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0d87f83..41dee6e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2018-09-08 Joel Brobecker <brobecker@adacore.com> + * ada-lang.c (ada_unhandled_exception_name_addr_from_raise): + Move update of loop variable "fi". + +2018-09-08 Joel Brobecker <brobecker@adacore.com> + * ada-lang.c (value_assign_to_component): In the case of big-endian targets, extract the bits of the given VAL using an src_offset of zero if container is not a scalar. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 3618e1d..87ae275 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -12242,8 +12242,8 @@ ada_unhandled_exception_name_addr_from_raise (void) if (strcmp (func_name.get (), data->exception_info->catch_exception_sym) == 0) break; /* We found the frame we were looking for... */ - fi = get_prev_frame (fi); } + fi = get_prev_frame (fi); } if (fi == NULL) |