From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Seitz To: Insight Maling List Subject: [PATCH] SRC+ASM/disassembly problmes Date: Tue, 21 Aug 2001 06:52:00 -0000 Message-id: X-SW-Source: 2001-q3/msg00162.html 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 * 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] + } } # ------------------------------------------------------------------