diff options
author | Alan Modra <amodra@bigpond.net.au> | 2001-09-18 09:57:26 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2001-09-18 09:57:26 +0000 |
commit | 439c22790eb92fc38c0c4e91bc343ef8d0e55427 (patch) | |
tree | eb49f3489bb7e104ca1c425d07d5d954ab03148f /bfd/dwarf1.c | |
parent | 8ff532ca9bf72656df68051c20729d9fdec919b9 (diff) | |
download | gdb-439c22790eb92fc38c0c4e91bc343ef8d0e55427.tar.gz |
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
Diffstat (limited to 'bfd/dwarf1.c')
-rw-r--r-- | bfd/dwarf1.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c index 0ed206dced5..65319861a1c 100644 --- a/bfd/dwarf1.c +++ b/bfd/dwarf1.c @@ -145,9 +145,9 @@ static struct dwarf1_unit* alloc_dwarf1_unit (stash) struct dwarf1_debug* stash; { - struct dwarf1_unit* x = - (struct dwarf1_unit*) bfd_zalloc (stash->abfd, - sizeof (struct dwarf1_unit)); + bfd_size_type amt = sizeof (struct dwarf1_unit); + + struct dwarf1_unit* x = (struct dwarf1_unit*) bfd_zalloc (stash->abfd, amt); x->prev = stash->lastUnit; stash->lastUnit = x; @@ -162,9 +162,9 @@ alloc_dwarf1_func (stash, aUnit) struct dwarf1_debug* stash; struct dwarf1_unit* aUnit; { - struct dwarf1_func* x = - (struct dwarf1_func*) bfd_zalloc (stash->abfd, - sizeof (struct dwarf1_func)); + bfd_size_type amt = sizeof (struct dwarf1_func); + + struct dwarf1_func* x = (struct dwarf1_func*) bfd_zalloc (stash->abfd, amt); x->prev = aUnit->func_list; aUnit->func_list = x; @@ -277,7 +277,7 @@ parse_line_table (stash, aUnit) if (stash->line_section == 0) { asection *msec; - unsigned long size; + bfd_size_type size; msec = bfd_get_section_by_name (stash->abfd, ".line"); if (! msec) @@ -289,7 +289,8 @@ parse_line_table (stash, aUnit) if (! stash->line_section) return false; - if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section, 0, size)) + if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section, + (bfd_vma) 0, size)) { stash->line_section = 0; return false; @@ -302,9 +303,9 @@ parse_line_table (stash, aUnit) if (xptr < stash->line_section_end) { unsigned long eachLine; - - char* tblend; + char *tblend; unsigned long base; + bfd_size_type amt; /* First comes the length. */ tblend = bfd_get_32 (stash->abfd, (bfd_byte *) xptr) + xptr; @@ -319,9 +320,9 @@ parse_line_table (stash, aUnit) aUnit->line_count = (tblend - xptr) / 10; /* Allocate an array for the entries. */ - aUnit->linenumber_table = (struct linenumber *) - bfd_alloc (stash->abfd, - sizeof (struct linenumber) * aUnit->line_count); + amt = sizeof (struct linenumber) * aUnit->line_count; + aUnit->linenumber_table = ((struct linenumber *) + bfd_alloc (stash->abfd, amt)); for (eachLine = 0; eachLine < aUnit->line_count; eachLine++) { @@ -482,10 +483,10 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, if (! stash) { asection *msec; - unsigned long size; + bfd_size_type size = sizeof (struct dwarf1_debug); - stash = elf_tdata (abfd)->dwarf1_find_line_info = - (struct dwarf1_debug*) bfd_zalloc (abfd, sizeof (struct dwarf1_debug)); + stash = elf_tdata (abfd)->dwarf1_find_line_info + = (struct dwarf1_debug *) bfd_zalloc (abfd, size); if (! stash) return false; @@ -505,7 +506,8 @@ _bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, if (! stash->debug_section) return false; - if (! bfd_get_section_contents (abfd, msec, stash->debug_section, 0, size)) + if (! bfd_get_section_contents (abfd, msec, stash->debug_section, + (bfd_vma) 0, size)) { stash->debug_section = 0; return false; |