[Ups-cvs] ups/ups ao_aout.c, 1.1.1.1, 1.2 ao_dwfsyms.c, 1.27, 1.28 ao_dwftext.c, 1.10, 1.11 ao_dwfu
Brought to you by:
ianedwards
Update of /cvsroot/ups/ups/ups In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5765 Modified Files: ao_aout.c ao_dwfsyms.c ao_dwftext.c ao_dwfutil.c ao_elfsym.c ao_syms.h ao_symscan.c ao_text.c ao_text.h Log Message: Use eh_frame data to unwind the stack if dwarf_frame does not exist. This also requires that we keep a libdwarf handle for the main object as well as the debug object when separate debug files are in use. Index: ao_dwftext.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_dwftext.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ao_dwftext.c 29 Jul 2008 15:12:50 -0000 1.10 --- ao_dwftext.c 7 Jul 2009 15:42:44 -0000 1.11 *************** *** 79,82 **** --- 79,83 ---- Dwarf_Error dw_err; dwarf_finish(AO_STDATA(st)->st_dw_dbg, &dw_err); + dwarf_finish(AO_STDATA(st)->st_dw_debug_dbg, &dw_err); ao_close_symtab_data(st); } *************** *** 136,140 **** func_t *flist; ! dwf_scan_symtab(st, NULL, NULL, &flist, NULL, ast->st_dw_dbg); return f; --- 137,141 ---- func_t *flist; ! dwf_scan_symtab(st, NULL, NULL, &flist, NULL, ast->st_dw_debug_dbg); return f; *************** *** 148,152 **** func_t *flist; ! dwf_scan_symtab(st, NULL, NULL, &flist, NULL, ast->st_dw_dbg); return st->st_sfiles; --- 149,153 ---- func_t *flist; ! dwf_scan_symtab(st, NULL, NULL, &flist, NULL, ast->st_dw_debug_dbg); return st->st_sfiles; *************** *** 392,397 **** ao_stdata_t *ast = AO_STDATA(st); taddr_t adjusted_pc = *pc - ast->st_dw_base_address; ! ! if (dwf_unwind(ast->st_dw_dbg, xp, fp, sp, &adjusted_pc, cfa)) { *pc = adjusted_pc; return TRUE; --- 393,402 ---- ao_stdata_t *ast = AO_STDATA(st); taddr_t adjusted_pc = *pc - ast->st_dw_base_address; ! taddr_t debug_adjusted_pc = *pc - ast->st_dw_debug_base_address; ! ! if (dwf_unwind(ast->st_dw_debug_dbg, xp, fp, sp, &debug_adjusted_pc, cfa)) { ! *pc = debug_adjusted_pc; ! return TRUE; ! } else if (dwf_unwind(ast->st_dw_dbg, xp, fp, sp, &adjusted_pc, cfa)) { *pc = adjusted_pc; return TRUE; Index: ao_dwfsyms.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_dwfsyms.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ao_dwfsyms.c 7 Jul 2008 10:34:48 -0000 1.27 --- ao_dwfsyms.c 7 Jul 2009 15:42:44 -0000 1.28 *************** *** 1333,1337 **** * Start a new 'stf'. */ ! stf = make_stf(ap, cu_name, st, 0, lang, ast->st_dw_base_address); stf->stf_symlim = -1; stf->stf_fnum = -1; --- 1333,1337 ---- * Start a new 'stf'. */ ! stf = make_stf(ap, cu_name, st, 0, lang, ast->st_dw_debug_base_address); stf->stf_symlim = -1; stf->stf_fnum = -1; Index: ao_symscan.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_symscan.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ao_symscan.c 29 Jul 2008 14:25:10 -0000 1.10 --- ao_symscan.c 7 Jul 2009 15:42:44 -0000 1.11 *************** *** 2021,2024 **** --- 2021,2025 ---- #if WANT_DWARF ast->st_dw_base_address = ast->st_dw_base_address + delta; + ast->st_dw_debug_base_address = ast->st_dw_debug_base_address + delta; #endif } Index: ao_elfsym.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_elfsym.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ao_elfsym.c 26 Mar 2007 12:31:56 -0000 1.14 --- ao_elfsym.c 7 Jul 2009 15:42:44 -0000 1.15 *************** *** 970,973 **** --- 970,974 ---- symtab_type_t st_is; Dwarf_Debug dw_dbg; + Dwarf_Debug dw_debug_dbg; Dwarf_Error dw_err; int rv; *************** *** 981,985 **** #if WANT_DWARF if (st_is == ST_DWARF) { ! if ((rv = dwarf_init(el->debugel->fd, DW_DLC_READ, NULL, NULL, &dw_dbg, &dw_err) == DW_DLV_ERROR)) { dwf_fatal_error("dwarf_init", rv, NULL, dw_err); --- 982,986 ---- #if WANT_DWARF if (st_is == ST_DWARF) { ! if ((rv = dwarf_init(el->fd, DW_DLC_READ, NULL, NULL, &dw_dbg, &dw_err) == DW_DLV_ERROR)) { dwf_fatal_error("dwarf_init", rv, NULL, dw_err); *************** *** 987,990 **** --- 988,997 ---- return FALSE; } + if ((rv = dwarf_init(el->debugel->fd, DW_DLC_READ, NULL, NULL, + &dw_debug_dbg, &dw_err) == DW_DLV_ERROR)) { + dwf_fatal_error("dwarf_init", rv, NULL, dw_err); + free_elfinfo(el); + return FALSE; + } if (rv == DW_DLV_NO_ENTRY) { errf("Can't debug %s: no DWARF debugging information", *************** *** 1001,1005 **** mainfunc_name = NULL; p_mainfunc_name = (p_mainfunc != NULL) ? &mainfunc_name : NULL; ! if (!scan_ao_symtab(textpath, fd, &eibuf, dw_dbg, 0, st_is, &st, &flist, p_mainfunc_name)) { free_elfinfo(el); --- 1008,1012 ---- mainfunc_name = NULL; p_mainfunc_name = (p_mainfunc != NULL) ? &mainfunc_name : NULL; ! if (!scan_ao_symtab(textpath, fd, &eibuf, dw_dbg, dw_debug_dbg, 0, st_is, &st, &flist, p_mainfunc_name)) { free_elfinfo(el); Index: ao_syms.h =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_syms.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ao_syms.h 29 Jul 2008 14:24:32 -0000 1.8 --- ao_syms.h 7 Jul 2009 15:42:44 -0000 1.9 *************** *** 145,153 **** #if WANT_DWARF ! hashtab_t *st_type_names; /* Type name -> DIE. */ ! Dwarf_Debug st_dw_dbg; /* Handle for libdwarf calls */ ! bool st_dw_scanned; /* Dwarf symbols scanned? */ ! taddr_t st_dw_base_address; /* Addr shlib mapped rel to Dwarf sym addrs */ ! type_t *st_dw_void_type; /* Void type */ #endif --- 145,155 ---- #if WANT_DWARF ! hashtab_t *st_type_names; /* Type name -> DIE. */ ! Dwarf_Debug st_dw_dbg; /* Handle for libdwarf calls on main object */ ! Dwarf_Debug st_dw_debug_dbg; /* Handle for libdwarf calls on debug object */ ! bool st_dw_scanned; /* Dwarf symbols scanned? */ ! taddr_t st_dw_base_address; /* Addr main object mapped rel to Dwarf sym addrs */ ! taddr_t st_dw_debug_base_address; /* Addr debug object mapped rel to Dwarf sym addrs */ ! type_t *st_dw_void_type; /* Void type */ #endif Index: ao_text.h =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_text.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ao_text.h 29 Jul 2008 15:12:51 -0000 1.2 --- ao_text.h 7 Jul 2009 15:42:44 -0000 1.3 *************** *** 34,40 **** #ifdef AO_EXECINFO_H_INCLUDED bool scan_ao_symtab PROTO((const char *textpath, int fd, Execinfo *ei, ! Dwarf_Debug dw_dbg, taddr_t base_address, ! symtab_type_t st_is, symtab_t **p_symtab, ! func_t **p_flist, const char **p_mainfunc_name)); void do_ao_postscan_stuff PROTO((symtab_t *st, func_t *flist, Execinfo *ei, --- 34,41 ---- #ifdef AO_EXECINFO_H_INCLUDED bool scan_ao_symtab PROTO((const char *textpath, int fd, Execinfo *ei, ! Dwarf_Debug dw_dbg, Dwarf_Debug dw_debug_dbg, ! taddr_t base_address, symtab_type_t st_is, ! symtab_t **p_symtab, func_t **p_flist, ! const char **p_mainfunc_name)); void do_ao_postscan_stuff PROTO((symtab_t *st, func_t *flist, Execinfo *ei, Index: ao_aout.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_aout.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ao_aout.c 26 Oct 2002 13:05:11 -0000 1.1.1.1 --- ao_aout.c 7 Jul 2009 15:42:44 -0000 1.2 *************** *** 301,305 **** p_mainfunc_name = (p_mainfunc != NULL) ? &mainfunc_name : NULL; ! if (!scan_ao_symtab(textpath, fd, &eibuf, NULL, shlib_load_addr, st_is, &st, &flist, p_mainfunc_name)) { return FALSE; --- 301,305 ---- p_mainfunc_name = (p_mainfunc != NULL) ? &mainfunc_name : NULL; ! if (!scan_ao_symtab(textpath, fd, &eibuf, NULL, NULL, shlib_load_addr, st_is, &st, &flist, p_mainfunc_name)) { return FALSE; Index: ao_text.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_text.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ao_text.c 29 Jul 2008 15:12:51 -0000 1.13 --- ao_text.c 7 Jul 2009 15:42:44 -0000 1.14 *************** *** 163,167 **** bool ! scan_ao_symtab(textpath, fd, ei, dw_dbg, base_address, st_is, p_symtab, p_flist, p_mainfunc_name) const char *textpath; --- 163,167 ---- bool ! scan_ao_symtab(textpath, fd, ei, dw_dbg, dw_debug_dbg, base_address, st_is, p_symtab, p_flist, p_mainfunc_name) const char *textpath; *************** *** 169,172 **** --- 169,173 ---- Execinfo *ei; Dwarf_Debug dw_dbg; + Dwarf_Debug dw_debug_dbg; taddr_t base_address; symtab_type_t st_is; *************** *** 254,262 **** ast->st_type_names = NULL; ast->st_dw_dbg = 0; ast->st_dw_scanned = FALSE; ! ast->st_dw_base_address = base_address + ei->debug_addr_delta; ast->st_dw_void_type = NULL; if (st_is == ST_DWARF) { ast->st_dw_dbg = dw_dbg; st = make_symtab(ap, textpath, (fil_t *)NULL, (func_t *)NULL, &dwarf_ops, (char *)ast); --- 255,266 ---- ast->st_type_names = NULL; ast->st_dw_dbg = 0; + ast->st_dw_debug_dbg = 0; ast->st_dw_scanned = FALSE; ! ast->st_dw_base_address = base_address; ! ast->st_dw_debug_base_address = base_address + ei->debug_addr_delta; ast->st_dw_void_type = NULL; if (st_is == ST_DWARF) { ast->st_dw_dbg = dw_dbg; + ast->st_dw_debug_dbg = dw_debug_dbg; st = make_symtab(ap, textpath, (fil_t *)NULL, (func_t *)NULL, &dwarf_ops, (char *)ast); Index: ao_dwfutil.c =================================================================== RCS file: /cvsroot/ups/ups/ups/ao_dwfutil.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ao_dwfutil.c 29 Jul 2008 15:16:10 -0000 1.17 --- ao_dwfutil.c 7 Jul 2009 15:42:44 -0000 1.18 *************** *** 689,693 **** } ! if ((rv = dwarf_get_fde_list(dbg, &cie_data, &cie_count, &fde_data, &fde_count, &err)) == DW_DLV_OK) { Dwarf_Fde fde; --- 689,694 ---- } ! if ((rv = dwarf_get_fde_list(dbg, &cie_data, &cie_count, &fde_data, &fde_count, &err)) == DW_DLV_OK || ! (rv = dwarf_get_fde_list_eh(dbg, &cie_data, &cie_count, &fde_data, &fde_count, &err)) == DW_DLV_OK) { Dwarf_Fde fde; |