Fix bug in nios2 prologue analysis.
authorSandra Loosemore <sandra@codesourcery.com>
Fri, 23 Aug 2019 15:18:54 +0000 (08:18 -0700)
committerSandra Loosemore <sandra@codesourcery.com>
Fri, 23 Aug 2019 15:18:54 +0000 (08:18 -0700)
The nios2 prologue analyzer was mistakenly using an unsigned int field
to represent a 32-bit signed value.  This caused problems with an
incorrect conversion being applied to negative values when they were
automatically promoted for addition to a 64-bit CORE_ADDR value.

This patch fixes test failures in gdb.base/large-frame.exp and
gdb.dwarf2/dw2-ref-missing-frame.exp.  Normally the nios2 backend
prefers to use the dwarf2 unwinder so the prologue analyzer is only
invoked if there is no dwarf2 information.

2019-08-23  Sandra Loosemore  <sandra@codesourcery.com>

gdb/
* nios2-tdep.c (struct reg_value): Improve comments.  Make
the offset field signed.

gdb/ChangeLog
gdb/nios2-tdep.c

index ac84245c340e695014a354939df310109ee8f133..df8488b109a88deaaa6429f24b59cea10fc1abe3 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-23  Sandra Loosemore  <sandra@codesourcery.com>
+
+       * nios2-tdep.c (struct reg_value): Improve comments.  Make
+       the offset field signed.
+
 2019-08-22  Christian Biesinger  <cbiesinger@google.com>
 
        * python/lib/gdb/__init__.py (_execute_file): New function.
index 2a21c33b83f7a29ef082044be252da376f038bef..8d685d4acaa3717db99445f966fafa10a9598804 100644 (file)
@@ -58,13 +58,15 @@ static int nios2_debug = 0;
    analysis; see the reg_value and reg_saved tables in
    struct nios2_unwind_cache, respectively.  */
 
-/* struct reg_value is used to record that a register has the same value
-   as reg at the given offset from the start of a function.  */
+/* struct reg_value is used to record that a register has reg's initial
+   value at the start of a function plus the given constant offset.
+   If reg == 0, then the value is just the offset.
+   If reg < 0, then the value is unknown.  */
 
 struct reg_value
 {
   int reg;
-  unsigned int offset;
+  int offset;
 };
 
 /* struct reg_saved is used to record that a register value has been saved at
This page took 0.030481 seconds and 4 git commands to generate.