/* This is a tricky thing to parse. Right now, I keep all the * flags together and just store the offset, size, name and flags. * 00012970 l .bss 00000000 _end * 00011c60 l .init_array 00000000 __init_array_start * 00011c60 l .init_array 00000000 __preinit_array_start * 000084b0 g F .text 00000034 os_arch_start * 00000000 g .debug_aranges 00000000 __HeapBase * 00011c88 g O .data 00000008 g_os_task_list * 000082cc g F .text 0000004c os_idle_task * 000094e0 g F .text 0000002e .hidden __gnu_uldivmod_helper * 00000000 g .svc_table 00000000 SVC_Count * 000125e4 g O .bss 00000004 g_console_is_init * 00009514 g F .text 0000029c .hidden __divdi3 * 000085a8 g F .text 00000054 os_eventq_put * 00000100 O *COM* 00000004 g_idle_task_stack */ func parseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) { answer := r.FindAllStringSubmatch(line, 11) if len(answer) == 0 { return nil, nil } data := answer[0] if len(data) != 6 { util.StatusMessage(util.VERBOSITY_DEFAULT, "Not enough content in object file line --- %s", line) return nil, nil } si := symbol.NewSymbolInfo() si.Name = data[5] v, err := strconv.ParseUint(data[1], 16, 32) if err != nil { util.StatusMessage(util.VERBOSITY_DEFAULT, "Could not convert location from object file line --- %s", line) return nil, nil } si.Loc = int(v) v, err = strconv.ParseUint(data[4], 16, 32) if err != nil { util.StatusMessage(util.VERBOSITY_DEFAULT, "Could not convert size form object file line --- %s", line) return nil, nil } si.Size = int(v) si.Code = data[2] si.Section = data[3] /* Common section has length in a different spot. Also, these * are really global variables so mark them as such */ if si.IsSection("*COM*") { si.Size = (*si).Loc si.Code = "g" + si.Code[1:] } return nil, si }
/* This is a tricky thing to parse. Right now, I keep all the * flags together and just store the offset, size, name and flags. * 00012970 l .bss 00000000 _end * 00011c60 l .init_array 00000000 __init_array_start * 00011c60 l .init_array 00000000 __preinit_array_start * 000084b0 g F .text 00000034 os_arch_start * 00000000 g .debug_aranges 00000000 __HeapBase * 00011c88 g O .data 00000008 g_os_task_list * 000082cc g F .text 0000004c os_idle_task * 000094e0 g F .text 0000002e .hidden __gnu_uldivmod_helper * 00000000 g .svc_table 00000000 SVC_Count * 000125e4 g O .bss 00000004 g_console_is_init * 00009514 g F .text 0000029c .hidden __divdi3 * 000085a8 g F .text 00000054 os_eventq_put */ func ParseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) { answer := r.FindAllStringSubmatch(line, 11) if len(answer) == 0 { return nil, nil } data := answer[0] if len(data) != 6 { util.StatusMessage(util.VERBOSITY_DEFAULT, "Not enough content in object file line --- %s", line) return nil, nil } si := symbol.NewSymbolInfo() si.Name = data[5] v, err := strconv.ParseUint(data[1], 16, 32) if err != nil { util.StatusMessage(util.VERBOSITY_DEFAULT, "Could not convert location from object file line --- %s", line) return nil, nil } si.Loc = int(v) v, err = strconv.ParseUint(data[4], 16, 32) if err != nil { util.StatusMessage(util.VERBOSITY_DEFAULT, "Could not convert size form object file line --- %s", line) return nil, nil } si.Size = int(v) si.Code = data[2] si.Section = data[3] return nil, si }