This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA]: arm changes to run gdb.asm/asm-source.exp successfully


Corinna Vinschen wrote:
> 
> Hi,
> 
> the following patch allows ARM targets to run the gdb.asm test
> successfully.  The change consists basically of a change to
> asm-tdep.c, function arm_skip_prologue() to scan the prologue
> the hard way when the source is assembler code and of adding the
> appropriate arm.inc file plus some additional lines in asm-source.exp
> and configure.in to support the new target.
> 

Yes, it makes sense not to use the line number information if the
source is assembler (until something changes in gas land, but if
that happens we will adapt).  This part is approved, just add the word
"Always" to the changelog or reword it to "Do not use line number
information to skip the prolog if source is assembler.".

If neither Michael Snyder not Andrew objects until tomorrow at this
time, you can check in the new gdb.asm tests as well.  (P.S.: The
architecture is ARM, with capital letters -- it was once an acronym
for Acorn Risc Machine).

Regards,
Fernando

> Corinna
> 
> ChangeLog:
> 
> 2001-12-04  Corinna Vinschen  <vinschen@redhat.com>
> 
>         * arm-tdep.c (arm_skip_prologue): Skip prologue by scanning
                                           ^ Always
>         the prologue if source is assembler.
> 
> testsuite/ChangeLog:
> 
>         * gdb.asm/arm.inc: New file.
>         * gdb.asm/asm-source.exp: Add arm targets
                                        ^^^ARM
>         * gdb.asm/configure.in: Ditto.
>         * gdb.asm/configure: Recreated from configure.in.
> 
> The new gdb.asm/arm.inc file:
> 
>         comment "subroutine prologue"
>         .macro gdbasm_enter
>         mov ip, sp
>         stmdb sp!, {fp, ip, lr, pc}
>         sub fp, ip, #4
>         .endm
> 
>         comment "subroutine epilogue"
>         .macro gdbasm_leave
>         ldmea fp, {fp, sp, pc}
>         .endm
> 
>         .macro gdbasm_call subr
>         bl \subr
>         .endm
> 
>         .macro gdbasm_several_nops
>         nop
>         nop
>         nop
>         nop
>         .endm
> 
>         comment "exit (0)"
>         .macro gdbasm_exit0
>         mov r0, #0
>         swi 0x00123456
>         .endm
> 
>         comment "crt0 startup"
>         .macro gdbasm_startup
>         mov sp, #0
>         .endm
> 
> Index: arm-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/arm-tdep.c,v
> retrieving revision 1.18
> diff -u -p -r1.18 arm-tdep.c
> --- arm-tdep.c  2001/11/30 20:27:08     1.18
> +++ arm-tdep.c  2001/12/04 18:18:25
> @@ -402,15 +402,24 @@ arm_skip_prologue (CORE_ADDR pc)
>    unsigned long inst;
>    CORE_ADDR skip_pc;
>    CORE_ADDR func_addr, func_end;
> +  char *func_name;
>    struct symtab_and_line sal;
> 
>    /* See what the symbol table says.  */
> 
> -  if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
> +  if (find_pc_partial_function (pc, &func_name, &func_addr, &func_end))
>      {
> -      sal = find_pc_line (func_addr, 0);
> -      if ((sal.line != 0) && (sal.end < func_end))
> -       return sal.end;
> +      struct symbol *sym;
> +
> +      /* Found a function.  */
> +      sym = lookup_symbol (func_name, NULL, VAR_NAMESPACE, NULL, NULL);
> +      if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
> +        {
> +         /* Don't use this trick for assembly source files. */
> +         sal = find_pc_line (func_addr, 0);
> +         if ((sal.line != 0) && (sal.end < func_end))
> +           return sal.end;
> +        }
>      }
> 
>    /* Check if this is Thumb code.  */
> Index: testsuite/gdb.asm/asm-source.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/asm-source.exp,v
> retrieving revision 1.10
> diff -u -p -r1.10 asm-source.exp
> --- asm-source.exp      2001/12/01 01:13:27     1.10
> +++ asm-source.exp      2001/12/04 18:18:27
> @@ -35,6 +35,12 @@ set asm-arch ""
>  set asm-flags ""
>  set link-flags ""
> 
> +if [istarget "*arm-*-*"] then {
> +    set asm-arch arm
> +}
> +if [istarget "xscale-*-*"] then {
> +    set asm-arch arm
> +}
>  if [istarget "d10v-*-*"] then {
>      set asm-arch d10v
>  }
> Index: testsuite/gdb.asm/configure
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/configure,v
> retrieving revision 1.6
> diff -u -p -r1.6 configure
> --- configure   2001/12/01 01:13:27     1.6
> +++ configure   2001/12/04 18:18:28
> @@ -28,7 +28,6 @@ program_suffix=NONE
>  program_transform_name=s,x,x,
>  silent=
>  site=
> -sitefile=
>  srcdir=
>  target=NONE
>  verbose=
> @@ -143,7 +142,6 @@ Configuration:
>    --help                  print this message
>    --no-create             do not create output files
>    --quiet, --silent       do not print \`checking...' messages
> -  --site-file=FILE        use FILE as the site file
>    --version               print the version of autoconf that created configure
>  Directory and file names:
>    --prefix=PREFIX         install architecture-independent files in PREFIX
> @@ -314,11 +312,6 @@ EOF
>    -site=* | --site=* | --sit=*)
>      site="$ac_optarg" ;;
> 
> -  -site-file | --site-file | --site-fil | --site-fi | --site-f)
> -    ac_prev=sitefile ;;
> -  -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
> -    sitefile="$ac_optarg" ;;
> -
>    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
>      ac_prev=srcdir ;;
>    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
> @@ -484,16 +477,12 @@ fi
>  srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
> 
>  # Prefer explicitly selected file to automatically selected ones.
> -if test -z "$sitefile"; then
> -  if test -z "$CONFIG_SITE"; then
> -    if test "x$prefix" != xNONE; then
> -      CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
> -    else
> -      CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
> -    fi
> +if test -z "$CONFIG_SITE"; then
> +  if test "x$prefix" != xNONE; then
> +    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
> +  else
> +    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
>    fi
> -else
> -  CONFIG_SITE="$sitefile"
>  fi
>  for ac_site_file in $CONFIG_SITE; do
>    if test -r "$ac_site_file"; then
> @@ -582,7 +571,7 @@ else { echo "configure: error: can not r
>  fi
> 
>  echo $ac_n "checking host system type""... $ac_c" 1>&6
> -echo "configure:586: checking host system type" >&5
> +echo "configure:575: checking host system type" >&5
> 
>  host_alias=$host
>  case "$host_alias" in
> @@ -603,7 +592,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
>  echo "$ac_t""$host" 1>&6
> 
>  echo $ac_n "checking target system type""... $ac_c" 1>&6
> -echo "configure:607: checking target system type" >&5
> +echo "configure:596: checking target system type" >&5
> 
>  target_alias=$target
>  case "$target_alias" in
> @@ -621,7 +610,7 @@ target_os=`echo $target | sed 's/^\([^-]
>  echo "$ac_t""$target" 1>&6
> 
>  echo $ac_n "checking build system type""... $ac_c" 1>&6
> -echo "configure:625: checking build system type" >&5
> +echo "configure:614: checking build system type" >&5
> 
>  build_alias=$build
>  case "$build_alias" in
> @@ -646,6 +635,8 @@ test "$host_alias" != "$target_alias" &&
> 
>  archinc=common.inc
>  case ${target} in
> +*arm-*-*) archinc=arm.inc ;;
> +xscale-*-*) archinc=arm.inc ;;
>  d10v-*-*) archinc=d10v.inc ;;
>  s390-*-*) archinc=s390.inc ;;
>  i[3456]86*) archinc=i386.inc ;;
> Index: testsuite/gdb.asm/configure.in
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/configure.in,v
> retrieving revision 1.6
> diff -u -p -r1.6 configure.in
> --- configure.in        2001/12/01 01:13:27     1.6
> +++ configure.in        2001/12/04 18:18:28
> @@ -15,6 +15,8 @@ AC_CANONICAL_SYSTEM
>  dnl In default case we need to link with some file so use common.inc.
>  archinc=common.inc
>  case ${target} in
> +*arm-*-*) archinc=arm.inc ;;
> +xscale-*-*) archinc=arm.inc ;;
>  d10v-*-*) archinc=d10v.inc ;;
>  s390-*-*) archinc=s390.inc ;;
>  i[[3456]]86*) archinc=i386.inc ;;
> 
> --
> Corinna Vinschen
> Cygwin Developer
> Red Hat, Inc.
> mailto:vinschen@redhat.com

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]