Bug 15678 - Typing "enable count" crashes gdb
Summary: Typing "enable count" crashes gdb
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Simon Marchi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-25 22:09 UTC by Simon Marchi
Modified: 2015-02-06 15:33 UTC (History)
2 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 Simon Marchi 2013-06-25 22:09:44 UTC
Step 1: Launch gdb
Step 2: Type "enable count"

Observed behaviour: gdb crashes
Expected behaviour: gdb tells me subtly that I should go back to school and learn to read better.
Comment 1 Jan Kratochvil 2013-08-06 14:16:30 UTC
[PATCH] "enable count" user input error handling (PR gdb/15678)
http://sourceware.org/ml/gdb-patches/2013-06/msg00788.html
Comment 2 Pedro Alves 2013-08-06 18:43:28 UTC
Patch here:

  http://sourceware.org/ml/gdb-patches/2013-06/msg00788.html

Waiting for copyright assignment to come through.
Comment 3 Sourceware Commits 2015-02-06 15:28:19 UTC
The master branch has been updated by Simon Marchi <simark@sourceware.org>:

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

commit b9d6130764916fac3d9bcfde2d672053a0ef3316
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Mon Feb 2 14:57:31 2015 -0500

    "enable count" user input error handling (PR gdb/15678)
    
    Typing "enable count" by itself crashes GDB. Also, if you omit the
    breakpoint number/range, the error message is not very clear:
    
    (gdb) enable count 2
    warning: bad breakpoint number at or near ''
    (gdb) enable count
    Segmentation fault (core dumped)
    
    With this patch, the error messages are slightly more helpful:
    
    (gdb) enable count 2
    Argument required (one or more breakpoint numbers).
    (gdb) enable count
    Argument required (hit count).
    
    gdb/ChangeLog:
    
    	PR gdb/15678
    	* breakpoint.c (map_breakpoint_numbers): Check for empty args
    	string.
    	(enable_count_command): Check args for NULL value.
    
    gdb/testsuite/ChangeLog:
    
    	PR gdb/15678
    	* gdb.base/ena-dis-br.exp: Test "enable count" for bad user input.
Comment 4 Simon Marchi 2015-02-06 15:33:28 UTC
Fixed by patch above.