Closed philippludwig closed 9 months ago
Hi. Thanks for the compliment.
It's likely a bug on my part. I've never used $_streq
before. I suspect it's some gdb feature. I'll read up on it and will fix Seer.
Oh I don’t think it has to do with $_streq
. I tried something like x == 2
and got the same result.
Thanks for the added info. I'll check it out.
Hi Phillipp,
I suspect you are trying to create the breakpoint via Seer's breakpoint dialog.
Below I have a simple Fibonacci program that has a loop. I set a breakpoint if nextTerm
is greater than 100.
Note, I don't say if nextTerm > 100
. I just say nextTerm > 100
. The if
is implied.
This syntax is different than entering the command from the (gdb)
prompt. (Seer talks to gdb using a different gdb channel, thus some differences compared to using the (gdb)
prompt.)
If you want to still use the old syntax, you can enter it in at Seer's gdb command line.
But if you use Seer's dialogs, just drop the if
from your condition statement. Note, this also applies to using the Condition button in the Breakpoints list.
Let me know if that works for you. I'm interested in the $_streq
. I've never seen that.
Btw, I'll likely create a Wiki page for this on the Seer project page.
Arg. I hate it when GitHub automatically closes the problem report. Reopening.
Indeed you are correct. Setting an int breakpoint with something like i == 3
works as intended, I did something wrong in this regard I guess.
However, the problem with $_streq
persists. Note that I only use $_streq
because my gdb has an issue with using the ==
operator on C++ strings, but I guess this functionality would be useful for C programmers, too.
Here is a sample terminal session:
(gdb) b 6 if $_streq(s.c_str(), "3")
Breakpoint 1 at 0x129d: file s.cpp, line 6.
(gdb) r
Starting program: /tmp/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, main () at s.cpp:6
6 s = std::to_string(i);
Source:
1 #include <string>
2
3 int main() {
4 std::string s = "";
5 for (int i=0; i<5; i++) {
6 s = std::to_string(i);
7 }
8 return 0;
9 }
I did something wrong in this regard I guess.
Nothing wrong on your part. I'll improve the documentation.
Thanks for the test program. I'll work with that to fix the $_streq
case.
I'm not having much luck with string comparisons. Gdb has a "mi" interpreter for people to write front-ends. This is the channel I was talking about earlier. I believe it has a bug that is doesn't support features the way the regular way of specifying conditions for a breakpoint.
I've created a task in the gdb/mi project page. I'm likely doing something wrong. Hopefully there is some reply soon.
A minor change. I added the "if" word to the related dialogs to indicate you don't need to include it in condition text.
I'm still planning on the Wiki page...
The gdb team did reply. Some extra quoting of the string is needed. I can implement it automatically in Seer.
For my reference:
-break-condition 3 "$_streq(s.c_str(), \"55\")"
This should be fixed now. You should be able to create a breakpoint with a condition in the syntax you expect.
"main" is updated.
$_streq(my_cpp_string.c_str(), "expected_value")
Here are the dialogs. Note, I made the 'condition' field a little longer.
And
Closing task. Can be reopened or a new task can be created.
Thank you very much!
First of all, I would like to express my gratitude for this amazing project. Finally a good GDB frontend for Linux.
I have just one issue, where I have some trouble setting a conditional breakpoint. With GDB on terminal, I would use something like:
However, when I try this with seer, I get "Problem parsing arguments" in the Messages list. If someone could provide some insight on how to do this, I would highly appreciate it.