gdb/testsuite: use -gdwarf-4 in simavr board

Message ID 20210404022541.3576085-1-simon.marchi@polymtl.ca
State New
Headers show
Series
  • gdb/testsuite: use -gdwarf-4 in simavr board
Related show

Commit Message

Simon Marchi via Gdb-patches April 4, 2021, 2:25 a.m.
From: Simon Marchi <simon.marchi@efficios.com>


By default, when using the -g switch, avr-gcc generates stabs debug
information.  I think it would make more sense to test GDB against DWARF
information, because stabs is obsolete by now, and nobody work on it.
So change the simavr board to pass -gdwarf-4 as the debug flag.

The downside is that users are probably more likely to use just -g, so
we don't test GDB the same way as users are likely to use it.  But in
this case, if somebody comes and asks for help with GDB for AVR, I
suggest we encourage them to use -gdwarf-4.

I can't give stats about how that changes test results, because the
testsuite is too broken.  There is an internal error that happens quite
frequently that needs to be investigated:

    /home/simark/src/wt/avr/gdb/trad-frame.h:143: internal-error: LONGEST trad_frame_saved_reg::addr() const: Assertion `m_kind == trad_frame_saved_reg_kind::ADDR' failed.

I sent a question on the gcc mailing list, asking why stabs is the
default:

    https://gcc.gnu.org/pipermail/gcc/2021-April/235309.html

gdb/testsuite/ChangeLog:

	* boards/simavr.exp: Set debug_flags.

Change-Id: I70e471fad3a79ab1d79d13dda8436bb9eb666e0a
---
 gdb/testsuite/boards/simavr.exp | 1 +
 1 file changed, 1 insertion(+)

-- 
2.30.1

Comments

Simon Marchi via Gdb-patches April 16, 2021, 3:04 p.m. | #1
On 2021-04-03 10:25 p.m., Simon Marchi via Gdb-patches wrote:
> From: Simon Marchi <simon.marchi@efficios.com>

> 

> By default, when using the -g switch, avr-gcc generates stabs debug

> information.  I think it would make more sense to test GDB against DWARF

> information, because stabs is obsolete by now, and nobody work on it.

> So change the simavr board to pass -gdwarf-4 as the debug flag.

> 

> The downside is that users are probably more likely to use just -g, so

> we don't test GDB the same way as users are likely to use it.  But in

> this case, if somebody comes and asks for help with GDB for AVR, I

> suggest we encourage them to use -gdwarf-4.

> 

> I can't give stats about how that changes test results, because the

> testsuite is too broken.  There is an internal error that happens quite

> frequently that needs to be investigated:

> 

>     /home/simark/src/wt/avr/gdb/trad-frame.h:143: internal-error: LONGEST trad_frame_saved_reg::addr() const: Assertion `m_kind == trad_frame_saved_reg_kind::ADDR' failed.

> 

> I sent a question on the gcc mailing list, asking why stabs is the

> default:

> 

>     https://gcc.gnu.org/pipermail/gcc/2021-April/235309.html

> 

> gdb/testsuite/ChangeLog:

> 

> 	* boards/simavr.exp: Set debug_flags.

> 

> Change-Id: I70e471fad3a79ab1d79d13dda8436bb9eb666e0a

> ---

>  gdb/testsuite/boards/simavr.exp | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/gdb/testsuite/boards/simavr.exp b/gdb/testsuite/boards/simavr.exp

> index c4f278ccb12e..35885ef78c27 100644

> --- a/gdb/testsuite/boards/simavr.exp

> +++ b/gdb/testsuite/boards/simavr.exp

> @@ -43,6 +43,7 @@ set_board_info c++compiler avr-g++

>  

>  set_board_info cflags "-mmcu=${simavr_mcu}"

>  set_board_info ldflags "-mmcu=${simavr_mcu}"

> +set_board_info debug_flags "-gdwarf-4"

>  

>  set_board_info use_gdb_stub 1

>  set_board_info gdb_protocol "remote"

> 


I pushed this.

Simon

Patch

diff --git a/gdb/testsuite/boards/simavr.exp b/gdb/testsuite/boards/simavr.exp
index c4f278ccb12e..35885ef78c27 100644
--- a/gdb/testsuite/boards/simavr.exp
+++ b/gdb/testsuite/boards/simavr.exp
@@ -43,6 +43,7 @@  set_board_info c++compiler avr-g++
 
 set_board_info cflags "-mmcu=${simavr_mcu}"
 set_board_info ldflags "-mmcu=${simavr_mcu}"
+set_board_info debug_flags "-gdwarf-4"
 
 set_board_info use_gdb_stub 1
 set_board_info gdb_protocol "remote"