Article View: gnu.gdb.bug
Article #10174Enhancement to 386 disassembler in gdb
From: Ron Kuris
Date: Tue, 10 Apr 1990 13:21
Date: Tue, 10 Apr 1990 13:21
78 lines
2852 bytes
2852 bytes
One major drawback of the 'disassemble' command of gdb is that it
doesn't give you the name of the routine that it is calling when
disassembling a section of code. The following simple patch gives
you this capability on 386 based machines.
Note that I haven't tested it extensively; it just seemed so simple
that I had to throw it in! (Sorry, doesn't work on segmented stuff).
I imagine it should work on all 386 ports though (symmetry, i386, etc.)
(Note: This patch will be included in the Xenix Patches for GDB).
*** ../dist-gdb/i386-pinsn.c Wed Jul 5 12:46:04 1989
--- ./i386-pinsn.c Tue Apr 10 00:42:39 1990
***************
*** 163,168 ****
--- 163,170 ----
#define FLOATCODE 50
#define FLOAT NULL, NULL, FLOATCODE
+ static void func_name();
+
struct dis386 {
char *name;
int (*op1)();
***************
*** 1663,1668 ****
--- 1665,1672 ----
sprintf (scratchbuf, "0x%x",
(start_pc + codep - start_codep + disp) & mask);
oappend (scratchbuf);
+ func_name((start_pc + codep - start_codep + disp) & mask, scratchbuf);
+ oappend (scratchbuf);
}
/* ARGSUSED */
***************
*** 1704,1709 ****
--- 1708,1715 ----
sprintf (scratchbuf, "0x%x",
start_pc + codep - start_codep + offset);
oappend (scratchbuf);
+ func_name(start_pc + codep - start_codep + offset, scratchbuf);
+ oappend (scratchbuf);
break;
default:
oappend ("<internal disassembler error>");
***************
*** 1810,1812 ****
--- 1816,1840 ----
return (n);
}
+ static void
+ func_name(memaddr, buffer)
+ CORE_ADDR memaddr;
+ char *buffer;
+ {
+ extern int find_pc_misc_function();
+ int func_id;
+
+ func_id = find_pc_misc_function(memaddr);
+ if (func_id == -1)
+ {
+ *buffer = '\0';
+ return;
+ }
+ if (misc_function_vector[func_id].address == memaddr)
+ sprintf(buffer, " <%s>",
+ misc_function_vector[func_id].name);
+ else
+ sprintf(buffer, " <%s+%d>",
+ misc_function_vector[func_id].name,
+ memaddr - misc_function_vector[func_id].address);
+ }
--
--
...!pyramid!unify!rdk386!ron -or- ...!ames!pacbell!sactoh0!siva!rdk386!ron
It's not how many mistakes you make, its how quickly you recover from them.
Technical Details
Message-ID:
<1990Apr10..8390@rdk386.uucp>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!samsung!usc!ucsd!ucbvax!ucdavis!csusac!unify!rdk386!ronShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5053,eaad2e4e2390d447,start X-Google-Attributes: gidf5053,public X-Google-ArrivalTime: 1990-04-10 10:16:49 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!samsung!usc!ucsd!ucbvax!ucdavis!csusac!unify!rdk386!ron From: ron@rdk386.uucp (Ron Kuris) Newsgroups: gnu.gdb.bug Subject: Enhancement to 386 disassembler in gdb Message-ID: <1990Apr10..8390@rdk386.uucp> Date: 10 Apr 90 13:21:45 GMT Reply-To: ron@rdk386.UUCP (Ron Kuris) Organization: At Home, Sacramento, CA Lines: 78 Posted: Tue Apr 10 14:21:45 1990