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 1/2] Test case for entry values.


>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> This is a test case for "entry-values" in an arch-independent way.  The
Yao> first part of entry-values.exp is to calculate the length of functions
Yao> and the offset of instruction call in function bar.  Then, this test
Yao> uses Dwarf Assembler to emit some DIEs for "entry-values".

Thanks Yao.  This is cool.

Yao> +# Start GDB and load object file, compute the function length and
Yao> +# the offset of branch instruction in function.  They are needed
Yao> +# in the Dwarf Assembler below.

Nice technique!  I'll have to use that.

Yao> +# Calculate the offset of the last instruction from the beginning.
Yao> +set test "disassemble foo"
Yao> +gdb_test_multiple $test $test {
Yao> +    -re ".*$hex <\\+($decimal)>:\[^\r\n\]+\r\nEnd of assembler dump\.\r\n$gdb_prompt $" {
Yao> +	set foo_length $expect_out(1,string)
Yao> +	pass $test
Yao> +    }
Yao> +    -re ".*$gdb_prompt $" {
Yao> +	fail $test
Yao> +    }
Yao> +}

If this test fails then later on foo_length won't be set.
This will yield a Tcl error in the test suite.
It's probably better to just bail out here.

I think this applies elsewhere too.

Yao> +    cu {addr_size 4} {

Will it still work on x86-64?

Tom


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