Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] Relax "printf" function name check in annota* test cases
@ 2008-05-15  0:37 Ulrich Weigand
  2008-05-15  0:45 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2008-05-15  0:37 UTC (permalink / raw)
  To: gdb-patches

Hello,

this patch fixes the last regression after Alan's patch was applied:
some sub-tests of annota1.exp and annota3.exp are now failing because
when stopped at the "printf" breakpoint, the current function is not
called printf, but printf@plt.

I've seen similar issues with printf@GLIBC_... on other platforms as
well; as it is hard to predict how the symbol will be called exactly,
I'd suggest to simply accept printf@... as well.  This is really 
unrelated to what the annota tests are intended to test anyway.

Any objections to me checking in the following patch?

Tested on powerpc-linux and powerpc64-linux, fixes 4 FAILs.

Bye,
Ulrich


ChangeLog:

	* gdb.base/annota1.exp: Accept printf@... in place of printf.
	* gdb.base/annota3.exp: Likewise.

diff -urNp gdb-orig/gdb/testsuite/gdb.base/annota1.exp gdb-head/gdb/testsuite/gdb.base/annota1.exp
--- gdb-orig/gdb/testsuite/gdb.base/annota1.exp	2008-05-14 20:49:29.315943000 +0200
+++ gdb-head/gdb/testsuite/gdb.base/annota1.exp	2008-05-14 20:50:12.816352130 +0200
@@ -241,7 +241,7 @@ gdb_expect {
 #
 set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n"
 set pat_adjust "warning: Breakpoint 3 address previously adjusted from $hex to $hex.\r\n"
-set pat_end "\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*.*\032\032frame-function-name\r\n.*printf\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$"
+set pat_end "\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*.*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$"
 
 gdb_test_multiple "continue" "continue to printf" {
     -re "${pat_begin}($pat_adjust)?$pat_end" {
@@ -256,7 +256,7 @@ gdb_test_multiple "continue" "continue t
 # annotate-frame-address
 # annotate-frame-address-end
 #
-set pat_begin "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0  \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\n.*printf\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1  \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n"
+set pat_begin "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0  \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1  \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n"
 set pat_end "\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$"
 send_gdb "backtrace\n"
 gdb_expect {
diff -urNp gdb-orig/gdb/testsuite/gdb.base/annota3.exp gdb-head/gdb/testsuite/gdb.base/annota3.exp
--- gdb-orig/gdb/testsuite/gdb.base/annota3.exp	2008-05-14 20:49:29.320943000 +0200
+++ gdb-head/gdb/testsuite/gdb.base/annota3.exp	2008-05-14 21:01:18.207924022 +0200
@@ -227,7 +227,7 @@ gdb_expect_list "continue to printf" "$g
 send_gdb "backtrace\n"
 gdb_expect_list "backtrace from shlibrary" "$gdb_prompt$" {
     "\r\n\032\032post-prompt\r\n"
-    "#0 .* .*printf \[^\r\n\]*\r\n"
+    "#0 .* .*printf(@\[^ ]*)? \[^\r\n\]*\r\n"
     "#1 .* main \[^\r\n\]*\r\n"
 }
 
@@ -267,7 +267,7 @@ if [target_info exists gdb,nosignals] {
     gdb_expect_list "backtrace @ signal handler" "$gdb_prompt$" {
 	"#0 +handle_USR1 \[^\r\n\]+\r\n"
 	"#1 +.signal handler called.\r\n"
-	"#2 .* .*printf \[^\r\n\]+\r\n"
+	"#2 .* .*printf(@\[^ \]*)? \[^\r\n\]+\r\n"
 	"#3 .* main \[^\r\n\]+\r\n"
     }
 }
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfc] Relax "printf" function name check in annota* test cases
  2008-05-15  0:37 [rfc] Relax "printf" function name check in annota* test cases Ulrich Weigand
@ 2008-05-15  0:45 ` Daniel Jacobowitz
  2008-05-15  0:54   ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2008-05-15  0:45 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

On Wed, May 14, 2008 at 11:36:22PM +0200, Ulrich Weigand wrote:
> Hello,
> 
> this patch fixes the last regression after Alan's patch was applied:
> some sub-tests of annota1.exp and annota3.exp are now failing because
> when stopped at the "printf" breakpoint, the current function is not
> called printf, but printf@plt.

This is unrelated to the annota tests, as you said... but the
breakpoint is at "printf", isn't it?  Why are we stopping at
printf@plt instead of the definition when we know glibc is loaded?

Maybe this comes back to the two names trouble?

I have no objection to relaxing this test but I'm wondering if we need
another.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfc] Relax "printf" function name check in annota* test cases
  2008-05-15  0:45 ` Daniel Jacobowitz
@ 2008-05-15  0:54   ` Ulrich Weigand
  2008-05-15 12:09     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2008-05-15  0:54 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> On Wed, May 14, 2008 at 11:36:22PM +0200, Ulrich Weigand wrote:
> > Hello,
> > 
> > this patch fixes the last regression after Alan's patch was applied:
> > some sub-tests of annota1.exp and annota3.exp are now failing because
> > when stopped at the "printf" breakpoint, the current function is not
> > called printf, but printf@plt.
> 
> This is unrelated to the annota tests, as you said... but the
> breakpoint is at "printf", isn't it?  Why are we stopping at
> printf@plt instead of the definition when we know glibc is loaded?
> 
> Maybe this comes back to the two names trouble?

No, this is the symbol versioning problem; we do not find any exported
symbol named "printf" in glibc, and so the breakpoint remains on the
plt stub.

Note that before Alan's patch the breakpoint *also* remained on the
plt stub, it's just that the stub was then called "printf" (the solib
trampoline generated from the undefined symbol), not "printf@plt"
(from the synthetic symbol).

B.t.w. even if we were to handle versioned symbols (I have a patch
for that), the original annota test cases would still break -- 
because the function would then be called printf@GLIBC...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfc] Relax "printf" function name check in annota* test cases
  2008-05-15  0:54   ` Ulrich Weigand
@ 2008-05-15 12:09     ` Daniel Jacobowitz
  2008-05-16 15:27       ` Ulrich Weigand
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2008-05-15 12:09 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

On Thu, May 15, 2008 at 12:45:50AM +0200, Ulrich Weigand wrote:
> B.t.w. even if we were to handle versioned symbols (I have a patch
> for that), the original annota test cases would still break -- 
> because the function would then be called printf@GLIBC...

Ok, thanks.  This patch sounds like the right thing to me then!

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [rfc] Relax "printf" function name check in annota* test cases
  2008-05-15 12:09     ` Daniel Jacobowitz
@ 2008-05-16 15:27       ` Ulrich Weigand
  0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2008-05-16 15:27 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> On Thu, May 15, 2008 at 12:45:50AM +0200, Ulrich Weigand wrote:
> > B.t.w. even if we were to handle versioned symbols (I have a patch
> > for that), the original annota test cases would still break -- 
> > because the function would then be called printf@GLIBC...
> 
> Ok, thanks.  This patch sounds like the right thing to me then!

Thanks, I've checked it in now.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-05-16 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-15  0:37 [rfc] Relax "printf" function name check in annota* test cases Ulrich Weigand
2008-05-15  0:45 ` Daniel Jacobowitz
2008-05-15  0:54   ` Ulrich Weigand
2008-05-15 12:09     ` Daniel Jacobowitz
2008-05-16 15:27       ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox