MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_disasm

Function db_disasm

freebsd/i386/i386/db_disasm.c:1157–1513  ·  view source on GitHub ↗

* Disassemble instruction at 'loc'. 'altfmt' specifies an * (optional) alternate format. Return address of start of * next instruction. */

Source from the content-addressed store, hash-verified

1155 * next instruction.
1156 */
1157db_addr_t
1158db_disasm(db_addr_t loc, bool altfmt)
1159{
1160 int inst;
1161 int size;
1162 int short_addr;
1163 const char * seg;
1164 const struct inst * ip;
1165 const char * i_name;
1166 int i_size;
1167 int i_mode;
1168 int regmodrm = 0;
1169 bool first;
1170 int displ;
1171 int prefix;
1172 int rep;
1173 int imm;
1174 int imm2;
1175 int len;
1176 struct i_addr address;
1177
1178 if (db_segsize(kdb_frame) == 16)
1179 altfmt = !altfmt;
1180 get_value_inc(inst, loc, 1, FALSE);
1181 if (altfmt) {
1182 short_addr = TRUE;
1183 size = WORD;
1184 }
1185 else {
1186 short_addr = FALSE;
1187 size = LONG;
1188 }
1189 seg = NULL;
1190
1191 /*
1192 * Get prefixes
1193 */
1194 rep = FALSE;
1195 prefix = TRUE;
1196 do {
1197 switch (inst) {
1198 case 0x66:
1199 size = (altfmt ? LONG : WORD);
1200 break;
1201 case 0x67:
1202 short_addr = !altfmt;
1203 break;
1204 case 0x26:
1205 seg = "%es";
1206 break;
1207 case 0x36:
1208 seg = "%ss";
1209 break;
1210 case 0x2e:
1211 seg = "%cs";
1212 break;
1213 case 0x3e:
1214 seg = "%ds";

Callers

nothing calls this directly

Calls 6

db_segsizeFunction · 0.85
db_printfFunction · 0.85
db_printsymFunction · 0.85
db_disasm_escFunction · 0.70
db_read_addressFunction · 0.70
db_print_addressFunction · 0.70

Tested by

no test coverage detected