Bug 15501 - 'disable 3.1 3.2 3.3' doesn't work as expected. (likewise "enable")
Summary: 'disable 3.1 3.2 3.3' doesn't work as expected. (likewise "enable")
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Muhammad Waqas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-20 16:44 UTC by Pedro Alves
Modified: 2013-08-23 06:25 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 Pedro Alves 2013-05-20 16:44:38 UTC
While "disable 1 2 3 4" works as expected, if one passes location numbers instead of breakpoint numbers, then only the first location is updated.  Vis:

(gdb) info breakpoints 
No breakpoints or watchpoints.
(gdb) b main
Breakpoint 2 at 0x4004cf: file main.c, line 5.
(gdb) b main
Note: breakpoint 2 also set at pc 0x4004cf.
Breakpoint 3 at 0x4004cf: file main.c, line 5.
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   0x00000000004004cf in main at main.c:5
3       breakpoint     keep y   0x00000000004004cf in main at main.c:5
(gdb) disable 2 3
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
2       breakpoint     keep n   0x00000000004004cf in main at main.c:5
3       breakpoint     keep n   0x00000000004004cf in main at main.c:5
(gdb) enable 2 3
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   0x00000000004004cf in main at main.c:5
3       breakpoint     keep y   0x00000000004004cf in main at main.c:5
(gdb) disable 2.1 3.1
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   <MULTIPLE>         
2.1                         n     0x00000000004004cf in main at main.c:5
3       breakpoint     keep y   0x00000000004004cf in main at main.c:5
(gdb) enable 2.1 3.1
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   0x00000000004004cf in main at main.c:5
3       breakpoint     keep y   0x00000000004004cf in main at main.c:5

In fact, everything after the first location is ignored:

(gdb) disable 2.1 foofoobar
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   <MULTIPLE>         
2.1                         n     0x00000000004004cf in main at main.c:5
3       breakpoint     keep y   0x00000000004004cf in main at main.c:5
(gdb) 

That should warn, just like:

(gdb) disable 2 foofoobar
warning: bad breakpoint number at or near 'foofoobar'
Comment 1 Jan Kratochvil 2013-08-13 14:40:17 UTC
[PATCH] fix PR-15501
From: Muhammad Waqas <mwaqas at codesourcery dot com>
http://sourceware.org/ml/gdb-patches/2013-08/msg00339.html
Message-ID: <520A0453.4070309@codesourcery.com>
Comment 2 Sourceware Commits 2013-08-23 06:22:11 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	mwaqas@sourceware.org	2013-08-23 06:22:10

Modified files:
	gdb            : breakpoint.c ChangeLog 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.base: ena-dis-br.exp 

Log message:
	2013-08-12  Muhammad Waqas  <mwaqas@codesourcery.com>
	
	PR gdb/15501
	* breakpoint.c (enable_command, disable_command): Iterate over
	all specified breakpoint locations.
	2013-07-12  Muhammad Waqas  <mwaqas@codesourccery.com>
	
	PR gdb/15501
	* gdb.base/ena-dis-br.exp: Add test to verify
	enable/disable commands work correctly with
	multiple arguments that include multiple locations.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.c.diff?cvsroot=src&r1=1.775&r2=1.776
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.15921&r2=1.15922
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3781&r2=1.3782
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/ena-dis-br.exp.diff?cvsroot=src&r1=1.22&r2=1.23
Comment 3 Muhammad Waqas 2013-08-23 06:25:50 UTC
fixed.