* Search for a value in memory. * Syntax: search [/bhl] addr value [mask] [,count] */
| 252 | * Syntax: search [/bhl] addr value [mask] [,count] |
| 253 | */ |
| 254 | void |
| 255 | db_search_cmd(db_expr_t dummy1, bool dummy2, db_expr_t dummy3, char *dummy4) |
| 256 | { |
| 257 | int t; |
| 258 | db_addr_t addr; |
| 259 | int size; |
| 260 | db_expr_t value; |
| 261 | db_expr_t mask; |
| 262 | db_expr_t count; |
| 263 | |
| 264 | t = db_read_token(); |
| 265 | if (t == tSLASH) { |
| 266 | t = db_read_token(); |
| 267 | if (t != tIDENT) { |
| 268 | bad_modifier: |
| 269 | db_printf("Bad modifier\n"); |
| 270 | db_flush_lex(); |
| 271 | return; |
| 272 | } |
| 273 | |
| 274 | if (!strcmp(db_tok_string, "b")) |
| 275 | size = 1; |
| 276 | else if (!strcmp(db_tok_string, "h")) |
| 277 | size = 2; |
| 278 | else if (!strcmp(db_tok_string, "l")) |
| 279 | size = 4; |
| 280 | else |
| 281 | goto bad_modifier; |
| 282 | } else { |
| 283 | db_unread_token(t); |
| 284 | size = 4; |
| 285 | } |
| 286 | |
| 287 | if (!db_expression((db_expr_t *)&addr)) { |
| 288 | db_printf("Address missing\n"); |
| 289 | db_flush_lex(); |
| 290 | return; |
| 291 | } |
| 292 | |
| 293 | if (!db_expression(&value)) { |
| 294 | db_printf("Value missing\n"); |
| 295 | db_flush_lex(); |
| 296 | return; |
| 297 | } |
| 298 | |
| 299 | if (!db_expression(&mask)) |
| 300 | mask = 0xffffffffUL; |
| 301 | |
| 302 | t = db_read_token(); |
| 303 | if (t == tCOMMA) { |
| 304 | if (!db_expression(&count)) { |
| 305 | db_printf("Count missing\n"); |
| 306 | db_flush_lex(); |
| 307 | return; |
| 308 | } |
| 309 | } else { |
| 310 | db_unread_token(t); |
| 311 | count = -1; /* effectively forever */ |
nothing calls this directly
no test coverage detected