From patchwork Mon Aug 4 08:52:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 2294 Received: (qmail 15206 invoked by alias); 4 Aug 2014 08:52:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 15187 invoked by uid 89); 4 Aug 2014 08:52:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f54.google.com Received: from mail-pa0-f54.google.com (HELO mail-pa0-f54.google.com) (209.85.220.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 04 Aug 2014 08:52:36 +0000 Received: by mail-pa0-f54.google.com with SMTP id fa1so9568547pad.41 for ; Mon, 04 Aug 2014 01:52:34 -0700 (PDT) X-Received: by 10.70.22.163 with SMTP id e3mr751725pdf.157.1407142354581; Mon, 04 Aug 2014 01:52:34 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-155-134.oycza5.sa.bigpond.net.au. [58.160.155.134]) by mx.google.com with ESMTPSA id po5sm25663102pdb.55.2014.08.04.01.52.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 01:52:34 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 3C914EA3744; Mon, 4 Aug 2014 18:22:29 +0930 (CST) Date: Mon, 4 Aug 2014 18:22:29 +0930 From: Alan Modra To: gdb-patches@sourceware.org Subject: Prepare gdb for 64-bit obstacks Message-ID: <20140804085229.GP23728@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Also for another upstream obstack change, obstack_base() now returning a void*. I didn't go wild with int -> size_t changes, making only obvious changes close to obstack calls. This patch of course also works with the existing libiberty obstacks. OK to apply? * charset.c (convert_between_encodings): Cast result of obstack_base. * cp-valprint.c (cp_print_value_fields): Use size_t locals. * hppa-tdep.c (internalize_unwinds): Change "size" parm to size_t. (read_unwind_info): Use size_t for some locals. * jit.c (finalize_symtab): Likewise. * utils.c (hashtab_obstack_allocate): Likewise. * symmisc.c (print_objfile_statistics): Update format strings. diff --git a/gdb/charset.c b/gdb/charset.c index 6f413a2..05d8fee 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -503,7 +503,7 @@ convert_between_encodings (const char *from, const char *to, old_size = obstack_object_size (output); obstack_blank (output, space_request); - outp = obstack_base (output) + old_size; + outp = (char *) obstack_base (output) + old_size; outleft = space_request; r = iconv (desc, &inp, &inleft, &outp, &outleft); diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 3e1d6ed..93b95b3 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -208,8 +208,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, fprintf_filtered (stream, ""); else { - int statmem_obstack_initial_size = 0; - int stat_array_obstack_initial_size = 0; + size_t statmem_obstack_initial_size = 0; + size_t stat_array_obstack_initial_size = 0; struct type *vptr_basetype = NULL; int vptr_fieldno; @@ -370,7 +370,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, if (dont_print_statmem == 0) { - int obstack_final_size = + size_t obstack_final_size = obstack_object_size (&dont_print_statmem_obstack); if (obstack_final_size > statmem_obstack_initial_size) @@ -387,7 +387,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, if (last_set_recurse != recurse) { - int obstack_final_size = + size_t obstack_final_size = obstack_object_size (&dont_print_stat_array_obstack); if (obstack_final_size > stat_array_obstack_initial_size) diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index e302ebb..a66cbef 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -221,7 +221,7 @@ record_text_segment_lowaddr (bfd *abfd, asection *section, void *data) static void internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table, asection *section, unsigned int entries, - unsigned int size, CORE_ADDR text_offset) + size_t size, CORE_ADDR text_offset) { /* We will read the unwind entries into temporary memory, then fill in the actual unwind table. */ @@ -320,7 +320,7 @@ static void read_unwind_info (struct objfile *objfile) { asection *unwind_sec, *stub_unwind_sec; - unsigned unwind_size, stub_unwind_size, total_size; + size_t unwind_size, stub_unwind_size, total_size; unsigned index, unwind_entries; unsigned stub_entries, total_entries; CORE_ADDR text_offset; diff --git a/gdb/jit.c b/gdb/jit.c index a1983c9..bc31c7a 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -637,7 +637,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) struct symtab *symtab; struct gdb_block *gdb_block_iter, *gdb_block_iter_tmp; struct block *block_iter; - int actual_nblocks, i, blockvector_size; + int actual_nblocks, i; + size_t blockvector_size; CORE_ADDR begin, end; struct blockvector *bv; @@ -650,9 +651,9 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) /* Copy over the linetable entry if one was provided. */ if (stab->linetable) { - int size = ((stab->linetable->nitems - 1) - * sizeof (struct linetable_entry) - + sizeof (struct linetable)); + size_t size = ((stab->linetable->nitems - 1) + * sizeof (struct linetable_entry) + + sizeof (struct linetable)); LINETABLE (symtab) = obstack_alloc (&objfile->objfile_obstack, size); memcpy (LINETABLE (symtab), stab->linetable, size); } diff --git a/gdb/symmisc.c b/gdb/symmisc.c index de2e166..eb606fa 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -143,9 +143,11 @@ print_objfile_statistics (void) if (OBJSTAT (objfile, sz_strtab) > 0) printf_filtered (_(" Space used by a.out string tables: %d\n"), OBJSTAT (objfile, sz_strtab)); - printf_filtered (_(" Total memory used for objfile obstack: %d\n"), + printf_filtered (_(" Total memory used for objfile obstack: %lu\n"), + (unsigned long) obstack_memory_used (&objfile->objfile_obstack)); - printf_filtered (_(" Total memory used for BFD obstack: %d\n"), + printf_filtered (_(" Total memory used for BFD obstack: %lu\n"), + (unsigned long) obstack_memory_used (&objfile->per_bfd->storage_obstack)); printf_filtered (_(" Total memory used for psymbol cache: %d\n"), bcache_memory_used (psymbol_bcache_get_bcache diff --git a/gdb/utils.c b/gdb/utils.c index 8af8827..a4b5937 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3080,7 +3080,7 @@ gdb_sign_extend (LONGEST value, int bit) void * hashtab_obstack_allocate (void *data, size_t size, size_t count) { - unsigned int total = size * count; + size_t total = size * count; void *ptr = obstack_alloc ((struct obstack *) data, total); memset (ptr, 0, total);