This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] save breakpoints does not save signal catchpoints correctly
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org, Miroslav Franc <mfranc at redhat dot com>
- Date: Thu, 9 Oct 2014 19:54:52 +0200
- Subject: Re: [patch] save breakpoints does not save signal catchpoints correctly
- Authentication-results: sourceware.org; auth=none
- References: <20141003203219 dot GA30562 at host2 dot jankratochvil dot net> <87r3yhs6sr dot fsf at codesourcery dot com>
On Thu, 09 Oct 2014 15:37:24 +0200, Yao Qi wrote:
> Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> The fix looks right to me. Just one comment on the test case...
>
> > - set contents [read -nonewline $fd]
> > + set contents [read $fd]
> > close $fd
> >
>
> IWBN to split the contents into a list and match each element in the
> list one by one, so that ...
>
> > + set nl "\r?\n"
> > if {$arg == ""} {
> > - set pattern "catch signal"
> > + set pattern "catch signal$nl"
> > } else {
> > - set pattern "catch signal $arg"
> > + set pattern "catch signal $arg$nl"
> > }
> > - if {[string match $pattern $contents]} {
> > + set pattern "${pattern}break main$nl"
> > + if {[regexp "$pattern" $contents]} {
>
> ... the pattern can be simplified and we can still use "string match".
>
> On the other hand, in this way, the test can be easily extended in the
> future, for example, saving more breakpoints in the file.
Sorry but be more specific how you wanted to simplify the code.
Any idea I have is 10x more complicated.
With the list I have Googled
What is the right way of comparing two lists in TCL?
https://stackoverflow.com/questions/5195153/what-is-the-right-way-of-comparing-two-lists-in-tcl
and those solutions seem too complicated to me.
gdb_expect_list or gdb_test_sequence are not usable here as this is not an
output from inferior but just contents of a file.
Thanks,
Jan