Changeset bfd7aac in mainline for uspace/app/taskdump/taskdump.c


Ignore:
Timestamp:
2010-02-17T19:19:08Z (14 years ago)
Author:
Lukas Mejdrech <lukasmejdrech@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1e2e0c1e
Parents:
01a9ef5 (diff), b8da2a3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskdump/taskdump.c

    r01a9ef5 rbfd7aac  
    5454#define LINE_BYTES 16
    5555
    56 #define DBUF_SIZE 4096
    57 static uint8_t data_buf[DBUF_SIZE];
    58 
    5956static int phoneid;
    6057static task_id_t task_id;
     
    7067static int thread_dump(uintptr_t thash);
    7168static int areas_dump(void);
    72 static int area_dump(as_area_info_t *area);
    73 static void hex_dump(uintptr_t addr, void *buffer, size_t size);
    7469static int td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value);
    7570
     
    356351}
    357352
    358 static __attribute__((unused)) int area_dump(as_area_info_t *area)
    359 {
    360         size_t to_copy;
    361         size_t total;
    362         uintptr_t addr;
    363         int rc;
    364 
    365         addr = area->start_addr;
    366         total = 0;
    367 
    368         while (total < area->size) {
    369                 to_copy = min(area->size - total, DBUF_SIZE);
    370                 rc = udebug_mem_read(phoneid, data_buf, addr, to_copy);
    371                 if (rc < 0) {
    372                         printf("udebug_mem_read() failed.\n");
    373                         return rc;
    374                 }
    375 
    376                 hex_dump(addr, data_buf, to_copy);
    377 
    378                 addr += to_copy;
    379                 total += to_copy;
    380         }
    381 
    382         return EOK;
    383 }
    384 
    385 static void hex_dump(uintptr_t addr, void *buffer, size_t size)
    386 {
    387         uint8_t *data = (uint8_t *) buffer;
    388         uint8_t b;
    389         size_t pos, i;
    390 
    391         assert(addr % LINE_BYTES == 0);
    392         assert(size % LINE_BYTES == 0);
    393 
    394         pos = 0;
    395 
    396         while (pos < size) {
    397                 printf("%08lx:", addr + pos);
    398                 for (i = 0; i < LINE_BYTES; ++i) {
    399                         if (i % 4 == 0) putchar(' ');
    400                         printf(" %02x", data[pos + i]);
    401                 }
    402                 putchar('\t');
    403 
    404                 for (i = 0; i < LINE_BYTES; ++i) {
    405                         b = data[pos + i];
    406                         if (b >= 32 && b < 127) {
    407                                 putchar(b);
    408                         } else {
    409                                 putchar(' ');
    410                         }
    411                 }
    412                 putchar('\n');
    413                 pos += LINE_BYTES;
    414         }
    415 }
    416 
    417353static int td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value)
    418354{
Note: See TracChangeset for help on using the changeset viewer.