This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix MI dprintf-insert not printing when a location is pending.


On 03/27/2015 05:34 AM, Antoine Tremblay wrote:
On 03/26/2015 03:10 PM, Keith Seitz wrote:
On 03/26/2015 09:47 AM, Antoine Tremblay wrote:
+# Set pending dprintf via MI.
+mi_gdb_test "-dprintf-insert -f pendfunc1 \"hello\"" \
+
".*\\^done,bkpt={number=\"1\",type=\"dprintf\",disp=\"keep\",enabled=\"y\",addr=\"<PENDING>\",pending=\"pendfunc1\",times=\"0\",original-location=\"pendfunc1\"}"

\
+    "mi set dprintf"
+
+mi_gdb_test "-break-insert $bp_location1" ".*" "mi insert breakpoint
bp_location1"

Is it possible to use mi_make_breakpoint for these tests?

Unfortunately for the dprintf one mi_make_breakpoint doesn't support
pending breakpoints, it creates something like :
bkpt={number="2",type=".*",disp=".*",enabled=".*",addr=".*",func=".*",
        file=".*/myfile.c",fullname=".*",line="3",thread-groups=\[.*\],
        times="0".*original-location=".*"}

But with pending funcs it should be pending= ...

Ah, I see. Thank you for pointing that out. I *thought* that I did that already!

It could be the subject of another patch to add that support.


Indeed.

I used mi_create_breakpoint for the other breakpoint now


Excellent.

+mi_run_cmd
+
+set msg "mi dprintf"
+gdb_expect {
+    -re ".*~\"hello\"" {
+    pass $msg
+    }
+    -re ".*$mi_gdb_prompt$" {
+    fail $msg
+    }
+    timeout {
+    fail $msg
+    }
+}

This a pretty common test suite idiom, I think. Can mi_gdb_test be used
instead of gdb_expect?

That I can't since mi_gdb_test requires a command and in this case I'm
just doing expect on that comes after mi_run_cmd, there's no command
associated with it..

While not common in gdb.mi (with mi_gdb_test), the rest of gdb.* uses the idiom:

  gdb_test "" ...

all the time.

Looking at the description of mi_gdb_test:

# mi_gdb_test COMMAND PATTERN MESSAGE [IPATTERN] -- send a command to gdb;
#   test the result.
#
# COMMAND is the command to execute, send to GDB with send_gdb.  If
#   this is the null string no command is sent.

[Very quickly] Browsing through the code of that function, it seems like it should work. If it does not, would you please file a bug? It *definitely* should work.

Keith


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]