public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections
@ 2014-07-09  8:54 amodra at gmail dot com
  2014-07-09  9:01 ` [Bug gdb/17133] " amodra at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: amodra at gmail dot com @ 2014-07-09  8:54 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

            Bug ID: 17133
           Summary: gdb can't load libraries with >2G .debug_info sections
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: amodra at gmail dot com

dwarf2read.c:dwarf2_read_section uses obstack_alloc to allocate a buffer for
section contents.  I've just been looking at a gdb crash when trying to load a
shared library with a .debug_info section of 0x825b9155 bytes.

The trouble is that obstack_alloc takes an "int size" parameter.  "size" is
therefore negative and we go off the rails fairly quickly.  See
include/obstack.h.

So we have a 2G limit, even when gdb is 64-bit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
@ 2014-07-09  9:01 ` amodra at gmail dot com
  2014-07-10  8:44 ` jan.kratochvil at redhat dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: amodra at gmail dot com @ 2014-07-09  9:01 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |powerpc64le-linux

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
  2014-07-09  9:01 ` [Bug gdb/17133] " amodra at gmail dot com
@ 2014-07-10  8:44 ` jan.kratochvil at redhat dot com
  2014-07-10 13:29 ` amodra at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jan.kratochvil at redhat dot com @ 2014-07-10  8:44 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat dot com

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
http://pkgs.fedoraproject.org/cgit/gdb.git/tree/gdb-6.3-bz231832-obstack-2gb.patch
Make obstack 64bit - to handle >2GB objects
https://sourceware.org/ml/libc-alpha/2007-01/msg00090.html
testcase: https://bugzilla.redhat.com/show_bug.cgi?id=231832#c1

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
  2014-07-09  9:01 ` [Bug gdb/17133] " amodra at gmail dot com
  2014-07-10  8:44 ` jan.kratochvil at redhat dot com
@ 2014-07-10 13:29 ` amodra at gmail dot com
  2014-07-10 14:28 ` dje at google dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: amodra at gmail dot com @ 2014-07-10 13:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |amodra at gmail dot com

--- Comment #2 from Alan Modra <amodra at gmail dot com> ---
2007!!  I've had patches like that too..  :-)

I have a rather large patch for this bug in the works, fixing a whole lot of
issues I noticed in obstack.h and elsewhere.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
                   ` (2 preceding siblings ...)
  2014-07-10 13:29 ` amodra at gmail dot com
@ 2014-07-10 14:28 ` dje at google dot com
  2014-07-11 15:52 ` tromey at redhat dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dje at google dot com @ 2014-07-10 14:28 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at google dot com

--- Comment #3 from dje at google dot com ---
While we're making changes to obstacks, can I mention something I'd like to
see: the ability to change the minimum alignment.  On amd64 it's 16 (SSE?) but
it wastes a TON of space in gdb - gdb doesn't need 16, 8 will suffice.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
                   ` (3 preceding siblings ...)
  2014-07-10 14:28 ` dje at google dot com
@ 2014-07-11 15:52 ` tromey at redhat dot com
  2014-07-11 16:01 ` amodra at gmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tromey at redhat dot com @ 2014-07-11 15:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #4 from Tom Tromey <tromey at redhat dot com> ---
(In reply to Alan Modra from comment #0)
> dwarf2read.c:dwarf2_read_section uses obstack_alloc to allocate a buffer for
> section contents.  I've just been looking at a gdb crash when trying to load
> a shared library with a .debug_info section of 0x825b9155 bytes.
> 
> The trouble is that obstack_alloc takes an "int size" parameter.  "size" is
> therefore negative and we go off the rails fairly quickly.  See
> include/obstack.h.
> 
> So we have a 2G limit, even when gdb is 64-bit.

I think the only reason this data is allocated on the obstack is
convenience -- it doesn't require any special work to free it.
However, it isn't inordinately hard to arrange for it to be
allocated some other way and then freed properly.  I think it
just requires a bit of extra code in dwarf2_per_objfile_free.
This seems simpler and no worse than making obstacks 64-bit-clean,
though of course there may be other reasons to do that.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
                   ` (4 preceding siblings ...)
  2014-07-11 15:52 ` tromey at redhat dot com
@ 2014-07-11 16:01 ` amodra at gmail dot com
  2014-07-11 16:42 ` dje at google dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: amodra at gmail dot com @ 2014-07-11 16:01 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

--- Comment #5 from Alan Modra <amodra at gmail dot com> ---
Tom, yes, I know you can fix the problem local to gdb but it seems quite a
horrible restriction to only allow 2G obstacks with today's 64-bit machines.

Doug, you can set the alignment to 8 with current obstack.h.  In place of

obstack_init (&obstack);

use

#define gdb_obstack_init(obstack) \
  obstack_specify_allocation(obstack, 0, 8, \
                             obstack_chunk_alloc, obstack_chunk_free)
gdb_obstack_init (&obstack);

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
                   ` (5 preceding siblings ...)
  2014-07-11 16:01 ` amodra at gmail dot com
@ 2014-07-11 16:42 ` dje at google dot com
  2014-07-11 17:59 ` dje at google dot com
  2014-08-04 11:17 ` fweimer at redhat dot com
  8 siblings, 0 replies; 10+ messages in thread
From: dje at google dot com @ 2014-07-11 16:42 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

--- Comment #6 from dje at google dot com ---
Re: obstack_specify_allocation: Cool, thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
                   ` (6 preceding siblings ...)
  2014-07-11 16:42 ` dje at google dot com
@ 2014-07-11 17:59 ` dje at google dot com
  2014-08-04 11:17 ` fweimer at redhat dot com
  8 siblings, 0 replies; 10+ messages in thread
From: dje at google dot com @ 2014-07-11 17:59 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

--- Comment #7 from dje at google dot com ---
To close the perf issue tangent I raised in this bug: I've filed bug 17143 to
track the issue there.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug gdb/17133] gdb can't load libraries with >2G .debug_info sections
  2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
                   ` (7 preceding siblings ...)
  2014-07-11 17:59 ` dje at google dot com
@ 2014-08-04 11:17 ` fweimer at redhat dot com
  8 siblings, 0 replies; 10+ messages in thread
From: fweimer at redhat dot com @ 2014-08-04 11:17 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17133

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-08-04 11:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-09  8:54 [Bug gdb/17133] New: gdb can't load libraries with >2G .debug_info sections amodra at gmail dot com
2014-07-09  9:01 ` [Bug gdb/17133] " amodra at gmail dot com
2014-07-10  8:44 ` jan.kratochvil at redhat dot com
2014-07-10 13:29 ` amodra at gmail dot com
2014-07-10 14:28 ` dje at google dot com
2014-07-11 15:52 ` tromey at redhat dot com
2014-07-11 16:01 ` amodra at gmail dot com
2014-07-11 16:42 ` dje at google dot com
2014-07-11 17:59 ` dje at google dot com
2014-08-04 11:17 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).