From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/coff.c | 22 ++++++------- dlls/dbghelp/dwarf.c | 2 +- dlls/dbghelp/msc.c | 75 ++++++++++++++++++++++++-------------------- dlls/dbghelp/stabs.c | 29 +++++++++-------- 4 files changed, 68 insertions(+), 60 deletions(-)
diff --git a/dlls/dbghelp/coff.c b/dlls/dbghelp/coff.c index 21b4f726dd3..29c75c375e1 100644 --- a/dlls/dbghelp/coff.c +++ b/dlls/dbghelp/coff.c @@ -161,7 +161,6 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg) int linetab_indx; const char* nampnt; int naux; - BOOL ret = FALSE; ULONG64 addr;
TRACE("Processing COFF symbols...\n"); @@ -378,7 +377,8 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg) i += naux; }
- if (coff_files.files != NULL) + if (coff_files.files == NULL) return FALSE; + if (SymGetOptions() & SYMOPT_LOAD_LINES) { /* * OK, we now should have a list of files, and we should have a list @@ -436,15 +436,13 @@ BOOL coff_process_info(const struct msc_debug_info* msc_dbg) HeapFree(GetProcessHeap(), 0, coff_files.files[j].entries); } HeapFree(GetProcessHeap(), 0, coff_files.files); - msc_dbg->module->module.SymType = SymCoff; - /* FIXME: we could have a finer grain here */ - msc_dbg->module->module.LineNumbers = TRUE; - msc_dbg->module->module.GlobalSymbols = TRUE; - msc_dbg->module->module.TypeInfo = FALSE; - msc_dbg->module->module.SourceIndexed = TRUE; - msc_dbg->module->module.Publics = TRUE; - ret = TRUE; } - - return ret; + msc_dbg->module->module.SymType = SymCoff; + + msc_dbg->module->module.LineNumbers = !!(SymGetOptions() & SYMOPT_LOAD_LINES); + msc_dbg->module->module.GlobalSymbols = TRUE; + msc_dbg->module->module.TypeInfo = FALSE; + msc_dbg->module->module.SourceIndexed = TRUE; + msc_dbg->module->module.Publics = TRUE; + return TRUE; } diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 883b04dd6a1..3971ff64988 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -3074,7 +3074,7 @@ static BOOL dwarf2_parse_compilation_unit(dwarf2_parse_context_t* ctx) child = *(dwarf2_debug_info_t**)vector_at(children, i); dwarf2_load_one_entry(child); } - if (dwarf2_find_attribute(di, DW_AT_stmt_list, &stmt_list)) + if ((SymGetOptions() & SYMOPT_LOAD_LINES) && dwarf2_find_attribute(di, DW_AT_stmt_list, &stmt_list)) { if (dwarf2_parse_line_numbers(ctx, comp_dir.u.string, stmt_list.u.uvalue)) ctx->module_ctx->module->module.LineNumbers = TRUE; diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 1352fe145f4..0b28abf200d 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -3773,7 +3773,6 @@ static BOOL pdb_process_internal(const struct process *pcs, TRACE("Processing PDB file %ls\n", filename);
*has_linenumber_info = FALSE; - pdb_file = &pdb_module_info->pdb_files[module_index == -1 ? 0 : module_index]; /* Open and map() .PDB file */ if ((hFile = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, @@ -3879,21 +3878,25 @@ static BOOL pdb_process_internal(const struct process *pcs, files_image}; codeview_snarf(msc_dbg, modimage, sizeof(DWORD), sfile.symbol_size, &cvmod, file_name);
- if (sfile.lineno_size && sfile.lineno2_size) - FIXME("Both line info present... only supporting second\n"); - else if (sfile.lineno_size) - { - if (codeview_snarf_linetab(msc_dbg, - modimage + sfile.symbol_size, - sfile.lineno_size, - pdb_file->kind == PDB_JG)) - *has_linenumber_info = TRUE; - } - else if (sfile.lineno2_size) + if (SymGetOptions() & SYMOPT_LOAD_LINES) { - if (codeview_snarf_linetab2(msc_dbg, &cvmod)) - *has_linenumber_info = TRUE; + if (sfile.lineno_size && sfile.lineno2_size) + FIXME("Both line info present... only supporting second\n"); + else if (sfile.lineno_size) + { + if (codeview_snarf_linetab(msc_dbg, + modimage + sfile.symbol_size, + sfile.lineno_size, + pdb_file->kind == PDB_JG)) + *has_linenumber_info = TRUE; + } + else if (sfile.lineno2_size) + { + if (codeview_snarf_linetab2(msc_dbg, &cvmod)) + *has_linenumber_info = TRUE; + } } + pdb_free(modimage); } file_name += strlen(file_name) + 1; @@ -3909,9 +3912,11 @@ static BOOL pdb_process_internal(const struct process *pcs, data = pdb_read_stream(pdb_file, symbols.global_hash_stream); if (data) { - codeview_snarf_sym_hashtable(msc_dbg, globalimage, global_size, - data, pdb_get_stream_size(pdb_file, symbols.global_hash_stream), - pdb_global_feed_variables); + if (codeview_snarf_sym_hashtable(msc_dbg, globalimage, global_size, + data, pdb_get_stream_size(pdb_file, + symbols.global_hash_stream), + pdb_global_feed_variables)) + *has_linenumber_info = TRUE; pdb_free((void*)data); } if (!(dbghelp_options & SYMOPT_NO_PUBLICS) && (data = pdb_read_stream(pdb_file, symbols.public_stream))) @@ -4415,23 +4420,25 @@ static BOOL codeview_process_info(const struct process *pcs, { codeview_snarf(msc_dbg, msc_dbg->root + ent->lfo, sizeof(DWORD), ent->cb, NULL, NULL);
- /* - * Check the next and previous entry. If either is a - * sstSrcModule, it contains the line number info for - * this file. - * - * FIXME: This is not a general solution! - */ - if (next && next->iMod == ent->iMod && next->SubSection == sstSrcModule) - if (codeview_snarf_linetab(msc_dbg, msc_dbg->root + next->lfo, - next->cb, TRUE)) - has_linenumber_info = TRUE; - - if (prev && prev->iMod == ent->iMod && prev->SubSection == sstSrcModule) - if (codeview_snarf_linetab(msc_dbg, msc_dbg->root + prev->lfo, - prev->cb, TRUE)) - has_linenumber_info = TRUE; - + if (SymGetOptions() & SYMOPT_LOAD_LINES) + { + /* + * Check the next and previous entry. If either is a + * sstSrcModule, it contains the line number info for + * this file. + * + * FIXME: This is not a general solution! + */ + if (next && next->iMod == ent->iMod && next->SubSection == sstSrcModule) + if (codeview_snarf_linetab(msc_dbg, msc_dbg->root + next->lfo, + next->cb, TRUE)) + has_linenumber_info = TRUE; + + if (prev && prev->iMod == ent->iMod && prev->SubSection == sstSrcModule) + if (codeview_snarf_linetab(msc_dbg, msc_dbg->root + prev->lfo, + prev->cb, TRUE)) + has_linenumber_info = TRUE; + } } }
diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c index d02f320e281..8d9b91eeb4f 100644 --- a/dlls/dbghelp/stabs.c +++ b/dlls/dbghelp/stabs.c @@ -1493,21 +1493,24 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset, if (curr_func != NULL) pending_add_var(&pending_block, ptr, DataIsLocal, &loc); break; case N_SLINE: - /* - * This is a line number. These are always relative to the start - * of the function (N_FUN), and this makes the lookup easier. - */ - assert(source_idx >= 0); - if (curr_func != NULL) + if (SymGetOptions() & SYMOPT_LOAD_LINES) { - ULONG_PTR offset = n_value; - if (module->type == DMT_MACHO) - offset -= curr_func->ranges[0].low - load_offset; - symt_add_func_line(module, curr_func, source_idx, - stab_ptr->n_desc, curr_func->ranges[0].low + offset); + /* + * This is a line number. These are always relative to the start + * of the function (N_FUN), and this makes the lookup easier. + */ + assert(source_idx >= 0); + if (curr_func != NULL) + { + ULONG_PTR offset = n_value; + if (module->type == DMT_MACHO) + offset -= curr_func->ranges[0].low - load_offset; + symt_add_func_line(module, curr_func, source_idx, + stab_ptr->n_desc, curr_func->ranges[0].low + offset); + } + else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc, + n_value, load_offset); } - else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc, - n_value, load_offset); break; case N_FUN: /*