From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: Regression: graceful unwind termination when we'd need unavailable/uncollect memory or registers to unwind further
Date: Tue, 22 Mar 2011 14:40:00 -0000 [thread overview]
Message-ID: <201103221113.17253.pedro@codesourcery.com> (raw)
In-Reply-To: <20110320184845.GA30084@host1.jankratochvil.net>
On Sunday 20 March 2011 18:48:45, Jan Kratochvil wrote:
> Hi Pedro,
>
> on a testfile from the Fedora patchset there is a regression, IMO a valid one:
Agreed.
> http://pkgs.fedoraproject.org/gitweb/?p=gdb.git;a=blob_plain;f=gdb-6.8-bz457187-largefile-test.patch;hb=f15/master
> = This file is included in this mail.
Thanks!
> The core file does not have accessible registers. It was not a goal of the
> testcase, it tests something else. But it has found this unrelated
> regression.
Yeah, nice test.
> (gdb) x/i 0x400078
> 0x400078: hlt
> PASS: gdb.arch/i386-biarch-core.exp: .text is readable
> ->
> (gdb) x/i 0x400078
> PC not available
> FAIL: gdb.arch/i386-biarch-core.exp: .text is readable
> I believe one should be able to evaluate PC-indepenent
> expressions even if PC is not available.
Yep, and you can. The quirk is x/i / disassemble specific. The
error is thrown while trying to decide whether to print the "==>" that
indicates the current PC.
> Even the first part is regressing (although it stays PASS->PASS):
> (gdb) core-file gdb.arch/i386-biarch-core.core
> [New LWP 6901]
> warning: Couldn't recognize general-purpose registers in core file.
> Core was generated by `./bad'.
> Program terminated with signal 11, Segmentation fault.
> warning: Couldn't recognize general-purpose registers in core file.
> #0 0x00000000 in ?? ()
> ->
> (gdb) core-file gdb.arch/i386-biarch-core.core
> [New LWP 6901]
> warning: Couldn't recognize general-purpose registers in core file.
> PC register is not available
Fixed as well. After the patch:
(...)
warning: Couldn't recognize general-purpose registers in core file.
Core was generated by `./bad'.
Program terminated with signal 11, Segmentation fault.
warning: Couldn't recognize general-purpose registers in core file.
#0 <unavailable> in ?? ()
(gdb)
and:
(gdb) x/i 0x400078
0x400078: hlt
Below's the patch. Doesn't cause regressions for me.
Did you see any other regression?
Thanks,
Pedro Alves
2011-03-27 Pedro Alves <pedro@codesourcery.com>
* infcmd.c (post_create_inferior): Ignore NOT_AVAILABLE_ERROR
errors when reading the `stop_pc'.
* printcmd.c (pc_prefix): Use get_frame_pc_if_available instead of
get_frame_pc.
---
gdb/infcmd.c | 14 ++++++++++++--
gdb/printcmd.c | 4 +---
2 files changed, 13 insertions(+), 5 deletions(-)
Index: src/gdb/infcmd.c
===================================================================
--- src.orig/gdb/infcmd.c 2011-03-15 20:15:05.000000000 +0000
+++ src/gdb/infcmd.c 2011-03-22 10:22:17.729088002 +0000
@@ -395,6 +395,8 @@ strip_bg_char (char **args)
void
post_create_inferior (struct target_ops *target, int from_tty)
{
+ volatile struct gdb_exception ex;
+
/* Be sure we own the terminal in case write operations are performed. */
target_terminal_ours ();
@@ -404,8 +406,16 @@ post_create_inferior (struct target_ops
don't need to. */
target_find_description ();
- /* Now that we know the register layout, retrieve current PC. */
- stop_pc = regcache_read_pc (get_current_regcache ());
+ /* Now that we know the register layout, retrieve current PC. But
+ if the PC is unavailable (e.g., we're opening a core file with
+ missing registers info), ignore it. */
+ stop_pc = 0;
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ stop_pc = regcache_read_pc (get_current_regcache ());
+ }
+ if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+ throw_exception (ex);
if (exec_bfd)
{
Index: src/gdb/printcmd.c
===================================================================
--- src.orig/gdb/printcmd.c 2011-03-15 20:15:34.000000000 +0000
+++ src/gdb/printcmd.c 2011-03-22 10:21:41.829088002 +0000
@@ -759,9 +759,7 @@ pc_prefix (CORE_ADDR addr)
CORE_ADDR pc;
frame = get_selected_frame (NULL);
- pc = get_frame_pc (frame);
-
- if (pc == addr)
+ if (get_frame_pc_if_available (frame, &pc) && pc == addr)
return "=> ";
}
return " ";
next prev parent reply other threads:[~2011-03-22 11:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 18:35 Pedro Alves
2011-02-28 15:42 ` Jan Kratochvil
2011-02-28 15:56 ` Pedro Alves
2011-02-28 18:50 ` Jan Kratochvil
2011-03-18 20:21 ` Pedro Alves
2011-03-21 10:09 ` Regression: " Jan Kratochvil
2011-03-21 20:46 ` Pedro Alves
2011-03-22 14:40 ` Pedro Alves [this message]
2011-03-22 15:36 ` Jan Kratochvil
2011-03-22 16:19 ` Pedro Alves
2011-03-21 17:46 ` [commit] Fix tramp-frame.c crash (Re: graceful unwind termination when we'd need unavailable/uncollect memory or registers to unwind further) Ulrich Weigand
2011-03-21 20:52 ` Pedro Alves
2011-03-31 14:43 ` [rfc] Fix broken i386 signal unwinding " Ulrich Weigand
2011-03-31 16:20 ` Pedro Alves
2011-03-31 16:23 ` [rfc] Fix broken i386 signal unwinding (Re: graceful unwind termination when we'd need unavailable/uncollect memory or regis Ulrich Weigand
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=201103221113.17253.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.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