diff options
author | Roland McGrath <[email protected]> | 2009-07-21 18:14:52 -0700 |
---|---|---|
committer | Roland McGrath <[email protected]> | 2009-07-21 18:14:52 -0700 |
commit | e23e9e7de7d070a47ef641abeaf272467a1cff4c (patch) | |
tree | 9dbe59868b62cdee5ecc9843798c2c87a2b7e5a7 | |
parent | d1083043cf63551270f31aa83233d55286a89d65 (diff) |
Fix dwarf_getsrc_file handling empty CUs.
-rw-r--r-- | libdw/ChangeLog | 8 | ||||
-rw-r--r-- | libdw/dwarf_entry_breakpoints.c | 4 | ||||
-rw-r--r-- | libdw/dwarf_getsrc_file.c | 19 |
3 files changed, 22 insertions, 9 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog index f04880b5..1b19e9fc 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,11 @@ +2009-07-21 Roland McGrath <[email protected]> + + * dwarf_getsrc_file.c: Ignore a CU that just has no DW_AT_stmt_list. + Fix loop iteration after skipping a bogus or useless CU. + + * dwarf_entry_breakpoints.c: Handle 0 dwarf_errno () as harmless + absence, not DWARF_E_NO_DEBUG_LINE. + 2009-07-20 Roland McGrath <[email protected]> * dwarf_getlocation.c (__libdw_intern_expression): diff --git a/libdw/dwarf_entry_breakpoints.c b/libdw/dwarf_entry_breakpoints.c index 578464f3..1e5c1b81 100644 --- a/libdw/dwarf_entry_breakpoints.c +++ b/libdw/dwarf_entry_breakpoints.c @@ -1,5 +1,5 @@ /* Find entry breakpoint locations for a function. - Copyright (C) 2005, 2008 Red Hat, Inc. + Copyright (C) 2005-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -93,7 +93,7 @@ dwarf_entry_breakpoints (die, bkpts) if (INTUSE(dwarf_getsrclines) (&cudie, &lines, &nlines) < 0) { int error = INTUSE (dwarf_errno) (); - if (error == DWARF_E_NO_DEBUG_LINE) + if (error == 0) /* CU has no DW_AT_stmt_list. */ return entrypc_bkpt (); __libdw_seterrno (error); return -1; diff --git a/libdw/dwarf_getsrc_file.c b/libdw/dwarf_getsrc_file.c index 91abbaeb..bc612f6c 100644 --- a/libdw/dwarf_getsrc_file.c +++ b/libdw/dwarf_getsrc_file.c @@ -1,5 +1,5 @@ /* Find line information for given file/line/column triple. - Copyright (C) 2005 Red Hat, Inc. + Copyright (C) 2005-2009 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2005. @@ -74,11 +74,11 @@ dwarf_getsrc_file (Dwarf *dbg, const char *fname, int lineno, int column, size_t cur_match = 0; Dwarf_Line **match = *nsrcs == 0 ? NULL : *srcsp; - Dwarf_Off off = 0; size_t cuhl; Dwarf_Off noff; - - while (INTUSE(dwarf_nextcu) (dbg, off, &noff, &cuhl, NULL, NULL, NULL) == 0) + for (Dwarf_Off off = 0; + INTUSE(dwarf_nextcu) (dbg, off, &noff, &cuhl, NULL, NULL, NULL) == 0; + off = noff) { Dwarf_Die cudie_mem; Dwarf_Die *cudie = INTUSE(dwarf_offdie) (dbg, off + cuhl, &cudie_mem); @@ -89,7 +89,14 @@ dwarf_getsrc_file (Dwarf *dbg, const char *fname, int lineno, int column, Dwarf_Lines *lines; size_t nlines; if (INTUSE(dwarf_getsrclines) (cudie, &lines, &nlines) != 0) - return -1; + { + /* Ignore a CU that just has no DW_AT_stmt_list at all. */ + int error = INTUSE(dwarf_errno) (); + if (error == 0) + continue; + __libdw_seterrno (error); + return -1; + } /* Search through all the line number records for a matching file and line/column number. If any of the numbers is zero, @@ -175,8 +182,6 @@ dwarf_getsrc_file (Dwarf *dbg, const char *fname, int lineno, int column, already, there is no need to go on to the next CU. */ if (cur_match == max_match) break; - - off = noff; } if (cur_match > 0) |