Bug 17960 - Internal error: tracker != NULL when completing on file:function
Summary: Internal error: tracker != NULL when completing on file:function
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 18045 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-02-11 19:33 UTC by Keith Seitz
Modified: 2015-08-10 20:39 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Seitz 2015-02-11 19:33:09 UTC
With this new completion limiting feature that was introduced by ef0b411a, an internal error was introduced:

(gdb) break gdb.c:ma<TAB>
./../src/gdb/completer.c:837: internal-error: maybe_add_completion: Assertion `tracker != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

This happens because location_completer (completer.c) calls make_file_symbol_completion_list without ever calling default_make_symbol_completion_list_break_on_1. It is only this last function which initializes this (file-)global variable.

Why the use of a global? Shouldn't this have been something passed around the completion API?

It seems the test suite does not have a test for FILE:FUNCTION anywhere. I only noticed this because my breakpoint location API patchset uses make_file_symbol_completion_list and *tests it*.
Comment 1 dje 2015-02-12 21:27:33 UTC
I don't mind the tracker being global state given that we were already using global state to record results.

A good next step would be to remove the global state though.

Working on a fix ...
Comment 2 Keith Seitz 2015-02-13 17:05:25 UTC
On 02/13/2015 07:58 AM, gbenson at redhat dot com wrote:
> https://sourceware.org/bugzilla/show_bug.cgi?id=17960
>
> Gary Benson <gbenson at redhat dot com> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |gbenson at redhat dot com
>

PS. I am working on a patch for this. Just have some cleanups and 
testing to finish up.

Keith
Comment 3 Keith Seitz 2015-02-27 16:48:32 UTC
*** Bug 18045 has been marked as a duplicate of this bug. ***
Comment 4 dje 2015-02-27 17:49:41 UTC
Temp fix until Keith's more complete patch is ready posted here:
https://sourceware.org/ml/gdb-patches/2015-02/msg00830.html
Comment 5 cvs-commit@gcc.gnu.org 2015-08-10 19:24:48 UTC
The master branch has been updated by Doug Evans <devans@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e27852be65403306da198b3c1d7b222acd6bdfe9

commit e27852be65403306da198b3c1d7b222acd6bdfe9
Author: Doug Evans <dje@google.com>
Date:   Mon Aug 10 12:23:09 2015 -0700

    PR gdb/17960 Internal error: tracker != NULL when completing on file:function
    
    gdb/ChangeLog:
    
    	* symtab.c (make_file_symbol_completion_list_1): Renamed from
    	make_file_symbol_completion_list and made static.
    	(make_file_symbol_completion_list): New function.
    
    gdb/testsuite/ChangeLog:
    
    	* gdb.base/completion.exp: Add location completer tests.
Comment 6 cvs-commit@gcc.gnu.org 2015-08-10 20:39:27 UTC
The gdb-7.10-branch branch has been updated by Doug Evans <devans@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3649abf39ee70a6237a06df85cf027dcc0d03c56

commit 3649abf39ee70a6237a06df85cf027dcc0d03c56
Author: Doug Evans <dje@google.com>
Date:   Mon Aug 10 13:37:46 2015 -0700

    PR gdb/17960 Internal error: tracker != NULL when completing on file:function
    
    gdb/ChangeLog:
    
    	* symtab.c (make_file_symbol_completion_list_1): Renamed from
    	make_file_symbol_completion_list and made static.
    	(make_file_symbol_completion_list): New function.
    
    gdb/testsuite/ChangeLog:
    
    	* gdb.base/completion.exp: Add location completer tests.