This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch-testcase] Re: RFC: Verify AT_ENTRY before using it
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 8 Mar 2010 17:13:50 -0500
- Subject: Re: [patch-testcase] Re: RFC: Verify AT_ENTRY before using it
- References: <20100224224913.GA25437@caradoc.them.org> <20100225221620.GA7830@host0.dyn.jankratochvil.net> <20100226211216.GC2630@caradoc.them.org> <20100301200428.GA14079@host0.dyn.jankratochvil.net> <20100301212216.GA30906@host0.dyn.jankratochvil.net>
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