breakpoints/2120: "info break" output not good when cond is a function call with string arg

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

breakpoints/2120: "info break" output not good when cond is a function call with string arg

Rohit Gulati

>Number:         2120
>Category:       breakpoints
>Synopsis:       "info break" output not good when cond is a function call with string arg
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 26 23:48:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     [hidden email]
>Release:        GDB 6.3
>Organization:
>Environment:
Red Hat Enterprise Linux WS release 3 (Taroon Update 5)
GCC 3.2.3
>Description:
If you create a conditional breakpoint on a function call, which takes one string argument, like:

(gdb) break test.cpp:1 if (foo("Rohit"))
(gdb) info break

Then "info break" prints the output in which the argument to the function, foo above, get printed as a comma separated ASCII values instead of the string itself:

What gets printed is :
        ....
        stop only if foo ( {82 'R', 111 'o', 104 'h', 105 'i', 116 't', 0 '\0'})

I was expecting:
stop only if foo("Rohit")

thanks
Rohit
>How-To-Repeat:
To reproduce:

1. Create the following testcase in test.cpp:

bool foo(char* xxx) {return true;}
int main() {foo("Rohit");return 0;}

2. Compile "g++ -g test.cpp"

3. Start "gdb a.out"

4. Type these gdb commands:
(gdb)break test.cpp:1 if (foo("Rohit"))
(gdb)info break
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
Reply | Threaded
Open this post in threaded view
|

RE: breakpoints/2120: "info break" output not good when cond is a function call with string arg

Rohit Gulati
The following reply was made to PR breakpoints/2120; it has been noted by GNATS.

From: "Rohit Gulati" <[hidden email]>
To: <[hidden email]>, <[hidden email]>
Cc:  
Subject: RE: breakpoints/2120: "info break" output not good when cond is a function call with string arg
Date: Fri, 28 Apr 2006 13:53:59 -0700

 Hi,
 
 I debugged the problem reported in GDB bug breakpoints/2120 and have a
 fix. I changed the file src/expprint.c, function print_subexp_standard,
 switch case OP_ARRAY:
 
 Please review the change and let me know if it is ok:
 
 file 1 .../gdb/src/gdb-6.3/gdb/expprint.c
 ********************************
 -----[242-243 changed to 242-245]-----
 <         && exp->elts[pc + 5].type =3D=3D builtin_type_char
 <         && exp->language_defn->la_language =3D=3D language_c
 ---
 >         /*&& exp->elts[pc + 5].type =3D=3D builtin_type_char*/
 >         && exp->elts[pc + 5].type =3D=3D builtin_type
 (current_gdbarch)->builtin_char
 >         && (exp->language_defn->la_language =3D=3D language_c ||=20
 >             exp->language_defn->la_language =3D=3D language_cplus) )
 -----[257 changed to 259-260]-----
 <                 || exp->elts[pc + 1].type !=3D builtin_type_char)
 ---
 >                 /*|| exp->elts[pc + 1].type !=3D builtin_type_char*/
 >                 || exp->elts[pc + 1].type !=3D builtin_type
 (current_gdbarch)->builtin_char)
 
 
 >-----Original Message-----
 >From: [hidden email]=20
 >[mailto:[hidden email]]=20
 >Sent: Wednesday, April 26, 2006 4:48 PM
 >To: Rohit Gulati
 >Subject: Re: breakpoints/2120: "info break" output not good=20
 >when cond is a function call with string arg
 >
 >Thank you very much for your problem report.
 >It has the internal identification `breakpoints/2120'.
 >The individual assigned to look at your
 >report is: unassigned.=20
 >
 >>Category:       breakpoints
 >>Responsible:    unassigned
 >>Synopsis:       "info break" output not good when cond is a=20
 >function call with string arg
 >>Arrival-Date:   Wed Apr 26 23:48:01 GMT 2006
 >