From: Yao Qi <yao@codesourcery.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: <gdb-patches@sourceware.org>, Miroslav Franc <mfranc@redhat.com>
Subject: Re: [patch] save breakpoints does not save signal catchpoints correctly
Date: Fri, 10 Oct 2014 01:03:00 -0000 [thread overview]
Message-ID: <87y4soivu2.fsf@codesourcery.com> (raw)
In-Reply-To: <20141009175452.GA26010@host2.jankratochvil.net> (Jan Kratochvil's message of "Thu, 9 Oct 2014 19:54:52 +0200")
Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> 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.
I didn't mean to compare two lists. We only have one list here, and we
can check each element in it, for example,
set fd [open $filename]
- set contents [read -nonewline $fd]
+ set file_data [read $fd]
+ set data [split $file_data "\n"]
+ set contents [lindex $data 0]
+
close $fd
contents is the first line of the file, and the pattern matching code
can be unchanged. After that, we can check the second line of the file,
which should be "break main". The test becomes,
set fd [open $filename]
set file_data [read $fd]
set data [split $file_data "\n"]
close $fd
if {$arg == ""} {
set pattern "catch signal"
} else {
set pattern "catch signal $arg"
}
# Check the first line.
gdb_assert {[string match $pattern [lindex $data 0]]} \
"1st line of save breakpoints for '$arg'"
# Check the second line.
gdb_assert {[string match "break main" [lindex $data 1]]} \
"2nd line of save breakpoints for '$arg'"
This will be more clear and easier to extend when there are more lines in
the file.
--
Yao (齐尧)
next prev parent reply other threads:[~2014-10-10 1:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-03 20:32 Jan Kratochvil
2014-10-09 13:41 ` Yao Qi
2014-10-09 17:55 ` Jan Kratochvil
2014-10-10 1:03 ` Yao Qi [this message]
2014-10-12 19:43 ` [patchv2] " Jan Kratochvil
2014-10-13 9:20 ` Yao Qi
2014-10-13 11:41 ` [commit] " Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y4soivu2.fsf@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=mfranc@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox