summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_getsrclines.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2007-04-16 23:13:37 +0000
committerRoland McGrath <[email protected]>2007-04-16 23:13:37 +0000
commit43da9895c6d828ceae65a47f2337e8ef24eb97c1 (patch)
tree4454878335a5a6f65083a04824b3968702bfcf6b /libdw/dwarf_getsrclines.c
parentbf2ee480165faec726d678f189acd2bd54e07573 (diff)
libdw/
2007-04-16 Roland McGrath <[email protected]> * libdw.map (ELFUTILS_0.127): Add dwfl_module_address_section. libdwfl/ 2007-04-16 Roland McGrath <[email protected]> * derelocate.c (cache_sections): Apply bias to sh_addr. (compare_secrefs): Fix address comparison to avoid signed overflow. (find_section): New function, broken out of ... (dwfl_module_relocate_address): ... here, call it. (check_module): New function, broken out of ... (dwfl_module_relocate_address): ... here, call it. (dwfl_module_address_section): New function. * libdwfl.h: Declare it. tests/ 2007-04-16 Roland McGrath <[email protected]> * dwfl-addr-sect.c: New file. * Makefile.am (noinst_PROGRAMS): Add it. (dwfl_addr_sect_LDADD): New variable.
Diffstat (limited to 'libdw/dwarf_getsrclines.c')
-rw-r--r--libdw/dwarf_getsrclines.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c
index 2aed5d93..666cca22 100644
--- a/libdw/dwarf_getsrclines.c
+++ b/libdw/dwarf_getsrclines.c
@@ -1,5 +1,5 @@
/* Return line number information of CU.
- Copyright (C) 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2004, 2005, 2007 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <[email protected]>, 2004.
@@ -256,13 +256,10 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
/* Rearrange the list in array form. */
struct dirlist **dirarray
= (struct dirlist **) alloca (ndirlist * sizeof (*dirarray));
- while (ndirlist-- > 0)
- {
- dirarray[ndirlist] = dirlist;
- dirlist = dirlist->next;
- }
+ for (unsigned int n = ndirlist; n-- > 0; dirlist = dirlist->next)
+ dirarray[n] = dirlist;
- /* Now read the files. */
+ /* Now read the files. */
struct filelist null_file =
{
.info =
@@ -618,8 +615,11 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
/* Put all the files in an array. */
Dwarf_Files *files = libdw_alloc (dbg, Dwarf_Files,
sizeof (Dwarf_Files)
- + nfilelist * sizeof (Dwarf_Fileinfo),
- 1);
+ + nfilelist * sizeof (Dwarf_Fileinfo)
+ + (ndirlist + 1) * sizeof (char *),
+ 1);
+ const char **dirs = (void *) &files->info[nfilelist];
+
files->nfiles = nfilelist;
while (nfilelist-- > 0)
{
@@ -628,6 +628,12 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
}
assert (filelist == NULL);
+ /* Put all the directory strings in an array. */
+ files->ndirs = ndirlist;
+ for (unsigned int i = 0; i < ndirlist; ++i)
+ dirs[i] = dirarray[i]->dir;
+ dirs[ndirlist] = NULL;
+
/* Remember the debugging descriptor. */
files->dbg = dbg;