public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/31084] New: -break-condition compare strings
@ 2023-11-24 19:05 epasveer at att dot net
  2023-11-24 20:10 ` [Bug mi/31084] " ssbssa at sourceware dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: epasveer at att dot net @ 2023-11-24 19:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31084

            Bug ID: 31084
           Summary: -break-condition compare strings
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: mi
          Assignee: unassigned at sourceware dot org
          Reporter: epasveer at att dot net
  Target Milestone: ---

What is the proper syntax to add a condition to a breakpoint to break if a
string matches a text.  Same question to -break-insert.


gdb) 
-break-condition 1 name.c_str() == "ernie"
^error,msg="No symbol \"ernie\" in current context."
(gdb) 
-break-condition 1 $_streq(name.c_str(), "ernie")
^error,msg="Problem parsing arguments: break-condition 1 $_streq(name.c_str(),
\"ernie\")"
(gdb) 






$ more gdbmi_condition.cpp 
#include <iostream>
#include <string>

int main (int argc, char* argv[]) {

    std::string name = "";

    name = "ernie";

    // Create the breakpoint with a string condition.
    //
    // -break-insert -c 'name.c_str() == "ernie"' gdbmi_condition.cpp:16       
     // Failed parsing.
    // -break-insert -c '$_streq(name.c_str(), "ernie")' gdbmi_condition.cpp:16
     // Failed parsing.
    // -break-insert -c 'strcmp("xxxxx", name.c_str() == 0'
gdbmi_condition.cpp:16   // Is accepted but breaks eventhough strings are
different.

    std::cout << "Name is: " << name << std::endl;

    return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug mi/31084] -break-condition compare strings
  2023-11-24 19:05 [Bug mi/31084] New: -break-condition compare strings epasveer at att dot net
@ 2023-11-24 20:10 ` ssbssa at sourceware dot org
  2023-11-25 15:36 ` epasveer at att dot net
  2023-11-25 16:22 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2023-11-24 20:10 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31084

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
I think it should work if you quote the whole condition, like this:

-break-condition 1 "$_streq(name.c_str(), \"ernie\")"

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug mi/31084] -break-condition compare strings
  2023-11-24 19:05 [Bug mi/31084] New: -break-condition compare strings epasveer at att dot net
  2023-11-24 20:10 ` [Bug mi/31084] " ssbssa at sourceware dot org
@ 2023-11-25 15:36 ` epasveer at att dot net
  2023-11-25 16:22 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: epasveer at att dot net @ 2023-11-25 15:36 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31084

--- Comment #2 from Ernie Pasveer <epasveer at att dot net> ---
Sweet!  Yes, indeed.  It does work after all the escape'isms.

I can implement this in my Seergdb debugger.

Thanks for your quick help.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug mi/31084] -break-condition compare strings
  2023-11-24 19:05 [Bug mi/31084] New: -break-condition compare strings epasveer at att dot net
  2023-11-24 20:10 ` [Bug mi/31084] " ssbssa at sourceware dot org
  2023-11-25 15:36 ` epasveer at att dot net
@ 2023-11-25 16:22 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2023-11-25 16:22 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31084

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Answered so closing.  Thank you Hannes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-25 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-24 19:05 [Bug mi/31084] New: -break-condition compare strings epasveer at att dot net
2023-11-24 20:10 ` [Bug mi/31084] " ssbssa at sourceware dot org
2023-11-25 15:36 ` epasveer at att dot net
2023-11-25 16:22 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).