public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@cygnus.com>
To: Insight Maling List <insight@sources.redhat.com>
Subject: [PATCH] SRC+ASM/disassembly problmes
Date: Tue, 21 Aug 2001 06:52:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.33.0108201045440.13816-100000@makita.cygnus.com> (raw)

Hi,

When switching to SRC+ASM mode, insight can sometimes fail to retrieve
disassembly from the diasm engine. This usually results when using Harvard
architectures (like the d10v), since Insight performs steps similar to
doing the disassembly via the commandline "disassemble *0xADDRESS".

This causes gdb to convert the constant 0xADDRESS to/from a pointer using
gdbarch_address_to_pointer and gdbarch_pointer_to_address, which often
convert 0xADDRESS from (an implied insn address) into a data address.

I've changed the error message returned by gdb_load_disassembly to print
out the address it was told to disassemble at (by the srctextwin code) and
the address which actually failed (from parse_and_eval_address). This
should help pinpoint some of these architectural problems. Unfortunately
this will be a known limitation withe Harvard architecture systems:
disassembly will not work.

I've also fixed a bug concerning SRC+ASM mode "locking up" the gui when
disassembly fails. It will now print the source (if any) AND the error
message in separate panes, as expected.

If you encounter any problems, please let me know.
Keith

ChangeLog
2001-08-20  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-cmds.c (gdb_load_disassembly): Save the original
	address from parse_and_eval_address: if find_pc_partial_function
	errors, we will lose our original address.
	If find_pc_partial_function does error, print out both
	the address we thought we were disassembling at AND the address
	we actually did disassemble at. This should help elide address-
	to-pointer and pointer-to-address problems.
	* library/srctextwin.itb (FillAssembly): When gdb_load_disassembly
	fails, use its error message instead of the cooked "Unable to
	Read insturctions..." message.
	(UnLoadFromCache): If oldpane is empty, don't try show it,
	don't try to set our view to it, don't do anything but
	erase the given pane.

Patch
Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.37
diff -u -p -r1.37 gdbtk-cmds.c
--- generic/gdbtk-cmds.c	2001/07/31 17:34:56	1.37
+++ generic/gdbtk-cmds.c	2001/08/20 17:45:22
@@ -1636,7 +1636,7 @@ static int
 gdb_load_disassembly (ClientData clientData, Tcl_Interp *interp,
 		      int objc, Tcl_Obj *CONST objv[])
 {
-  CORE_ADDR low, high;
+  CORE_ADDR low, high, orig;
   struct disassembly_client_data client_data;
   int mixed_source_and_assembly, ret_val, i;
   char *arg_ptr;
@@ -1729,11 +1729,13 @@ gdb_load_disassembly (ClientData clientD
   /* Now parse the addresses */

   low = parse_and_eval_address (Tcl_GetStringFromObj (objv[5], NULL));
+  orig = low;

   if (objc == 6)
     {
       if (find_pc_partial_function (low, NULL, &low, &high) == 0)
-        error ("No function contains specified address");
+	error ("No function contains address 0x%s (%s)",
+	       paddr_nz (orig), Tcl_GetStringFromObj (objv[5], NULL));
     }
   else
     high = parse_and_eval_address (Tcl_GetStringFromObj (objv[6], NULL));
Index: library/srctextwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/srctextwin.itb,v
retrieving revision 1.26
diff -u -p -r1.26 srctextwin.itb
--- library/srctextwin.itb	2001/06/11 23:08:05	1.26
+++ library/srctextwin.itb	2001/08/20 17:45:23
@@ -1034,7 +1034,7 @@ body SrcTextWin::FillAssembly {w tagname
 	set pane $Stwc(gdbtk_scratch_widget:pane)
 	set win [[$itk_interior.p childsite $pane].st component text]
 	$win delete 0.0 end
-	$win insert 0.0 "Unable to Read Instructions at $addr"
+	$win insert 0.0 "$mess"
 	if {$oldpane != "" && $oldpane != $pane} {
 	  $itk_interior.p replace $oldpane $pane
 	} else {
@@ -2773,9 +2773,11 @@ body SrcTextWin::UnLoadFromCache {w oldp
     unset Stwc($elem)
   }

-  $itk_interior.p show $oldpane
-  set pane $oldpane
-  set win [[$itk_interior.p childsite $pane].st component text]
+  if {$oldpane != ""} {
+    $itk_interior.p show $oldpane
+    set pane $oldpane
+    set win [[$itk_interior.p childsite $pane].st component text]
+  }
 }

 # ------------------------------------------------------------------

                 reply	other threads:[~2001-08-21  6:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.GSO.4.33.0108201045440.13816-100000@makita.cygnus.com \
    --to=keiths@cygnus.com \
    --cc=insight@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).