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

Function db_write_cmd

freebsd/ddb/db_write_cmd.c:47–92  ·  view source on GitHub ↗

* Write to file. */ ARGSUSED*/

Source from the content-addressed store, hash-verified

45 */
46/*ARGSUSED*/
47void
48db_write_cmd(db_expr_t address, bool have_addr, db_expr_t count,
49 char * modif)
50{
51 db_addr_t addr;
52 db_expr_t old_value;
53 db_expr_t new_value;
54 int size;
55 bool wrote_one = false;
56
57 addr = (db_addr_t) address;
58
59 switch (modif[0]) {
60 case 'b':
61 size = 1;
62 break;
63 case 'h':
64 size = 2;
65 break;
66 case 'l':
67 case '\0':
68 size = 4;
69 break;
70 default:
71 db_error("Unknown size\n");
72 return;
73 }
74
75 while (db_expression(&new_value)) {
76 old_value = db_get_value(addr, size, false);
77 db_printsym(addr, DB_STGY_ANY);
78 db_printf("\t\t%#8lr\t=\t%#8lr\n", (long)old_value,(long)new_value);
79 db_put_value(addr, size, new_value);
80 addr += size;
81
82 wrote_one = true;
83 }
84
85 if (!wrote_one)
86 db_error("Nothing written.\n");
87
88 db_next = addr;
89 db_prev = addr - size;
90
91 db_skip_to_eol();
92}

Callers

nothing calls this directly

Calls 7

db_errorFunction · 0.85
db_expressionFunction · 0.85
db_get_valueFunction · 0.85
db_printsymFunction · 0.85
db_printfFunction · 0.85
db_put_valueFunction · 0.85
db_skip_to_eolFunction · 0.85

Tested by

no test coverage detected