| 224 | } |
| 225 | |
| 226 | void dump_log(const void *nom_dump, const unsigned int lng) |
| 227 | { |
| 228 | #ifndef DISABLED_FOR_FRAMAC |
| 229 | const char *ptr=(const char*)nom_dump; |
| 230 | const unsigned int nbr_line=(lng+0x10-1)/0x10; |
| 231 | unsigned int i; |
| 232 | /*@ assert \valid_read(ptr + (0 .. lng-1)); */ |
| 233 | /* write dump to log file*/ |
| 234 | /*@ |
| 235 | @ loop invariant 0 <= i <= nbr_line; |
| 236 | @ loop assigns *log_handle, f_status, i; |
| 237 | @ loop variant nbr_line - i; |
| 238 | @*/ |
| 239 | for (i=0; i<nbr_line; i++) |
| 240 | { |
| 241 | unsigned int j; |
| 242 | log_info("%04X ",i*0x10); |
| 243 | /*@ |
| 244 | @ loop invariant 0 <= j <= 0x10; |
| 245 | @ loop assigns *log_handle, f_status, j; |
| 246 | @ loop variant 0x10 - j; |
| 247 | @*/ |
| 248 | for(j=0; j< 0x10;j++) |
| 249 | { |
| 250 | const unsigned int o=i*0x10+j; |
| 251 | if(o<lng) |
| 252 | { |
| 253 | /*@ assert o<lng; */ |
| 254 | /*@ assert \valid_read(ptr + (0 .. lng-1)); */ |
| 255 | log_info("%02x", ptr[o]); |
| 256 | } |
| 257 | else |
| 258 | log_info(" "); |
| 259 | if(j%4==(4-1)) |
| 260 | log_info(" "); |
| 261 | } |
| 262 | log_info(" "); |
| 263 | /*@ |
| 264 | @ loop invariant 0 <= j <= 0x10; |
| 265 | @ loop assigns *log_handle, f_status, j; |
| 266 | @ loop variant 0x10 - j; |
| 267 | @*/ |
| 268 | for(j=0; j< 0x10;j++) |
| 269 | { |
| 270 | const unsigned int o=i*0x10+j; |
| 271 | if(o<lng) |
| 272 | { |
| 273 | const char car=ptr[o]; |
| 274 | if (car<32 || car >= 127) |
| 275 | log_info("."); |
| 276 | else |
| 277 | log_info("%c", car); |
| 278 | } |
| 279 | else |
| 280 | log_info(" "); |
| 281 | } |
| 282 | log_info("\n"); |
| 283 | } |
no outgoing calls