Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Fix disassemble without parameters in tailcall frame
@ 2012-09-12 15:38 Jan Kratochvil
  2012-09-13  3:56 ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2012-09-12 15:38 UTC (permalink / raw)
  To: gdb-patches

Hi,

when the current frame is in tailcall function:

disassemble
No function contains program counter for selected frame.
(gdb) FAIL: gdb.arch/amd64-entry-value.exp: disassemble
->
disassemble
Dump of assembler code for function b(int, double):
   0x0000000000400790 <+0>:     addsd  0x298(%rip),%xmm0        # 0x400a30
   0x0000000000400798 <+8>:     add    $0x2,%edi
   0x000000000040079b <+11>:    jmp    0x400770 <c(int, double)>
End of assembler dump.

Such a simple but annoying to me issue when tailcall frames are common in
practice now.

The "=> " PC pointer is now not displayed anywhere which seems correct to me.

No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu.


Thanks,
Jan


gdb/
2012-09-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix disassemble without parameters in tailcall frame.
	* cli/cli-cmds.c (disassemble_current_function): Use
	get_frame_address_in_block.

gdb/testsuite/
2012-09-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix disassemble without parameters in tailcall frame.
	* gdb.arch/amd64-entry-value.exp (down, disassemble): New tests.

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d3473d5..0bdd373 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1091,7 +1091,7 @@ disassemble_current_function (int flags)
 
   frame = get_selected_frame (_("No frame selected."));
   gdbarch = get_frame_arch (frame);
-  pc = get_frame_pc (frame);
+  pc = get_frame_address_in_block (frame);
   if (find_pc_partial_function (pc, &name, &low, &high) == 0)
     error (_("No function contains program counter for selected frame."));
 #if defined(TUI)
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
index dd22d42..5ff18bf 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
@@ -213,6 +213,10 @@ gdb_test {p $sp0 == $sp} " = true"
 gdb_test "frame 3" "\r\n#3 .*"
 gdb_test {p $sp0 + sizeof (void *) == $sp} " = true"
 
+# Test $pc adjustment which is now right after the function end.
+gdb_test "down" "\r\n#2 .*"
+gdb_test "disassemble" {Dump of assembler code for function b\(int, double\):.*}
+
 
 # Test partial-ambiguous virtual tail call frames chain.
 


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

* Re: [patch] Fix disassemble without parameters in tailcall frame
  2012-09-12 15:38 [patch] Fix disassemble without parameters in tailcall frame Jan Kratochvil
@ 2012-09-13  3:56 ` Yao Qi
  2012-09-13  4:17   ` Jan Kratochvil
  0 siblings, 1 reply; 4+ messages in thread
From: Yao Qi @ 2012-09-13  3:56 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

On 09/12/2012 11:38 PM, Jan Kratochvil wrote:
> The "=> " PC pointer is now not displayed anywhere which seems correct to me.
>

Right, PC doesn't fall in the range of function b, so "=>" is not displayed.

disassemble^M
Dump of assembler code for function b(int, double):^M
    0x0000000000400520 <+0>:     addsd  0x468(%rip),%xmm0        # 
0x400990^M
    0x0000000000400528 <+8>:     add    $0x2,%edi^M
    0x000000000040052b <+11>:    jmp    0x400500 <c(int, double)>^M
End of assembler dump.^M
(gdb) PASS: gdb.arch/amd64-entry-value.exp: disassemble
p/x $rip^M
$25 = 0x40052d

>
> +# Test $pc adjustment which is now right after the function end.
> +gdb_test "down" "\r\n#2 .*"
> +gdb_test "disassemble" {Dump of assembler code for function b\(int, double\):.*}
> +

Do we need to complete the test here to check 'PC doesn't fall in the 
range of function b' or ' => is not displayed'?

-- 
Yao


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

* Re: [patch] Fix disassemble without parameters in tailcall frame
  2012-09-13  3:56 ` Yao Qi
@ 2012-09-13  4:17   ` Jan Kratochvil
  2012-09-21 19:35     ` [commit] " Jan Kratochvil
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2012-09-13  4:17 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On Thu, 13 Sep 2012 05:55:27 +0200, Yao Qi wrote:
> On 09/12/2012 11:38 PM, Jan Kratochvil wrote:
> >+# Test $pc adjustment which is now right after the function end.
> >+gdb_test "down" "\r\n#2 .*"
> >+gdb_test "disassemble" {Dump of assembler code for function b\(int, double\):.*}
> 
> Do we need to complete the test here to check 'PC doesn't fall in
> the range of function b' or ' => is not displayed'?

I was thinking about it before.  Extended the testcase.


Thanks,
Jan


gdb/
2012-09-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix disassemble without parameters in tailcall frame.
	* cli/cli-cmds.c (disassemble_current_function): Use
	get_frame_address_in_block.

gdb/testsuite/
2012-09-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix disassemble without parameters in tailcall frame.
	* gdb.arch/amd64-entry-value.exp (down, disassemble): New tests.

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d3473d5..0bdd373 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1091,7 +1091,7 @@ disassemble_current_function (int flags)
 
   frame = get_selected_frame (_("No frame selected."));
   gdbarch = get_frame_arch (frame);
-  pc = get_frame_pc (frame);
+  pc = get_frame_address_in_block (frame);
   if (find_pc_partial_function (pc, &name, &low, &high) == 0)
     error (_("No function contains program counter for selected frame."));
 #if defined(TUI)
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
index dd22d42..455b7a7 100644
--- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp
+++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp
@@ -213,6 +213,25 @@ gdb_test {p $sp0 == $sp} " = true"
 gdb_test "frame 3" "\r\n#3 .*"
 gdb_test {p $sp0 + sizeof (void *) == $sp} " = true"
 
+# Test $pc adjustment which is now right after the function end.
+# Also verify the current PC indicator "=> " is not displayed anywhere.
+gdb_test "down" "\r\n#2 .*"
+set test "disassemble"
+gdb_test_multiple $test $test {
+    -re "^$test\r\n" {
+	exp_continue
+    }
+    -re "^Dump of assembler code for function b\\(int, double\\):\r\n" {
+	exp_continue
+    }
+    -re "^   0x\[^\r\n\]*\r\n" {
+	exp_continue
+    }
+    -re "^End of assembler dump\\.\r\n$gdb_prompt $" {
+	pass $test
+    }
+}
+
 
 # Test partial-ambiguous virtual tail call frames chain.
 


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

* [commit] [patch] Fix disassemble without parameters in tailcall frame
  2012-09-13  4:17   ` Jan Kratochvil
@ 2012-09-21 19:35     ` Jan Kratochvil
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kratochvil @ 2012-09-21 19:35 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On Thu, 13 Sep 2012 06:17:35 +0200, Jan Kratochvil wrote:
> gdb/
> 2012-09-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Fix disassemble without parameters in tailcall frame.
> 	* cli/cli-cmds.c (disassemble_current_function): Use
> 	get_frame_address_in_block.
> 
> gdb/testsuite/
> 2012-09-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Fix disassemble without parameters in tailcall frame.
> 	* gdb.arch/amd64-entry-value.exp (down, disassemble): New tests.

Checked in:
	http://sourceware.org/ml/gdb-cvs/2012-09/msg00123.html


Jan


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

end of thread, other threads:[~2012-09-21 19:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-12 15:38 [patch] Fix disassemble without parameters in tailcall frame Jan Kratochvil
2012-09-13  3:56 ` Yao Qi
2012-09-13  4:17   ` Jan Kratochvil
2012-09-21 19:35     ` [commit] " Jan Kratochvil

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