Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb-patches@sources.redhat.com
Subject: [patch] Set register even when no frame exists
Date: Fri, 26 Sep 2008 17:52:00 -0000	[thread overview]
Message-ID: <gbj7fj$667$1@ger.gmane.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]

Hello,


We have recently run into a problem with an ARM board debugging via a jtag emulator (bdi2000). The problem looks very much like what was discussed in "GDB and ARM Frame Pointer strangeness" (http://sources.redhat.com/ml/gdb/2004-06/msg00040.html)

What is happening in our case is this: 

gdb connects to bdi2000 (target remote ...) then reset command is issued via bdi2000 (monitor reset...) the target is reset. (and stopped). bdi2000 via init sequence initializes on-board hardware.

After that, gdb loads image into device memory. 

However, when gdb now tries to set PC to the start instruction of the loaded image, GDB fails with:

"Value being assigned to is no longer active"

and gives up trying to write the register.


Note that at this point the target is barely initialized; stack pointer register (GPR 11) has random value which makes frame_find_by_id to fail.

Simple solution (see the patch attached) is to call "get_current_frame" which will effectively create a sentinel frame.To me having only sentinel frame at this point in game makes a lot of sense.


Thanks,

Aleksandar Ristovski
QNX Software Systems



2008-09-26  Aleksandar Ristovski  <aristovski@qnx.com>

	* valops.c (value_assign): Get current frame if frame_find_by_id
	fails.


[-- Attachment #2: valops.c-20080926.diff --]
[-- Type: text/x-patch, Size: 764 bytes --]

Index: gdb/valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.200
diff -u -p -r1.200 valops.c
--- gdb/valops.c	11 Sep 2008 14:27:34 -0000	1.200
+++ gdb/valops.c	26 Sep 2008 17:32:56 -0000
@@ -839,6 +839,12 @@ value_assign (struct value *toval, struc
 	/* Figure out which frame this is in currently.  */
 	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
 	value_reg = VALUE_REGNUM (toval);
+	
+	/* Get sentinel frame.  For remote targets that just
+	   booted, there will be no frame to work with.  Use registers
+	   instead (sentinel frame).  */
+	if (!frame)
+	  frame = get_current_frame ();
 
 	if (!frame)
 	  error (_("Value being assigned to is no longer active."));

             reply	other threads:[~2008-09-26 17:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-26 17:52 Aleksandar Ristovski [this message]
2008-09-26 19:09 ` Daniel Jacobowitz

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='gbj7fj$667$1@ger.gmane.org' \
    --to=aristovski@qnx.com \
    --cc=gdb-patches@sources.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