scm-symbol.c: Add (domain_enum) casts
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 26 Oct 2015 12:41:36 +0000 (08:41 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 26 Oct 2015 12:41:36 +0000 (08:41 -0400)
We currently pass integers as domain_enums to lookup_symbol.  The
most obvious fix is to add casts there.

I first thought of changing the type of the domain variables to
domain_enum.  However, because we pass a pointer to them to
gdbscm_parse_function_args, which expects them to be integers (because
of the format string), I don't think it would be correct.  If the enum
does not have the same size as an int, gdbscm_parse_function_args could
write past the memory of domain, overwriting something else on the
stack.

gdb/ChangeLog:

* guile/scm-symbol.c (gdbscm_lookup_global_symbol): Add
domain_enum cast.
(gdbscm_lookup_symbol): Likewise.

gdb/ChangeLog
gdb/guile/scm-symbol.c

index 1afb8fd48b7588d69d37c714bfed5939a02e1441..ecc286f5e0857f5b87663217ba11ee61b3ac0b09 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-26  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * guile/scm-symbol.c (gdbscm_lookup_global_symbol): Add
+       domain_enum cast.
+       (gdbscm_lookup_symbol): Likewise.
+
 2015-10-25  Iain Buclaw  <ibuclaw@gdcproject.org>
 
        * d-exp.y: Remove an obsolete comment and propagate the block
index 81e4d50517c115fc63560296be793934acd1ffce..10400bedb0794c18a17ad4a161593be9c1374737 100644 (file)
@@ -622,7 +622,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
 
   TRY
     {
-      symbol = lookup_symbol (name, block, domain, &is_a_field_of_this).symbol;
+      symbol = lookup_symbol (name, block, (domain_enum) domain,
+                             &is_a_field_of_this).symbol;
     }
   CATCH (ex, RETURN_MASK_ALL)
     {
@@ -662,7 +663,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
 
   TRY
     {
-      symbol = lookup_global_symbol (name, NULL, domain).symbol;
+      symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol;
     }
   CATCH (ex, RETURN_MASK_ALL)
     {
This page took 0.040199 seconds and 4 git commands to generate.