ddd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /bin/bash: ... cannot execute binary file


From: Geert Vancompernolle
Subject: Re: /bin/bash: ... cannot execute binary file
Date: Fri, 02 Mar 2007 19:17:31 +0100
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)

Sorry, my mistake.

Since the FoxBoard is using gdb-cris as target and DDD is default set to i486-linux-gnu, it simply can't work.

Solution is of course to invoke the debugger with the "--debugger gdb-cris" command.

Best rgds,

--Geert

Geert Vancompernolle wrote:
Hi,

I recently installed DDD to debug an application running on a separate target (FoxBoard, in case it's known to you).

The FoxBoard is running Linux and has the IP address 192.168.123.135.

I'm running gdbserver on the FoxBoard like this:  "gdbserver 192.168.123.135:2345"

My Linux environment is Kubuntu 6.10 running in a VmWare session on a Windows XP - Home Edition - SP2 installed system.

I compile my application (consisting of a few c-files) with the following makefile:


AXIS_USABLE_LIBS = GLIBC

AXIS_DEBUG = debug

include $(AXIS_TOP_DIR)/tools/build/Rules.axis

PROGRAM   = main

OBJS     := main.o
OBJS     += i2cexample.o
#OBJS     += ioexpander.o
#OBJS     += i2chal.o

INSTDIR   = $(prefix)/usr/bin

#OPTIONS   = -static

# pull in dependency info for *existing* .o files
-include $(OBJS:.o=.d)

# more complicated dependency computation, so all prereqs listed
# will also become command-less, prereq-less targets
#   sed:    strip the target (everything before colon)
#   sed:    remove any continuation backslashes
#   fmt -1: list words one per line
#   sed:    strip leading spaces
#   sed:    add trailing colons
%.o: %.c
    @echo " ==> Busy building target \"$<\"..."
    $(CC) $(CFLAGS) -c $< -o $@
    $(CC) -MM $(CFLAGS) $*.c > $*.d
    @mv -f $*.d $*.d.tmp
    @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
    @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
      sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
    @rm -f $*.d.tmp   
    @echo
   
%.o: %.cpp
    @echo " ==> Busy building target \"$<\"..."
    $(CXX) $(CFLAGS) -c $< -o $@
    $(CXX) -MM $(CFLAGS) $*.cpp > $*.d
    @mv -f $*.d $*.d.tmp
    @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
    @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
      sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
    @rm -f $*.d.tmp
    @echo
   

all: pre-build main-build post-build

pre-build:
    @echo
    @echo "*********************************************************"
    @echo "  Testing if .target-makefrag exists..."
    @echo "*********************************************************"
    @echo
    @if [ ! -f .target-makefrag  ] ; \
    then echo ; \
         @echo "*********************************************************" ; \
         @echo "  Didn't exist, busy creating the file..." ; \
         @echo "*********************************************************" ; \
         @echo ; \
         make cris-axis-linux-gnu ; \
         @echo ; \
         @echo "*********************************************************" ; \
         @echo "  Now continue with the real build..." ; \
         @echo "*********************************************************" ; \
         @echo ; \
    fi

# link
main-build: $(OBJS)
    @echo " ==> Linking..."
    @echo "Libs:" $(LDLIBS)
    $(CC) $(CFLAGS) $(OPTIONS) $(LDFLAGS) $^ $(LDLIBS) -o $(PROGRAM)   

post-build:
    @echo
    @echo "*********************************************************"
    @echo " Stripping application \"$(PROGRAM)\" before sending to FoxBoard..."
    @echo "*********************************************************"
    @echo
#    cris-strip --strip-unneeded $(PROGRAM)
    @echo
    @echo "*********************************************************"
    @echo "  Build finished, now sending \"$(PROGRAM)\" to FoxBoard..."
    @echo "*********************************************************"
    @echo
    foxy $(PROGRAM)   
    @echo
    @echo "*********************************************************"
    @echo "  \"$(PROGRAM)\" sent via FTP to the FoxBoard..."
    @echo "*********************************************************"

install: $(PROGRAM)
    $(INSTALL) -p -o root -g root -m 0777 $(PROGRAM) $(INSTDIR)

clean:
    rm -f $(PROGRAM) *.o *.d core

That all works fine, my target is generated on the Linux PC and at the end, I'm transferring the executable to the FoxBoard via an FTP script.

I can run the executable on the FoxBoard without any problems.

When I want to debug my application on the FoxBoard, I'm typing the following command in a terminal window:

gdbserver 192.168.123.135:2345

I get the following feedback from the FoxBoard on the terminal:

address@hidden /root]140# gdbserver 192.168.123.135:2345 /domotics/main
Process /domotics/main created; pid = 190
Listening on port 2345

Then I start DDD in my Linux environment.  I first load the program, which results in loading the code into DDD.  So far, so good.

The next step is typing "target remote 192.168.123.135:2345" into the debug window of DDD. 

This results in an additional line in the FoxBoard terminal window, saying:

address@hidden /root]140# gdbserver 192.168.123.135:2345 /domotics/main
Process /domotics/main created; pid = 190
Listening on port 2345
Remote debugging from host 192.168.123.193

So, there's clearly a good communication channel set up between DDD and the FoxBoard.

The next command I give in the debug window of DDD, is "break main", to put a breakpoint in the very beginning of the program.

Next to this, I'm typing the command "run" to start the debug session (assuming the session would stop in the very beginning of the program).

However, I get the following error message instead in the debug window of DDD (hope the picture will be part of the email, since I can't copy/paste the message from the DDD debug window into my email):



As one can see, there's a message saying "cannot execute binary file", the moment I want to run the application.  When I look to the permissions of the main program on my Linux machine, it's set to 0755, so it's executable for everybody.

Why this error?  Can somebody help me with this?

Thanks in advance and best regards,

--Geert

_______________________________________________ Ddd mailing list address@hidden http://lists.gnu.org/mailman/listinfo/ddd

reply via email to

[Prev in Thread] Current Thread [Next in Thread]