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-testcase] Re: RFC: Verify AT_ENTRY before using it


On Mon, Mar 01, 2010 at 10:22:16PM +0100, Jan Kratochvil wrote:
> +  if (info_verbose)
> +    {
> +      /* It can be printed repeatedly as there is no easy way to check
> +	 the executable symbols/file has been already relocated to
> +	 displacement.  */
> +
> +      warning (_("Using PIE (Position Independent Executable) "
> +		 "displacement %s for \"%s\""),
> +	       paddress (target_gdbarch, displacement),
> +	       bfd_get_filename (exec_bfd));
> +    }
> +
>    return displacement;
>  }

This isn't a warning; just use printf_unfiltered.

> +	    -re "Using PIE \\(Position Independent Executable\\) displacement 0x0 " {
> +		# Missing "$gdb_prompt $" is intentional.
> +		if {$displacement == "ZERO"} {
> +		    pass $test_displacement
> +		    # Permit multiple such messages.
> +		    set displacement "FOUND-$displacement"
> +		} elseif {$displacement != "FOUND-ZERO"} {
> +		    fail $test_displacement
> +		}
> +		exp_continue
> +	    }
> +	    -re "Using PIE \\(Position Independent Executable\\) displacement" {
> +		# Missing "$gdb_prompt $" is intentional.
> +		if {$displacement == "NONZERO"} {
> +		    pass $test_displacement
> +		    # Permit multiple such messages.
> +		    set displacement "FOUND-$displacement"
> +		} elseif {$displacement != "FOUND-NONZERO"} {
> +		    fail $test_displacement
> +		}
> +		exp_continue
> +	    }

This isn't a safe way to use expect, unfortunately.  If you have two
patterns, and the second one matches a subset of the first, either
might match; it depends where the OS and C library break up GDB's call
to 'write'.  You have two choices: combine the patterns, and check the
displacement inside, or make the second pattern not match the first.
For instance, " 0x[0-9a-f]*[1-9a-f]*[0-9a-f]* " won't match 0x0.

Otherwise OK.

-- 
Daniel Jacobowitz
CodeSourcery


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