Re: gdb.objc/objcdecode.exp test error..

Joel Brobecker
2009-09-24T17:31:02Z

> 2009-09-23 Matt Rice <ratmice@gmail.com>
>
> * gdb.objc/ambiguous.exp: New objc tests for 8343 with shared libs.
> * gdb.objc/ambiguous.m: New objc file.
> * gdb.objc/objcdecode2.m: New objc file.
> * gdb.objc/objcdecode3.m: New objc file.

I'm going to treat this testcase independently from the rest as well...
The objc files are missing a copyright header. Can you add one, please?

> set lib_flags [list debug additional_flags=[list -g -fPIC -I${srcdir}/${subdir}] ]

The additional flags that you are adding are a little suspicious.
gdb_compile_shlib is already supposed to handle that, I think.
For use the -g is covered by the "debug" flag. -fPIC seems to be
already taken care of through the addition of the -fpic flag, which
is very similar (apparently, if I understand the GCC doc correctly,
-fPIC just tries to avoid system limitations and -fpic doesn't).
I'm also surprised that the -I[...] option is needed at all.
We have C files in gdb.base that #include .h files, and yet we don't
seem to need to explicitly provide a -I flag. See macscp.exp for one
example of that, where macscp1.c includes macscp3.h. The problem with
providing the -I switch is that it's specific to GCC and may not work
with other compilers.

> set binfile ${objdir}/${subdir}/${testfile}
> set ambig_opts [list debug additional_flags=[list -g \
> -DSHLIB_NAME=\"$decode3_binfile\" \
> -L${objdir}/${subdir} \
> -Wl,-rpath,${objdir}/${subdir} \
> -ldl -lobjcdecode2 \
> -I${srcdir}/${subdir}] ]

Same here. -g should not be necessary. Neither should be the -I.
Neither should be the various -L/-Wl options... Or is there something
special for SOs with ObjC code?

> set name "setup ambiguous expression"
> gdb_test "break foo" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*" $name

When using gdb_test, it's fine to use a variable, but it is not
necessary. The use of a variable with gdb_test_multiple is just
because it avoids duplicating the test name.

> gdb_test "run" \
> "Breakpoint \[0-9\]+, -\\\[DecodeShlib bar\\\] \\\(.*\\\) at .*" \
> "break on bar class implementation"

You should use "gdb_run_cmd" in this case. Otherwise, it would not work
in a cross environement for instance.

> # i'm not sure why this reacts differently than the above tests

Just a nit: I should be capitalized. But thank you very much for adding
a comment explaining why you've added the test. These are really helpful.

> return 0

This is unnecessary.

--
Joel