aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-09 22:57:15 +1030
committerAlan Modra <amodra@gmail.com>2019-12-10 09:02:05 +1030
commit6f0e0752309e3e3016a48db1672e3092c677020c (patch)
tree2bbb804e67b89f91c238fde3983558ecf466e096 /opcodes
parentf59f89789fc17166ee05491e5c430706c9b7c18e (diff)
downloadgdb-6f0e0752309e3e3016a48db1672e3092c677020c.zip
gdb-6f0e0752309e3e3016a48db1672e3092c677020c.tar.gz
gdb-6f0e0752309e3e3016a48db1672e3092c677020c.tar.bz2
Remove backup ppc struct dis_private.
ppc-dis.c used a global struct whenever malloc failed to provide the eight bytes of memory necessary for struct dis_private. Which is quite ridiculous. If that malloc failed there is zero chance some other malloc won't fail too. * ppc-dis.c (private): Delete variable. (get_powerpc_dialect): Don't segfault on NULL info->private_data. (powerpc_init_dialect): Don't use global private.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog6
-rw-r--r--opcodes/ppc-dis.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index a82f261..4d8dfe1 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,11 @@
2019-12-10 Alan Modra <amodra@gmail.com>
+ * ppc-dis.c (private): Delete variable.
+ (get_powerpc_dialect): Don't segfault on NULL info->private_data.
+ (powerpc_init_dialect): Don't use global private.
+
+2019-12-10 Alan Modra <amodra@gmail.com>
+
* s12z-opc.c: Formatting.
2019-12-08 Alan Modra <amodra@gmail.com>
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index 2f5756b..9add602 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -40,7 +40,7 @@ struct dis_private
{
/* Stash the result of parsing disassembler_options here. */
ppc_cpu_t dialect;
-} private;
+};
#define POWERPC_DIALECT(INFO) \
(((struct dis_private *) ((INFO)->private_data))->dialect)
@@ -259,7 +259,8 @@ get_powerpc_dialect (struct disassemble_info *info)
{
ppc_cpu_t dialect = 0;
- dialect = POWERPC_DIALECT (info);
+ if (info->private_data)
+ dialect = POWERPC_DIALECT (info);
/* Disassemble according to the section headers flags for VLE-mode. */
if (dialect & PPC_OPCODE_VLE
@@ -308,7 +309,7 @@ powerpc_init_dialect (struct disassemble_info *info)
struct dis_private *priv = calloc (sizeof (*priv), 1);
if (priv == NULL)
- priv = &private;
+ return;
switch (info->mach)
{