diff options
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 266 |
1 files changed, 140 insertions, 126 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 3a9218bc84..5b73f8badd 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -23,13 +23,12 @@ #include <stdlib.h> #include <stdio.h> #include <stdbool.h> -#include <string.h> +#include <string-extra.h> #include "lcd.h" #include "lang.h" #include "menu.h" #include "debug_menu.h" #include "kernel.h" -#include "structec.h" #include "action.h" #include "debug.h" #include "thread.h" @@ -39,7 +38,6 @@ #include "audio.h" #include "settings.h" #include "list.h" -#include "statusbar.h" #include "dir.h" #include "panic.h" #include "screens.h" @@ -128,12 +126,18 @@ #if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) #include "bootdata.h" +#include "multiboot.h" +#include "rbpaths.h" +#include "pathfuncs.h" +#include "rb-loader.h" #endif +#define SCREEN_MAX_CHARS (LCD_WIDTH / SYSFONT_WIDTH) + static const char* threads_getname(int selected_item, void *data, char *buffer, size_t buffer_len) { - (void)data; + int *x_offset = (int*) data; #if NUM_CORES > 1 if (selected_item < (int)NUM_CORES) @@ -153,36 +157,80 @@ static const char* threads_getname(int selected_item, void *data, struct thread_debug_info threadinfo; if (thread_get_debug_info(selected_item, &threadinfo) > 0) { - fmtstr = "%2d:" IF_COP(" (%d)") " %s" IF_PRIO(" %d %d") + fmtstr = "%2d:" IF_COP(" (%d)") " %s%n" IF_PRIO(" %d %d") IFN_SDL(" %2d%%") " %s"; } - - snprintf(buffer, buffer_len, fmtstr, + int status_len; + size_t len = snprintf(buffer, buffer_len, fmtstr, selected_item, IF_COP(threadinfo.core,) threadinfo.statusstr, + &status_len, IF_PRIO(threadinfo.base_priority, threadinfo.current_priority,) IFN_SDL(threadinfo.stack_usage,) threadinfo.name); - return buffer; + int start = 0; +#if LCD_WIDTH <= 128 + if (len >= SCREEN_MAX_CHARS) + { + int ch_offset = (*x_offset)%(len-1); + int rem = SCREEN_MAX_CHARS - (len - ch_offset); + if (rem > 0) + ch_offset -= rem; + + if (ch_offset > 0) + { + /* don't scroll the # and status */ + status_len++; + if ((unsigned int)ch_offset + status_len < buffer_len) + memmove(&buffer[ch_offset], &buffer[0], status_len); + start = ch_offset; + } + } +#else + (void) x_offset; + (void) len; +#endif + return &buffer[start]; } static int dbg_threads_action_callback(int action, struct gui_synclist *lists) { - (void)lists; + if (action == ACTION_NONE) + { + return ACTION_REDRAW; + } +#if LCD_WIDTH <= 128 + int *x_offset = ((int*) lists->data); + if (action == ACTION_STD_OK) + { + *x_offset += 1; action = ACTION_REDRAW; + } + else if (IS_SYSEVENT(action)) + { + return ACTION_REDRAW; + } + else if (action != ACTION_UNKNOWN) + { + *x_offset = 0; + } +#else + (void) lists; +#endif return action; } /* Test code!!! */ static bool dbg_os(void) { struct simplelist_info info; + int xoffset = 0; + simplelist_info_init(&info, IF_COP("Core and ") "Stack usage:", - MAXTHREADS IF_COP( + NUM_CORES ), NULL); - info.hide_selection = true; - info.scroll_all = true; + MAXTHREADS IF_COP( + NUM_CORES ), &xoffset); + info.scroll_all = false; info.action_callback = dbg_threads_action_callback; info.get_name = threads_getname; return simplelist_show_list(&info); @@ -295,7 +343,6 @@ static bool dbg_cpuinfo(void) info.get_name = get_cpuinfo; info.action_callback = cpuinfo_cb; info.timeout = HZ; - info.hide_selection = true; info.scroll_all = true; return simplelist_show_list(&info); } @@ -330,6 +377,13 @@ static bool dbg_buffering_thread(void) struct buffering_debug d; size_t filebuflen = audio_get_filebuflen(); /* This is a size_t, but call it a long so it puts a - when it's bad. */ +#if LCD_WIDTH > 96 + #define STR_DATAREM "data_rem" + const char * const fmt_used = "%s: %6ld/%ld"; +#else /* clipzip, ?*/ + #define STR_DATAREM "remain" + const char * const fmt_used = "%s:%ld/%ld"; +#endif #ifndef CPU_MULTI_FREQUENCY boost_ticks = 0; @@ -366,13 +420,13 @@ static bool dbg_buffering_thread(void) screens[i].clear_display(); - screens[i].putsf(0, line++, "pcm: %6ld/%ld", (long) bufused, (long) bufsize); + screens[i].putsf(0, line++, fmt_used, "pcm", (long) bufused, (long) bufsize); gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6, bufsize, 0, bufused, HORIZONTAL); line++; - screens[i].putsf(0, line++, "alloc: %6ld/%ld", audio_filebufused(), + screens[i].putsf(0, line++, fmt_used, "alloc", audio_filebufused(), (long) filebuflen); #if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80) @@ -382,7 +436,7 @@ static bool dbg_buffering_thread(void) filebuflen, 0, audio_filebufused(), HORIZONTAL); line++; - screens[i].putsf(0, line++, "real: %6ld/%ld", (long)d.buffered_data, + screens[i].putsf(0, line++, fmt_used, "real", (long)d.buffered_data, (long)filebuflen); gui_scrollbar_draw(&screens[i],0, line*8, screens[i].lcdwidth, 6, @@ -391,7 +445,7 @@ static bool dbg_buffering_thread(void) } #endif - screens[i].putsf(0, line++, "usefl: %6ld/%ld", (long)(d.useful_data), + screens[i].putsf(0, line++, fmt_used, "usefl", (long)(d.useful_data), (long)filebuflen); #if LCD_HEIGHT > 80 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_HEIGHT > 80) @@ -403,7 +457,7 @@ static bool dbg_buffering_thread(void) } #endif - screens[i].putsf(0, line++, "data_rem: %ld", (long)d.data_rem); + screens[i].putsf(0, line++, "%s: %ld", STR_DATAREM, (long)d.data_rem); screens[i].putsf(0, line++, "track count: %2u", audio_track_count()); @@ -442,8 +496,10 @@ static bool dbg_buffering_thread(void) screens[i].setfont(FONT_UI); return false; +#undef STR_DATAREM } +#ifdef BUFLIB_DEBUG_PRINT static const char* bf_getname(int selected_item, void *data, char *buffer, size_t buffer_len) { @@ -463,13 +519,12 @@ static int bf_action_cb(int action, struct gui_synclist* list) else { splash(HZ/1, "Attempting a 64k allocation"); - int handle = core_alloc("test", 64<<10); + int handle = core_alloc(64<<10); splash(HZ/2, (handle > 0) ? "Success":"Fail"); /* for some reason simplelist doesn't allow adding items here if * info.get_name is given, so use normal list api */ gui_synclist_set_nb_items(list, core_get_num_blocks()); - if (handle > 0) - core_free(handle); + core_free(handle); } action = ACTION_REDRAW; } @@ -485,6 +540,7 @@ static bool dbg_buflib_allocs(void) info.timeout = HZ; return simplelist_show_list(&info); } +#endif /* BUFLIB_DEBUG_PRINT */ #if (CONFIG_PLATFORM & PLATFORM_NATIVE) static const char* dbg_partitions_getname(int selected_item, void *data, @@ -514,7 +570,6 @@ static bool dbg_partitions(void) struct simplelist_info info; simplelist_info_init(&info, "Partition Info", NUM_DRIVES * 4, NULL); info.selection_size = 2; - info.hide_selection = true; info.scroll_all = true; info.get_name = dbg_partitions_getname; return simplelist_show_list(&info); @@ -816,8 +871,7 @@ static int tsc2100debug_action_callback(int action, struct gui_synclist *lists) if (action == ACTION_STD_OK) { *page = (*page+1)%3; - snprintf(lists->title, 32, - "tsc2100 registers - Page %d", *page); + snprintf((char*)lists->title, 32, "tsc2100 registers - Page %d", *page); return ACTION_REDRAW; } return action; @@ -825,7 +879,8 @@ static int tsc2100debug_action_callback(int action, struct gui_synclist *lists) static bool tsc2100_debug(void) { int page = 0; - char title[32] = "tsc2100 registers - Page 0"; + char title[32]; + snprintf(title, 32, "tsc2100 registers - Page %d", page); struct simplelist_info info; simplelist_info_init(&info, title, 32, &page); info.timeout = HZ/100; @@ -876,7 +931,7 @@ static bool view_battery(void) else grid = 5; - lcd_putsf(0, 0, "battery %d.%03dV", power_history[0] / 1000, + lcd_putsf(0, 0, "%s %d.%03dV", "Battery", power_history[0] / 1000, power_history[0] % 1000); lcd_putsf(0, 1, "%d.%03d-%d.%03dV (%2dmV)", minv / 1000, minv % 1000, maxv / 1000, maxv % 1000, @@ -887,7 +942,7 @@ static bool view_battery(void) grid = 10; else grid = 1; - lcd_putsf(0, 0, "battery %d%%", power_history[0]); + lcd_putsf(0, 0, "%s %d%%", "Battery", power_history[0]); lcd_putsf(0, 1, "%d%%-%d%% (%d %%)", minv, maxv, grid); #endif @@ -942,16 +997,16 @@ static bool view_battery(void) lcd_putsf(0, 0, "Pwr status: %s", charging_state() ? "charging" : "discharging"); #else - lcd_puts(0, 0, "Power status: unknown"); + lcd_putsf(0, 0, "Pwr status: %s", "unknown"); #endif battery_read_info(&y, &z); if (y > 0) - lcd_putsf(0, 1, "Battery: %d.%03d V (%d %%)", y / 1000, y % 1000, z); + lcd_putsf(0, 1, "%s: %d.%03d V (%d %%)", "Battery", y / 1000, y % 1000, z); else if (z > 0) - lcd_putsf(0, 1, "Battery: %d %%", z); + lcd_putsf(0, 1, "%s: %d %%", "Battery", z); #ifdef ADC_EXT_POWER y = (adc_read(ADC_EXT_POWER) * EXT_SCALE_FACTOR) / 1000; - lcd_putsf(0, 2, "External: %d.%03d V", y / 1000, y % 1000); + lcd_putsf(0, 2, "%s: %d.%03d V", "External", y / 1000, y % 1000); #endif #if CONFIG_CHARGING #if defined IPOD_NANO || defined IPOD_VIDEO @@ -965,7 +1020,7 @@ static bool view_battery(void) usb_pwr ? "present" : "absent"); lcd_putsf(0, 4, "EXT pwr: %s", ext_pwr ? "present" : "absent"); - lcd_putsf(0, 5, "Battery: %s", + lcd_putsf(0, 5, "%s: %s", "Battery", charging ? "charging" : (usb_pwr||ext_pwr) ? "charged" : "discharging"); lcd_putsf(0, 6, "Dock mode: %s", dock ? "enabled" : "disabled"); @@ -1019,7 +1074,7 @@ static bool view_battery(void) lcd_putsf(0, line++, "State: %s", chrgstate_strings[y]); - lcd_putsf(0, line++, "Battery Switch: %s", + lcd_putsf(0, line++, "%s Switch: %s", "Battery", (st & POWER_INPUT_BATTERY) ? "On" : "Off"); y = chrgraw_adc_voltage(); @@ -1042,11 +1097,11 @@ static bool view_battery(void) y = battery_adc_temp(); if (y != INT_MIN) { - lcd_putsf(0, line++, "T Battery: %d\u00b0C (%d\u00b0F)", y, - (9*y + 160) / 5); + lcd_putsf(0, line++, "T %s: %d\u00b0C (%d\u00b0F)", + "Battery", y, (9*y + 160) / 5); } else { /* Conversion disabled */ - lcd_puts(0, line++, "T Battery: ?"); + lcd_putsf(0, line++, "T %s: ?", "Battery"); } #elif defined(HAVE_AS3514) && CONFIG_CHARGING static const char * const chrgstate_strings[] = @@ -1073,7 +1128,7 @@ static bool view_battery(void) y = pmu_read_battery_voltage(); lcd_putsf(17, 1, "RAW: %d.%03d V", y / 1000, y % 1000); y = pmu_read_battery_current(); - lcd_putsf(0, 2, "Battery current: %d mA", y); + lcd_putsf(0, 2, "%s current: %d mA", "Battery", y); lcd_putsf(0, 3, "PWRCON: %08x %08x", PWRCON, PWRCONEXT); lcd_putsf(0, 4, "CLKCON: %08x %03x %03x", CLKCON, CLKCON2, CLKCON3); lcd_putsf(0, 5, "PLL: %06x %06x %06x", PLL0PMS, PLL1PMS, PLL2PMS); @@ -1099,9 +1154,9 @@ static bool view_battery(void) lcd_putsf(0, 3, "Charger: %s", charger_inserted() ? "present" : "absent"); x = (avr_hid_hdq_read_short(HDQ_REG_TEMP) / 4) - 273; - lcd_putsf(0, 4, "Battery temperature: %d C", x); + lcd_putsf(0, 4, "%s temperature: %d C", "Battery", x); x = (avr_hid_hdq_read_short(HDQ_REG_AI) * 357) / 200; - lcd_putsf(0, 5, "Battery current: %d.%01d mA", x / 10, x % 10); + lcd_putsf(0, 5, "%s current: %d.%01d mA", "Battery", x / 10, x % 10); x = (avr_hid_hdq_read_short(HDQ_REG_AP) * 292) / 20; lcd_putsf(0, 6, "Discharge power: %d.%01d mW", x / 10, x % 10); x = (avr_hid_hdq_read_short(HDQ_REG_SAE) * 292) / 2; @@ -1139,7 +1194,7 @@ static bool view_battery(void) power_history[0] % 1000); #endif - lcd_putsf(0, 6, "battery level: %d%%", battery_level()); + lcd_putsf(0, 6, "%s level: %d%%", "Battery", battery_level()); int time_left = battery_time(); if (time_left >= 0) @@ -1148,7 +1203,7 @@ static bool view_battery(void) lcd_puts(0, 7, "Estimation n/a"); #if (CONFIG_BATTERY_MEASURE & CURRENT_MEASURE) - lcd_putsf(0, 8, "battery current: %d mA", battery_current()); + lcd_putsf(0, 8, "%s current: %d mA", "Battery", battery_current()); #endif break; } @@ -1193,7 +1248,8 @@ static int disk_callback(int btn, struct gui_synclist *lists) int *cardnum = (int*)lists->data; unsigned char card_name[6]; unsigned char pbuf[32]; - char *title = lists->title; + /* Casting away const is safe; the buffer is defined as non-const. */ + char *title = (char *)lists->title; static const unsigned char i_vmin[] = { 0, 1, 5, 10, 25, 35, 60, 100 }; static const unsigned char i_vmax[] = { 1, 5, 10, 25, 35, 45, 80, 200 }; static const unsigned char * const kbit_units[] = { "kBit/s", "MBit/s", "GBit/s" }; @@ -1223,7 +1279,7 @@ static int disk_callback(int btn, struct gui_synclist *lists) { card_name[i] = card_extract_bits(card->cid, (103-8*i), 8); } - strlcpy(card_name, card_name, sizeof(card_name)); + strmemccpy(card_name, card_name, sizeof(card_name)); simplelist_addline( "%s Rev %d.%d", card_name, (int) card_extract_bits(card->cid, 63, 4), @@ -1576,7 +1632,8 @@ static int ata_smart_attr_to_string( if (len >= name_sz) len = name_sz-1; slen += len; } - snprintf(str+slen, size-slen, "%s", buf); + + strmemccpy(str+slen, buf, size-slen); } return 1; /* ok */ @@ -1667,7 +1724,6 @@ static bool dbg_ata_smart(void) struct simplelist_info info; simplelist_info_init(&info, "S.M.A.R.T. Data [CONTEXT to dump]", 1, NULL); info.action_callback = ata_smart_callback; - info.hide_selection = true; info.scroll_all = true; return simplelist_show_list(&info); } @@ -1699,10 +1755,16 @@ static bool dbg_identify_info(void) int fd = creat("/identify_info.bin", 0666); if(fd >= 0) { + const unsigned short *identify_info = ata_get_identify(); #ifdef ROCKBOX_LITTLE_ENDIAN - ecwrite(fd, ata_get_identify(), SECTOR_SIZE/2, "s", true); + /* this is a pointer to a driver buffer so we can't modify it */ + for (int i = 0; i < SECTOR_SIZE/2; ++i) + { + unsigned short word = swap16(identify_info[i]); + write(fd, &word, 2); + } #else - write(fd, ata_get_identify(), SECTOR_SIZE); + write(fd, identify_info, SECTOR_SIZE); #endif close(fd); } @@ -1721,7 +1783,6 @@ static bool dbg_disk_info(void) info.title = title; #endif info.action_callback = disk_callback; - info.hide_selection = true; info.scroll_all = true; return simplelist_show_list(&info); } @@ -1790,7 +1851,6 @@ static bool dbg_dircache_info(void) int syncbuild = 0; simplelist_info_init(&info, "Dircache Info", 8, &syncbuild); info.action_callback = dircache_callback; - info.hide_selection = true; info.scroll_all = true; return simplelist_show_list(&info); } @@ -1803,6 +1863,7 @@ static int database_callback(int btn, struct gui_synclist *lists) (void)lists; struct tagcache_stat *stat = tagcache_get_stat(); static bool synced = false; + static int update_entries = 0; simplelist_set_line_count(0); @@ -1814,6 +1875,8 @@ static int database_callback(int btn, struct gui_synclist *lists) stat->ramcache ? "Yes" : "No"); simplelist_addline("RAM: %d/%d B", stat->ramcache_used, stat->ramcache_allocated); + simplelist_addline("Total entries: %d", + stat->total_entries); simplelist_addline("Progress: %d%% (%d entries)", stat->progress, stat->processed_entries); simplelist_addline("Curfile: %s", @@ -1835,12 +1898,19 @@ static int database_callback(int btn, struct gui_synclist *lists) if (!btn && stat->curentry) { synced = true; - return ACTION_REDRAW; + if (update_entries <= stat->processed_entries) + { + update_entries = stat->processed_entries + 100; + return ACTION_REDRAW; + } + return ACTION_NONE; } if (btn == ACTION_STD_CANCEL) + { + update_entries = 0; tagcache_screensync_enable(false); - + } return btn; } static bool dbg_tagcache_info(void) @@ -1848,7 +1918,6 @@ static bool dbg_tagcache_info(void) struct simplelist_info info; simplelist_info_init(&info, "Database Info", 8, NULL); info.action_callback = database_callback; - info.hide_selection = true; info.scroll_all = true; /* Don't do nonblock here, must give enough processing time @@ -2030,12 +2099,12 @@ static int radio_callback(int btn, struct gui_synclist *lists) tea5767_dbg_info(&nfo); simplelist_addline("Philips regs:"); simplelist_addline( - " Read: %02X %02X %02X %02X %02X", + " %s: %02X %02X %02X %02X %02X", "Read", (unsigned)nfo.read_regs[0], (unsigned)nfo.read_regs[1], (unsigned)nfo.read_regs[2], (unsigned)nfo.read_regs[3], (unsigned)nfo.read_regs[4]); simplelist_addline( - " Write: %02X %02X %02X %02X %02X", + " %s: %02X %02X %02X %02X %02X", "Write", (unsigned)nfo.write_regs[0], (unsigned)nfo.write_regs[1], (unsigned)nfo.write_regs[2], (unsigned)nfo.write_regs[3], (unsigned)nfo.write_regs[4]); @@ -2121,7 +2190,6 @@ static bool dbg_fm_radio(void) radio_hardware_present() ? "yes" : "no"); info.action_callback = radio_hardware_present()?radio_callback : NULL; - info.hide_selection = true; return simplelist_show_list(&info); } #endif /* CONFIG_TUNER */ @@ -2157,7 +2225,7 @@ static bool dbg_set_memory_guard(void) }; int mode = system_memory_guard(MEMGUARD_KEEP); - set_option( "Catch mem accesses", &mode, INT, names, MAXMEMGUARD, NULL); + set_option( "Catch mem accesses", &mode, RB_INT, names, MAXMEMGUARD, NULL); system_memory_guard(mode); return false; @@ -2250,11 +2318,6 @@ static bool cpu_boost_log(void) static bool cpu_boost_log_dump(void) { int fd; -#if CONFIG_RTC - struct tm *nowtm; - char fname[MAX_PATH]; -#endif - int count = cpu_boost_log_getcount(); char *str = cpu_boost_log_getlog_first(); @@ -2265,11 +2328,12 @@ static bool cpu_boost_log_dump(void) return false; #if CONFIG_RTC - nowtm = get_time(); - snprintf(fname, MAX_PATH, "%s/boostlog_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR, - nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday, - nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec); - fd = open(fname, O_CREAT|O_WRONLY|O_TRUNC); + char fname[MAX_PATH]; + struct tm *nowtm = get_time(); + fd = open_pathfmt(fname, sizeof(fname), O_CREAT|O_WRONLY|O_TRUNC, + "%s/boostlog_%04d%02d%02d%02d%02d%02d.txt", ROCKBOX_DIR, + nowtm->tm_year + 1900, nowtm->tm_mon + 1, nowtm->tm_mday, + nowtm->tm_hour, nowtm->tm_min, nowtm->tm_sec); #else fd = open(ROCKBOX_DIR "/boostlog.txt", O_CREAT|O_WRONLY|O_TRUNC, 0666); #endif @@ -2393,7 +2457,6 @@ static bool dbg_talk(void) else simplelist_info_init(&list, "Voice Information:", 2, &data); list.scroll_all = true; - list.hide_selection = true; list.timeout = HZ; list.get_name = dbg_talk_get_name; @@ -2433,7 +2496,6 @@ static bool dbg_isp1583(void) isp1583.scroll_all = true; simplelist_info_init(&isp1583, "ISP1583", dbg_usb_num_items(), NULL); isp1583.timeout = HZ/100; - isp1583.hide_selection = true; isp1583.get_name = dbg_usb_item; isp1583.action_callback = isp1583_action_callback; return simplelist_show_list(&isp1583); @@ -2459,83 +2521,34 @@ static bool dbg_pic(void) pic.scroll_all = true; simplelist_info_init(&pic, "PIC", pic_dbg_num_items(), NULL); pic.timeout = HZ/100; - pic.hide_selection = true; pic.get_name = pic_dbg_item; pic.action_callback = pic_action_callback; return simplelist_show_list(&pic); } #endif -static bool dbg_skin_engine(void) -{ - struct simplelist_info info; - int i, total = 0; -#if defined(HAVE_BACKDROP_IMAGE) - int ref_count; - char *path; - size_t bytes; - int path_prefix_len = strlen(ROCKBOX_DIR "/wps/"); -#endif - simplelist_info_init(&info, "Skin engine usage", 0, NULL); - simplelist_set_line_count(0); - info.hide_selection = true; - FOR_NB_SCREENS(j) { -#if NB_SCREENS > 1 - simplelist_addline("%s display:", - j == 0 ? "Main" : "Remote"); -#endif - for (i = 0; i < skin_get_num_skins(); i++) { - struct skin_stats *stats = skin_get_stats(i, j); - if (stats->buflib_handles) - { - simplelist_addline("Skin ID: %d, %d allocations", - i, stats->buflib_handles); - simplelist_addline("\tskin: %d bytes", - stats->tree_size); - simplelist_addline("\tImages: %d bytes", - stats->images_size); - simplelist_addline("\tTotal: %d bytes", - stats->tree_size + stats->images_size); - total += stats->tree_size + stats->images_size; - } - } - } - simplelist_addline("Skin total usage: %d bytes", total); -#if defined(HAVE_BACKDROP_IMAGE) - simplelist_addline("Backdrop Images:"); - i = 0; - while (skin_backdrop_get_debug(i++, &path, &ref_count, &bytes)) { - if (ref_count > 0) { - - if (!strncasecmp(path, ROCKBOX_DIR "/wps/", path_prefix_len)) - path += path_prefix_len; - simplelist_addline("%s", path); - simplelist_addline("\tref_count: %d", ref_count); - simplelist_addline("\tsize: %d", bytes); - total += bytes; - } - } - simplelist_addline("Total usage: %d bytes", total); -#endif - return simplelist_show_list(&info); -} - #if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) static bool dbg_boot_data(void) { - unsigned int crc = 0; + unsigned int crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff); struct simplelist_info info; info.scroll_all = true; simplelist_info_init(&info, "Boot data", 1, NULL); simplelist_set_line_count(0); - crc = crc_32(boot_data.payload, boot_data.length, 0xffffffff); + #if defined(HAVE_MULTIBOOT) + char rootpath[MAX_PATH / 2] = RB_ROOT_CONTENTS_DIR; int boot_volume = 0; if(crc == boot_data.crc) { boot_volume = boot_data.boot_volume; /* boot volume contained in uint8_t payload */ + int rtlen = get_redirect_dir(rootpath, sizeof(rootpath), boot_volume, "", ""); + while (rtlen > 0 && rootpath[--rtlen] == PATH_SEPCH) /* remove extra separators */ + rootpath[rtlen] = '\0'; } simplelist_addline("Boot Volume: <%lu>", boot_volume); + simplelist_addline("Root:"); + simplelist_addline("%s", rootpath); simplelist_addline(""); #endif simplelist_addline("Bootdata RAW:"); @@ -2551,7 +2564,6 @@ static bool dbg_boot_data(void) boot_data.payload[i+1], boot_data.payload[i+2], boot_data.payload[i+3]); } - info.hide_selection = true; return simplelist_show_list(&info); } #endif /* defined(HAVE_BOOTDATA) && !defined(SIMULATOR) */ @@ -2628,7 +2640,9 @@ static const struct { #ifdef PM_DEBUG { "pm histogram", peak_meter_histogram}, #endif /* PM_DEBUG */ +#ifdef BUFLIB_DEBUG_PRINT { "View buflib allocs", dbg_buflib_allocs }, +#endif #ifndef SIMULATOR #if CONFIG_TUNER { "FM Radio", dbg_fm_radio }, |