This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 2/2] Fix handling of null stap semaphores
- From: Simon Marchi <simark at simark dot ca>
- To: George Barrett <bob at bob131 dot so>, gdb-patches at sourceware dot org
- Date: Thu, 9 Jan 2020 23:45:24 -0500
- Subject: Re: [PATCH v2 2/2] Fix handling of null stap semaphores
- References: <26056otsm6hu3octnbb1znmaooyq1x0&si&f67z1--1xu5_ssse/@mail.bob131.so> <8jh6lq70pfevy2fnv252japnkr1a_e946wms0723runb/plb._aa@mail.bob131.so>
Thanks, I put a couple of comments. The patch LGTM with those addressed.
On 2020-01-02 6:12 p.m., George Barrett wrote:
> @@ -47,6 +53,18 @@ proc stap_test {exec_name {arg ""}} {
> fail "run to -pstap test:user"
> }
>
> + if {[string first "-DUSE_SEMAPHORES" $args] == -1} {
> + set relocation_base \
> + [expr [get_hexadecimal_valueof "&relocation_marker" "0"] - $semaphore_addr_var]
> + if {$relocation_base == 0} {
> + xfail "skipping null semaphore test: no relocation performed"
Hmm, I probably wouldn't use "xfail" here, since it's not like something is
failing, it's just that this test doesn't apply to this configuration. What
about just not mentioning at all when it does not apply?
if {$relocation_base != 0} {
gdb_test ...
}
> + } else {
> + gdb_test "p (*(char*) $relocation_base)@4" \
> + " = \"\\\\177ELF\"" \
> + "null semaphore relocation"
This test is a bit out of the ordinary, and I can imagine readers being
confused as to why we are testing this. Could you please add a comment
(just a short sentence) above this to hint to why we are doing this test?
Something like (feel free to improve the formulation):
# Check that GDB doesn't wrongfully try setting null semaphore, and doing so
# overwriting the ELF magic number.
Simon