public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Treat OP_F77_UNDETERMINED_ARGLIST as OP_FUNCALL
@ 2018-01-31 15:54 Yao Qi
  2018-02-06 17:14 ` Yao Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Yao Qi @ 2018-01-31 15:54 UTC (permalink / raw)
  To: gdb-patches

When I debug some fortran expression parsing, I got

(gdb) set debug expression 1
(gdb) p intvla(5,5,5)
Dump of expression @ 0x205fa80, before conversion to prefix form:
	Language fortran, 19 elements, 16 bytes each.
	Index                Opcode         Hex Value  String Value
	    0          OP_VAR_VALUE  40  (...............
	    1    <unknown 31863232>  31863232  .1..............
....
	   14             BINOP_REM  5  ................
	   15               OP_LONG  38  &...............
	   16  OP_F77_UNDETERMINED_ARGLIST  48  0...............
	   17             BINOP_MUL  3  ................
	   18  OP_F77_UNDETERMINED_ARGLIST  48  0...............
Dump of expression @ 0x205fa80, after conversion to prefix form:
Expression: `Invalid expression
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This patch fixes this problem by handling OP_F77_UNDETERMINED_ARGLIST in
the same way as handling OP_FUNCALL.  With this patch applied, the output
looks better,

(gdb) p intvla (5,5,5)
Dump of expression @ 0x2d75590, before conversion to prefix form:
	Language fortran, 19 elements, 16 bytes each.
	Index                Opcode         Hex Value  String Value
	    0          OP_VAR_VALUE  40  (...............
....
	   16  OP_F77_UNDETERMINED_ARGLIST  48  0...............
	   17             BINOP_MUL  3  ................
	   18  OP_F77_UNDETERMINED_ARGLIST  48  0...............
Dump of expression @ 0x2d75590, after conversion to prefix form:
Expression: `vla_primitives::intvla (5, 5, 5)'
	Language fortran, 19 elements, 16 bytes each.

	    0  OP_F77_UNDETERMINED_ARGLIST  Number of args: 3
	    3    OP_VAR_VALUE          Block @0x297e1c0, symbol @0x297cd50 (intvla)
	    7    OP_LONG               Type @0x2976900 (int), value 5 (0x5)
	   11    OP_LONG               Type @0x2976900 (int), value 5 (0x5)
	   15    OP_LONG               Type @0x2976900 (int), value 5 (0x5)

gdb:

2018-01-23  Yao Qi  <yao.qi@linaro.org>

	* expprint.c (print_subexp_standard): Handle
	OP_F77_UNDETERMINED_ARGLIST.
	(dump_subexp_body_standard): Likewise.
---
 gdb/expprint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/expprint.c b/gdb/expprint.c
index ac5ae0f..9d1884f 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -186,6 +186,7 @@ print_subexp_standard (struct expression *exp, int *pos,
       return;
 
     case OP_FUNCALL:
+    case OP_F77_UNDETERMINED_ARGLIST:
       (*pos) += 2;
       nargs = longest_to_int (exp->elts[pc + 1].longconst);
       print_subexp (exp, pos, stream, PREC_SUFFIX);
@@ -923,6 +924,7 @@ dump_subexp_body_standard (struct expression *exp,
       elt += 2;
       break;
     case OP_FUNCALL:
+    case OP_F77_UNDETERMINED_ARGLIST:
       {
 	int i, nargs;
 
@@ -1123,7 +1125,6 @@ dump_subexp_body_standard (struct expression *exp,
     default:
     case OP_NULL:
     case MULTI_SUBSCRIPT:
-    case OP_F77_UNDETERMINED_ARGLIST:
     case OP_COMPLEX:
     case OP_BOOL:
     case OP_M2_STRING:
-- 
1.9.1

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

* Re: [PATCH] Treat OP_F77_UNDETERMINED_ARGLIST as OP_FUNCALL
  2018-01-31 15:54 [PATCH] Treat OP_F77_UNDETERMINED_ARGLIST as OP_FUNCALL Yao Qi
@ 2018-02-06 17:14 ` Yao Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Yao Qi @ 2018-02-06 17:14 UTC (permalink / raw)
  To: gdb-patches

Yao Qi <qiyaoltc@gmail.com> writes:

> gdb:
>
> 2018-01-23  Yao Qi  <yao.qi@linaro.org>
>
> 	* expprint.c (print_subexp_standard): Handle
> 	OP_F77_UNDETERMINED_ARGLIST.
> 	(dump_subexp_body_standard): Likewise.

Patch is pushed in.

-- 
Yao (齐尧)

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

end of thread, other threads:[~2018-02-06 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-31 15:54 [PATCH] Treat OP_F77_UNDETERMINED_ARGLIST as OP_FUNCALL Yao Qi
2018-02-06 17:14 ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).