From: Markus Deuling <deuling@de.ibm.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Ulrich Weigand <uweigand@de.ibm.com>
Subject: [patch]: Fix NULL ptr handling in f_print_type
Date: Thu, 28 Feb 2008 06:00:00 -0000 [thread overview]
Message-ID: <47C64452.2050506@de.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2094 bytes --]
Hi,
f_print_type from f-typeprint.c is currently not able to handle (varstring == NULL) properly
like for example its c counterpart does. Here is an example:
(gdb) set language fortran
Warning: the current language does not match this frame.
(gdb) set debug expression 1
(gdb) set $r0%uint128=1
Dump of expression @ 0x102f4c78'
Language fortran, 15 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_REGISTER 197568495616 ................
1 OP_NULL 2 ................
<snip>
14 BINOP_ASSIGN 90194313216 ................
Dump of expression @ 0x102f4c78, after conversion to prefix form:
Expression: `$r0.uint128 = 1'
Language fortran, 15 elements, 16 bytes each.
0 BINOP_ASSIGN
1 STRUCTOP_STRUCT Element name: `uint128'
6 OP_REGISTER Register $r0
11 OP_LONG Type @0x102e9528 (intSegmentation fault (core dumped)
The attached patch fixes it:
(gdb) set language fortran
(gdb) set $r0%uint128=6
Dump of expression @ 0x102f4d30'
Language fortran, 15 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_REGISTER 197568495616 ................
1 OP_NULL 2 ................
<snip>
14 BINOP_ASSIGN 90194313216 ................
Dump of expression @ 0x102f4d30, after conversion to prefix form:
Expression: `$r0.uint128 = 6'
Language fortran, 15 elements, 16 bytes each.
0 BINOP_ASSIGN
1 STRUCTOP_STRUCT Element name: `uint128'
6 OP_REGISTER Register $r0
11 OP_LONG Type @0x102e9528 (int), value 6 (0x6)
Tested on SPU and x86 without regression. Ok ?
ChangeLog:
* f-typeprint.c (f_print_type): Handle NULL pointer in VARSTRING
properly.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
[-- Attachment #2: fix-fortran --]
[-- Type: text/plain, Size: 1100 bytes --]
diff -urpN gdb-6.7.1.orig/gdb/f-typeprint.c gdb-6.7.1/gdb/f-typeprint.c
--- gdb-6.7.1.orig/gdb/f-typeprint.c 2008-02-27 11:01:53.000000000 +0100
+++ gdb-6.7.1/gdb/f-typeprint.c 2008-02-28 06:13:22.000000000 +0100
@@ -76,13 +76,16 @@ f_print_type (struct type *type, char *v
fputs_filtered (" ", stream);
f_type_print_varspec_prefix (type, stream, show, 0);
- fputs_filtered (varstring, stream);
+ if (varstring != NULL)
+ {
+ fputs_filtered (varstring, stream);
- /* For demangled function names, we have the arglist as part of the name,
- so don't print an additional pair of ()'s */
+ /* For demangled function names, we have the arglist as part of the name,
+ so don't print an additional pair of ()'s */
- demangled_args = varstring[strlen (varstring) - 1] == ')';
- f_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
+ demangled_args = varstring[strlen (varstring) - 1] == ')';
+ f_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
+ }
}
/* Print any asterisks or open-parentheses needed before the
next reply other threads:[~2008-02-28 5:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-28 6:00 Markus Deuling [this message]
2008-02-28 16:41 ` Daniel Jacobowitz
2008-02-28 19:15 ` Markus Deuling
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47C64452.2050506@de.ibm.com \
--to=deuling@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox