From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 688 invoked by alias); 6 Oct 2006 14:18:19 -0000 Received: (qmail 679 invoked by uid 22791); 6 Oct 2006 14:18:18 -0000 X-Spam-Check-By: sourceware.org Received: from Unknown (HELO siegfried.gbfo.org) (82.67.71.117) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 06 Oct 2006 14:18:11 +0000 Received: from erda.mds (localhost [127.0.0.1]) by siegfried.gbfo.org (8.13.6/8.13.6) with ESMTP id k96EGJSZ027177 for ; Fri, 6 Oct 2006 16:16:19 +0200 Received: from localhost (saffroy@localhost) by erda.mds (8.13.6/8.13.6/Submit) with ESMTP id k96EGH4W027174 for ; Fri, 6 Oct 2006 16:16:19 +0200 Date: Fri, 06 Oct 2006 14:18:00 -0000 From: Jean-Marc Saffroy To: gdb-patches@sourceware.org Subject: [patch] realloc bug in add_symbol_file_command Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00056.txt.bz2 Hello, In gdb 6.5 I had systematic crashes with add-symbol-file: my kernel modules have many sections... :) The patch below lets me load many modules now. Cheers, -- saffroy@gmail.com Index: gdb-6.5/gdb/symfile.c =================================================================== --- gdb-6.5.orig/gdb/symfile.c 2006-10-06 15:56:41.000000000 +0200 +++ gdb-6.5/gdb/symfile.c 2006-10-06 15:57:52.000000000 +0200 @@ -1852,7 +1852,7 @@ to load the program. */ sect_opts[section_index].name = ".text"; sect_opts[section_index].value = arg; - if (++section_index > num_sect_opts) + if (++section_index == num_sect_opts) { num_sect_opts *= 2; sect_opts = ((struct sect_opt *) @@ -1888,7 +1888,7 @@ { sect_opts[section_index].value = arg; expecting_sec_addr = 0; - if (++section_index > num_sect_opts) + if (++section_index == num_sect_opts) { num_sect_opts *= 2; sect_opts = ((struct sect_opt *)