On Mon, Jun 13, 2005 at 09:11:39AM +0200, Raphael Bossek wrote:
> Package: gdb
> Version: 6.3-6
> Severity: wishlist
> 
> This patch against 6.3-6 allow to debug cross-compiled applications
> using GDB. To create a cross-gdb please apply this patch and set
> the TARGET environment variable to your desired architecture. In this
> example we create a powerpc-linux-gdb application:

Not OK as is...

> $ apt-get source gdb
> $ cd gdb-6.3
> $ patch -p1 < ../gdb-6.3-6.cross-patch-20050613.diff
> $ TARGET=powerpc dpkg-buildpackage -rfakeroot -uc -us

Is there a standard for this other than TARGET?  TARGET is a very
generic name and might end up set in the environment unexpectedly.
DEB_TARGET_ARCH maybe?

> A new configuration variable is introduced with this patch called
> "solib-crossdir":
> 
> (gdb) show solib-crossdir
> The base directory for cross libraries is "/usr/powerpc-linux".
> (gdb)
> 
> This configuration variable is set by default to the dpkg-cross's
> default directory where cross files are found. For libraries it is
> /usr/powerpc-linux/lib for PowerPC cross-debugger.

This is unnecessary, what are you trying to accomplish?  Why can't you
use --with-sysroot to do it?

> +  MAINTAINER = Raphael Bossek <[EMAIL PROTECTED]>

Um, not in the GDB packages I maintain, you aren't.

> -Replaces: gdb-arm, insight (<< 6.1+cvs.2004.04.07-1)
> -Description: The GNU Debugger
> +Replaces: gdb-arm, [EMAIL PROTECTED]@ (<< 6.1+cvs.2004.04.07-1)
> +Description: The GNU [EMAIL PROTECTED]@

This is a versioned conflict for an outdated package of insight.

> -ifeq ($(DEB_HOST_GNU_CPU),ia64)
> +ifeq ($(DEB_TARGET_GNU_CPU),ia64)
>    arch_config_args := --with-libunwind
>  endif

That's not going to work if you don't have a cross copy of libunwind
lying around.  Does it even build cross?

> +ifneq ($(DEB_CROSS),yes)
>  DEB_MAKE_BUILD_TARGET = all info
> +else
> +DEB_MAKE_BUILD_TARGET = all
> +endif

Why not ship a manual with cross-gdb?

>  #    # For snapshots this is appropriate; careful of release tarballs
>  #    # which include .gmo files.
>  #    find -type f -name '*.gmo' | xargs rm -f
>  
>       rm -f check-stamp
> +     cat debian/control.in \
> +             | sed "s/@kfreebsd@/`type-handling any kfreebsd-gnu`/g" \
> +             | sed "s/@gnu@/`type-handling any gnu`/g" \
> +             | sed "s/@TP@/$(TP)/g;s/@TS@/$(TS)/g;s/@TA@/ 
> ($(DEB_TARGET_ALIAS))/g" \
> +             | sed "s/ ()//g" \
> +             | sed "s/@MAINTAINER@/$(MAINTAINER)/g" \
> +             > debian/control

Why'd you need to move this?

> diff -Nru gdb-6.3/gdb/solib.c gdb-6.3.cross/gdb/solib.c
> --- gdb-6.3/gdb/solib.c       2004-09-11 12:24:50.000000000 +0200
> +++ gdb-6.3.cross/gdb/solib.c 2005-06-13 08:56:50.660726488 +0200

You modified the patch-apply rules, so I hope that you noticed that the
Debian GDB package does not include any other changes to the source
tree except as quilt patches.

> +  /* Search PATH and LD_LIBRARY_PATH only for native GDB.  */
> +  if (strcmp (host_name, target_name) != 0)
> +    {
> +      /* If not found, next search the inferior's $PATH environment 
> variable. */
> +      if (found_file < 0 && solib_absolute_prefix == NULL)
> +     found_file = openp (get_in_environ (inferior_environ, "PATH"),
> +                         OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY, 0,
> +                         &temp_pathname);
> +
> +      /* If not found, next search the inferior's $LD_LIBRARY_PATH 
> +      environment variable. */
> +      if (found_file < 0 && solib_absolute_prefix == NULL)
> +     found_file = openp (get_in_environ (inferior_environ, 
> "LD_LIBRARY_PATH"),
> +                         OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY, 0,
> +                         &temp_pathname);
> +    }
> + 
>    /* Done.  If not found, tough luck.  Return found_file and 
>       (optionally) found_pathname.  */
>    if (found_pathname != NULL && temp_pathname != NULL)

This bit you might be able to submit to upstream GDB.

> @@ -233,7 +242,18 @@
>    bfd *abfd;
>  
>    filename = tilde_expand (so->so_name);
> -
> +  /* Cross development environment.  */
> +  if (strcmp (host_name, target_name) != 0)
> +    {
> +      char *libpart_path = NULL;
> +      if (IS_ABSOLUTE_PATH (filename) && strncmp (filename, solib_crossdir, 
> strlen (solib_crossdir)) != 0 \
> +          && (libpart_path = strstr (filename, "/lib/")))
> +     {
> +       char *temp_filename = concat (solib_crossdir, libpart_path, NULL);
> +          xfree (filename);
> +       filename = temp_filename;
> +     }
> +    }
>    old_chain = make_cleanup (xfree, filename);
>    scratch_chan = solib_open (filename, &scratch_pathname);
>  

This, no way.  See above about --with-sysroot.  And host_name !=
target_name is not a useful test for cross.  And you can't hardcode the
string /lib/ anywhere - consider ia64.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to