9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] libmach x86 botch
@ 2011-09-04 17:33 erik quanstrom
  2011-09-04 17:38 ` erik quanstrom
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: erik quanstrom @ 2011-09-04 17:33 UTC (permalink / raw)
  To: 9fans

it appers that either i386das and i386inst are misnamed, or they
are listed incorrectly in /sys/src/libmach/8db.c.  since at least [v7]db
follow the same pattern, i'm pretty sure the header file is wrong.
 also i believe the setting of errstr() in i386das and i386inst is incorrect.
(for a demonstration, try asm(stackaddress) on a running 386 executable.
you'll get a few bytes of unprintable garbage.)

- erik


Machdata i386mach =
{
	{0xCC, 0, 0, 0},	/* break point: INT 3 */
	1,			/* break point size */

	leswab,			/* convert short to local byte order */
	leswal,			/* convert long to local byte order */
	leswav,			/* convert vlong to local byte order */
	i386trace,		/* C traceback */
	i386frame,		/* frame finder */
	i386excep,		/* print exception */
	0,			/* breakpoint fixup */
	leieeesftos,		/* single precision float printer */
	leieeedftos,		/* double precision float printer */
	i386foll,		/* following addresses */
>>	i386inst,		/* print instruction */
>>	i386das,		/* dissembler */
	i386instlen,		/* instruction size calculation */
};

yet

/sys/include/mach.h:202,219
struct	Machdata {		/* Machine-dependent debugger support */
	uchar	bpinst[4];			/* break point instr. */
	short	bpsize;				/* size of break point instr. */

	ushort	(*swab)(ushort);		/* ushort to local byte order */
	ulong	(*swal)(ulong);			/* ulong to local byte order */
	uvlong	(*swav)(uvlong);		/* uvlong to local byte order */
	int	(*ctrace)(Map*, uvlong, uvlong, uvlong, Tracer); /* C traceback */
	uvlong	(*findframe)(Map*, uvlong, uvlong, uvlong, uvlong);/* frame finder */
	char*	(*excep)(Map*, Rgetter);	/* last exception */
	ulong	(*bpfix)(uvlong);		/* breakpoint fixup */
	int	(*sftos)(char*, int, void*);	/* single precision float */
	int	(*dftos)(char*, int, void*);	/* double precision float */
	int	(*foll)(Map*, uvlong, Rgetter, uvlong*);/* follow set */
>>	int	(*das)(Map*, uvlong, char, char*, int);	/* symbolic disassembly */
>>	int	(*hexinst)(Map*, uvlong, char*, int); 	/* hex disassembly */
	int	(*instsize)(Map*, uvlong);	/* instruction size */
};



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-04 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-04 17:33 [9fans] libmach x86 botch erik quanstrom
2011-09-04 17:38 ` erik quanstrom
2011-09-04 18:32 ` Russ Cox
     [not found] ` <CADSkJJUnyBgoCt7bek6482BJ2SZ7vh=DbaFwNLNcY36qj994+g@mail.gmail.c>
2011-09-04 18:36   ` erik quanstrom

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 NNTP newsgroup(s).