Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/disasm/disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,31 @@ dasm_artifact_create(String8 key, B32 *cancel_signal, AC_Status *status_out, U64
RDI_SourceFile *file = rdi_element_from_name_idx(rdi, SourceFiles, line->file_idx);
String8 file_normalized_full_path = {0};
file_normalized_full_path.str = rdi_string_from_idx(rdi, file->normal_full_path_string_idx, &file_normalized_full_path.size);
// NOTE(Giovanni): reconstruct the file's real-case path from the file path node tree
// "normal_full_path" is lowercased for case-insensitive matching, and must not
// be used to actually touch the filesystem, which is case sensitive on Linux
String8 file_full_path = file_normalized_full_path;
if(file->file_path_node_idx != 0)
{
String8List path_parts = {0};
for(RDI_FilePathNode *fpn = rdi_element_from_name_idx(rdi, FilePathNodes, file->file_path_node_idx);
fpn != rdi_element_from_name_idx(rdi, FilePathNodes, 0);
fpn = rdi_element_from_name_idx(rdi, FilePathNodes, fpn->parent_path_node))
{
String8 path_part = {0};
path_part.str = rdi_string_from_idx(rdi, fpn->name_string_idx, &path_part.size);
str8_list_push_front(scratch.arena, &path_parts, path_part);
}
StringJoin path_join = {0};
path_join.sep = str8_lit("/");
file_full_path = str8_list_join(scratch.arena, &path_parts, &path_join);
}
if(file != last_file)
{
if(params.style_flags & DASM_StyleFlag_SourceFilesNames &&
file->normal_full_path_string_idx != 0 && file_normalized_full_path.size != 0)
file->normal_full_path_string_idx != 0 && file_full_path.size != 0)
{
String8 inst_string = push_str8f(scratch.arena, "> %S", file_normalized_full_path);
String8 inst_string = push_str8f(scratch.arena, "> %S", file_full_path);
DASM_Line inst = {u32_from_u64_saturate(off), DASM_LineFlag_Decorative, 0, r1u64(inst_strings.total_size + inst_strings.node_count,
inst_strings.total_size + inst_strings.node_count + inst_string.size)};
dasm_line_chunk_list_push(scratch.arena, &line_list, 1024, &inst);
Expand All @@ -227,15 +246,15 @@ dasm_artifact_create(String8 key, B32 *cancel_signal, AC_Status *status_out, U64
}
if(line && line != last_line && file->normal_full_path_string_idx != 0 &&
params.style_flags & DASM_StyleFlag_SourceLines &&
file_normalized_full_path.size != 0)
file_full_path.size != 0)
{
FileProperties props = properties_from_file_path(file_normalized_full_path);
FileProperties props = properties_from_file_path(file_full_path);
if(props.modified != 0)
{
// TODO(rjf): need redirection path - this may map to a different path on the local machine,
// need frontend to communicate path remapping info to this layer
C_Key key = fs_key_from_path_range(file_normalized_full_path, r1u64(0, max_U64), 0);
TXT_LangKind lang_kind = txt_lang_kind_from_extension(file_normalized_full_path);
C_Key key = fs_key_from_path_range(file_full_path, r1u64(0, max_U64), 0);
TXT_LangKind lang_kind = txt_lang_kind_from_extension(file_full_path);
U64 endt_us = max_U64;
U128 hash = {0};
TXT_TextInfo text_info = txt_text_info_from_key_lang(access, key, lang_kind, &hash);
Expand Down
2 changes: 1 addition & 1 deletion src/linux/demon/linux_demon.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ lnx_dmn_module_alloc(LNX_DMN_ProcessCtx *ctx, int memory_fd, U64 base_vaddr, U64

// rjf: unpack module's vaddr range
U64 module_rebase = module_ehdr.e_type == ELF_Type_Dyn ? base_vaddr : 0;
U64 module_phdr_vaddr = module_rebase + module_ehdr.e_phoff;
U64 module_phdr_vaddr = base_vaddr + module_ehdr.e_phoff;
Rng1U64 module_vrange = lnx_dmn_vaddr_range_from_phdrs(memory_fd, module_ehdr.e_ident[ELF_Identifier_Class], module_rebase, module_phdr_vaddr, module_ehdr.e_phentsize, module_ehdr.e_phnum);

// rjf: read TLS index and TLS offset
Expand Down
35 changes: 23 additions & 12 deletions src/linux/window_manager/linux_window_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,17 +682,18 @@ wm_window_focus(WM_Window handle)
{
if(wm_window_match(handle, wm_window_zero())) {return;}
LNX_WM_Window *w = (LNX_WM_Window *)handle.u64[0];
//
// TODO: if the target is lightweight, the debugger may launch it even before the first frame is drawn;
// this is a problem because XSetInputFocus is now called before XMapWindow, we need a guard
// to prevent an X server error:
//
// X Error of failed request: BadMatch (invalid parameter attributes)
// Major opcode of failed request: 42 (X_SetInputFocus)
// Serial number of failed request: 373
// Current serial number in output stream: 374
//
XSetInputFocus(lnx_wm_state->display, w->window, RevertToNone, CurrentTime);

//NOTE(Giovanni): defer focus until window is mapped to avoid X BadMatch
XWindowAttributes attr;
if(!XGetWindowAttributes(lnx_wm_state->display, w->window, &attr)) {return;}
if(attr.map_state == IsViewable)
{
XSetInputFocus(lnx_wm_state->display, w->window, RevertToNone, CurrentTime);
}
else
{
w->pending_focus = 1;
}
}

internal B32
Expand Down Expand Up @@ -1272,7 +1273,17 @@ wm_get_events(Arena *arena, B32 wait)
WM_Event *e = wm_event_list_push_new(arena, &evts, WM_EventKind_WindowLoseFocus);
e->window.u64[0] = (U64)window;
}break;

// NOTE(Giovanni): complete focus request
case MapNotify:
{
LNX_WM_Window *window = lnx_window_from_x11window(evt.xmap.window);
if(window != 0 && window->pending_focus)
{
window->pending_focus = 0;
XSetInputFocus(lnx_wm_state->display, window->window, RevertToNone, CurrentTime);
XFlush(lnx_wm_state->display);
}
}break;
//- rjf: window moves & resizes
case ConfigureNotify:
{
Expand Down
1 change: 1 addition & 0 deletions src/linux/window_manager/linux_window_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct LNX_WM_Window
U64 counter_value;
B32 resize_draw;
Rng2F32 last_synced_rect;
B32 pending_focus;
B32 waiting_for_resize;
B32 custom_border;
F32 custom_title_bar_thickness;
Expand Down
5 changes: 4 additions & 1 deletion src/raddbg/raddbg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -13737,7 +13737,10 @@ rd_frame(void)
}
primary_args_string = str8_list_join(scratch.arena, &primary_args_strings, &(StringJoin){.sep = str8_lit(" ")});
}
rd_regs_fill_slot_from_string(cmd_kind_info->query.slot, cmd_kind_info->query.expr, primary_args_string);
if(cmd_kind_info->query.slot != RD_RegSlot_Null)
{
rd_regs_fill_slot_from_string(cmd_kind_info->query.slot, cmd_kind_info->query.expr, primary_args_string);
}
rd_regs()->disable_addresses = 1;
rd_push_cmd(cmd_kind_name, rd_regs());
}
Expand Down
18 changes: 12 additions & 6 deletions src/rdi_from_dwarf/rdi_from_dwarf.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,13 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
if(f->file_name.size != 0)
{
DW2_LineTableFile *dir = &hdr->dirs.v[f->dir_idx];
String8 full_file_path = str8f(scratch2.arena, "%S%s%S", dir->file_name, dir->file_name.size != 0 ? "/" : "", f->file_name);
String8 dir_path = dir->file_name;
if(dir_path.size != 0 && dir_path.str[0] != '/' &&
hdr->dirs.count != 0 && hdr->dirs.v[0].file_name.size != 0)
{
dir_path = str8f(scratch2.arena, "%S/%S", hdr->dirs.v[0].file_name, dir_path);
}
String8 full_file_path = str8f(scratch2.arena, "%S%s%S", dir_path, dir_path.size != 0 ? "/" : "", f->file_name);
U64 hash = u64_hash_from_str8(full_file_path);
U64 slot_idx = hash%slots_count;
SrcFileNode *node = 0;
Expand Down Expand Up @@ -825,10 +831,10 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
}

//- rjf: emit lines
if(emit_line && vm_regs.address != 0 && vm_regs.line != 0)
B32 should_emit_line = emit_line;
emit_line = 0;
if(should_emit_line && vm_regs.address != 0 && vm_regs.line != 0)
{
emit_line = 0;

// rjf: grab the last emitted line info
U32 last_line = 0;
U16 last_col = 0;
Expand Down Expand Up @@ -2991,11 +2997,11 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
U64 voff_opl = 0;
if(dw_attrib_class_from_form_kind(unit_parse_ctx->version, unit_parse_ctx->exts, hipc_attrib->val.kind) & DW_AttribClass_Address)
{
voff_opl = voff_base + hipc_attrib->val.u128.u64[0];
voff_opl = hipc_attrib->val.addr;
}
else
{
voff_opl = hipc_attrib->val.addr;
voff_opl = voff_base + hipc_attrib->val.u128.u64[0];
}
rdim_rng1u64_chunk_list_push(arena, &unit_voff_ranges, 256, (RDIM_Rng1U64){voff_base, voff_opl});
}
Expand Down