This is an archived copy of the http://linux.sparta.com/VxWorks/VxWorks-gdb.html


VxWorks & Linux...the GDB part, x86 target:

WindRiver doesn't support Linux like it supports Solaris, HP-UX, or Windows -- there are no supplied tools. However, Linux has certain attractions, as it's somewhat more stable than Windows, is cheaper, and so forth.

In addition, the use of an x86 BSP is desirable, as a plain old PC (and even an OLD PC, a 386 or 486 that no-one wants any more) can be used adequately. Really all that's needed is a network card and a motherboard and some RAM; the rest (graphics, disk, etc.) isn't required.

If you're interested in debugging under Linux, newer GDB versions are available (4.16/4.17 at the time of this writing). The port is easy for 68k, i960, and other CPUs, because GCC has built-in options for these. Just identify the target as XXX-vxworks, and it builds happily.

The x86 has no such built-in option (gdb 4.16 doesn't, anyway), so some hacking and porting is required.

Table of Contents

  1. What You Need To Get Started
  2. Compiling GDB
  3. Anything Else?

What You Need To Get Started

In order to build multi-target GDB, you need to get the source package: gdb-4.16  or what's current (for reference, Tornado 1.0 used 4.12), available from Metalab.

After compilation, we'll end up with a target-specific binary: i386-wrs-vxworks-gdb.


Compiling GDB

GDB has a configuration script that automatically sets up all of its component parts for compilation based on some switch settings. The ones that are most important for us are the --host and --target switches, as well as --prefix and --exec-prefix. More detail follows.

--host: Gives the name of the host system. If it can't be auto-detected, which sometimes happens under Linux (my system of i686-pc-gnu-linux isn't recognized, but we can fake it as i486-linux, which is).

--target: Gives the name of the target system. This will be i386-wrs-vxworks, indicating the processor, system manufacturer, and OS.

--prefix: Where we want to install libraries and other information starting from. If you don't have root access, or don't want things in /usr/local (the default), use this. We redirect things to $HOME (/home for this discussion) directory.

--exec-prefix: Similar in intention; where the binaries go. The end result is ${exec-prefix}/bin; we want $HOME/bin, so $HOME is used for this as well.

How Configure Is Operating, and How To Make It Work

Configure looks through some files to identify both the target and host systems and determine what information-bearing files should be used. The host files live in the config/ directory; the target files are in varying places.

The first one is for "libiberty", which is a common library containing useful subroutines, and also contains configuration information. It should have a file called "mt-vxworks5", which contains information about what files libiberty needs. No modification is necessary.

The second one is for "bfd", the object file library. This library is used by the debugger, assembler, linker, and pretty much everything else. The important file is config.bfd, which sets some variables containing the "type" of object file (COFF, AOUT, ELF, others), vector sizes, whether to generate underscores, etc. There are some vxworks entries (a29k-*-vxworks, i960-*-vxworks, m68-*-vxworks) already present, but no ix86-*-vxworks. We need to make one.

In the i[3456]86 section, add the following to make a config.bfd file that recognizes x86-vxworks as a target system:

i[3456]86-*-vxworks)
targ_defvec=i386aout_vec
targ_underscore=yes
;;

This says that we're making aout files (which is in agreement with the documentation about vxWorks and x86 BSPs available).

The third one is for "opcodes", which contains the information about opcode names and register usage. No changes are necessary.

The fourth is in "gdb", which is the main source directory. Here we need to make a lot of modifications.

  1. There's no line for x86-*-vxworks in the file configure, so we have to make one:

  2. i[3456]86-*-vxworks) gdb_target=vxi386 ;;
     
  3. Configure looks for config/${cpu}/${gdb_target}.mt. This file (vxi386.mt) doesn't exist, so we have to create it.

  4.  

     
     
     
     
     
     
     

    Here is the configuration:

    # Target: Linux running VxWorks
    TDEPFILES= i386-tdep.o remote-vx.o remote-vx386.o xdr_ld.o xdr_ptrace.o xdr_rdb.o
    TM_FILE= tm-vxi386.h
    vxi386.mt is also available for download.
     
  5. vxi386.tm refers to several files which don't exist: tm-vxi386.h, which contains definitions about what a 386 is, register names, and other things; and remote-vx386.o, which is a source file describing how to download the registers from the remote target.

  6.  

     
     
     
     
     
     
     

    tm-vxi386.h is a lengthy file, so we won't include it here.

    remote-vx386.c is also lengthy.

    regPacket.h is included by remote-vx386.c, and contains definitions about how long the register set is and where specific registers live in it.
     

After these numerous changes are made, we issue the configure command in {}/gdb-4.16/:

==> ./configure --host=i486-linux --target=i386-wrs-vxworks --prefix=/home --exec-prefix=/home

Obviously, substitute for your host, prefix, and exec-prefix.

Wait a bit, as a lot of configuration has to go on. It should eventually terminate with some messages like this:

Created "Makefile" in /home/src/gdb-4.16 using "config/mh-linux"
 
 

Ok, It's Configured. Now What?

Once configuration is complete, it's a simple matter of typing "make; make install", and then being patient.

You should see a binary appear in your {}/bin directory looking like this:

/home/bin/i386-wrs-vxworks-gdb

gdb is now complete.

Thanks to Casey Crellin casey@ccii.co.za for providing the necessary files and information.


Anything Else?

M-x info inside emacs will give you lots of information about how to connect gdb to the remote target, how it operates, and so forth.


Complaints to Webmaster.

VxWorks Under Linux Home Page

Last modified Feb 01, 1999.