This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix variable objects for references to pointers
- From: Nick Roberts <nickrob at snap dot net dot nz>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: Vladimir Prus <ghost at cs dot msu dot su>, gdb-patches at sources dot redhat dot com
- Date: Thu, 4 Jan 2007 22:41:56 +1300
- Subject: Re: [PATCH] Fix variable objects for references to pointers
- References: <17792.55489.274138.854508@kahikatea.snap.net.nz> <E1Gujg6-0003rU-38@zigzag.lvk.cs.msu.su> <17793.7666.771432.41360@kahikatea.snap.net.nz> <20070103225532.GQ17935@nevyn.them.org>
> > + set end_of_proc [gdb_get_line_number "return 99;"]
> > + send_gdb "-exec-next 4\n"
> > + gdb_expect {
> > + -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"reference_to_pointer\",args=\\\[\\\],file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$end_of_proc\"\}\r\n$mi_gdb_prompt$" {
> > + pass "4xnext to return 99"
> > + }
> > + timeout { fail "4xnext in reference_to_pointer (timeout)" }
> > + }
>
> Using send_gdb / gdb_expect this way is a problem. If anything goes
> wrong, then the test will sit until it times out. There's only
> one pattern, so you could use mi_gdb_test. "-exec-next 4"
> isn't great either; compiler changes or test changes can easily
> make you end up somewhere unexpected.
>
> This line isn't testing anything you're interested in, right?
> Then you can just put a breakpoint in the right place and run
> to that breakpoint. I'd recommend mi_continue_to. I don't
> see a convenient helper in mi-support.exp to set the breakpoint, but
> there's an example in mi-var-cmd.exp.
Something like below?
set end_of_proc [gdb_get_line_number "return 99;"]
send_gdb "-break-insert $end_of_proc\n"
mi_continue_to ".*" reference_to_pointer "" ".*${srcfile}" $end_of_proc \
"continue to return 99"
Other tests seem to use mi_gdb_test for -break-insert but I'm not interested in
the result and mi_continue presumably sifts through the output until it reaches
something it recognises. I'm also not that interested in the breakpoint
number so I've used a wildcard for future-proofing.
--
Nick http://www.inet.net.nz/~nickrob