Bug 787487 - symtabs_from_filename called for non-filenames, which allocates GBs of memory unnecessarily
Summary: symtabs_from_filename called for non-filenames, which allocates GBs of memory...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tom Tromey
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-05 16:59 UTC by Robin Green
Modified: 2014-08-11 05:47 UTC (History)
5 users (show)

Fixed In Version: gdb-7.4.50.20120120-12.fc17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-07 18:57:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Robin Green 2012-02-05 16:59:09 UTC
Description of problem:
If you set a breakpoint on a C++ symbol, symtabs_from_filename is called and iterates through all the debuginfo files searching for a nonexistent filename, which requires multiple GBs of memory for a KDE application, and brings my 4GB RAM system grinding to a halt.

Version-Release number of selected component (if applicable):
gdb-7.4.50.20120120-10.fc17.x86_64

How reproducible:
Always

Steps to Reproduce:
0. ulimit -v 3000000
1. gdb some-kde-application
2. b 'SomeClass::someFn(someType)'
3. run
  
Actual results:
gdb eventually crashes as it can't allocate enough memory

Expected results:
no crash

Additional info:
It's unnecessary to call symtabs_from_filename in this case, because there is no filename. This has already been recognised and patched for the case where there is no ':', but of course this breakpoint spec does have a ':' in it.

Comment 1 Tom Tromey 2012-02-07 15:44:30 UTC
This was fixed upstream:

2012-01-17  Doug Evans  <dje>

	* linespec.c (decode_line_internal): Don't call symtabs_from_filename
	if we know we don't have a file name to look for.

Comment 2 Robin Green 2012-02-07 20:25:12 UTC
(In reply to comment #1)
> This was fixed upstream:
> 
> 2012-01-17  Doug Evans  <dje>
> 
>  * linespec.c (decode_line_internal): Don't call symtabs_from_filename
>  if we know we don't have a file name to look for.

The RPM already contains this patch (I've stepped through it, and you can also infer that from the date in the RPM version). And that patch is the one I referred to above: it deals with the case where there is no ':', but this linespec does have a ':' in it. If you read the comments just above the patch, it's clear that he's forgotten to address this case.

Comment 3 Tom Tromey 2012-02-07 21:37:39 UTC
Sorry about my poor reading comprehension.
I am working on a fix.

Comment 4 Tom Tromey 2012-02-08 20:11:23 UTC
http://sourceware.org/ml/gdb-patches/2012-02/msg00112.html

It should go in soon.


Note You need to log in before you can comment on or make changes to this bug.