plan9fox/sys/src/cmd/db/defs.h
cinap_lenrek c86561f625 db: fix unicode support (thanks giacomo)
from the unicode-db patch readme:

command() receives a char* that is assigned to lp, which is a Rune*,
and lp is incremented later in readchar(), so each read consumed 4 bytes.
The only time command() is called is in runpcs() with bkpt->comm,
which is a char* built in subpcs through a char*, so the string stored in
bkpt->comm was not a Rune string. A way to test the bug is:

db program
main:b argv/X
:r
2015-03-19 11:44:26 +01:00

111 lines
1.7 KiB
C

/*
* adb - common definitions
* something of a grab-bag
*/
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ctype.h>
#include <mach.h>
typedef ulong WORD;
typedef uvlong ADDR;
#define HUGEINT 0x7fffffff /* enormous WORD */
#define MAXOFF 0x1000000
#define INCDIR "/usr/lib/adb"
#define DBNAME "db\n"
#define CMD_VERBS "?/=>!$: \t"
typedef int BOOL;
#define MAXPOS 80
#define MAXLIN 128
#define ARB 512
#define MAXCOM 64
#define MAXARG 32
#define LINSIZ 4096
#define MAXSYM 255
#define EOR '\n'
#define SPC ' '
#define TB '\t'
#define STDIN 0
#define STDOUT 1
#define TRUE (-1)
#define FALSE 0
/*
* run modes
*/
#define SINGLE 1
#define CONTIN 2
/*
* breakpoints
*/
#define BKPTCLR 0 /* not a real breakpoint */
#define BKPTSET 1 /* real, ready to trap */
#define BKPTSKIP 2 /* real, skip over it next time */
#define BKPTTMP 3 /* temporary; clear when it happens */
typedef struct bkpt BKPT;
struct bkpt {
ADDR loc;
uchar save[4];
int count;
int initcnt;
int flag;
Rune comm[MAXCOM];
BKPT *nxtbkpt;
};
#define BADREG (-1)
/*
* common globals
*/
extern WORD adrval;
extern uvlong expv;
extern int adrflg;
extern WORD cntval;
extern int cntflg;
extern WORD loopcnt;
extern ADDR maxoff;
extern ADDR localval;
extern ADDR maxfile;
extern ADDR maxstor;
extern ADDR dot;
extern int dotinc;
extern int xargc;
extern BOOL wtflag;
extern char *corfil, *symfil;
extern int fcor, fsym;
extern BOOL mkfault;
extern BOOL regdirty;
extern int pid;
extern int pcsactive;
#define NNOTE 10
extern int nnote;
extern char note[NNOTE][ERRMAX];
extern int ending;
extern Map *cormap, *symmap, *dotmap;
extern BKPT *bkpthead;
extern int kflag;
extern int lastc, peekc;