LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   gdb: No symbol table is loaded. (https://www.linuxquestions.org/questions/programming-9/gdb-no-symbol-table-is-loaded-4175536106/)

stf92 03-08-2015 12:38 PM

gdb: No symbol table is loaded.
 
I just installed Cigwin on Windows 7, S.P. 1. How do I get gdb to Access the symbol table? I assemble and link with[code]
as -o t01.o -L t01.S
ld -o t01 t01

This gets a Windows PE ejecutable, which gdb seems to have no trouble in executing. When I issue the list command, it says "No symbol table is loaded", though.

smeezekitty 03-08-2015 12:57 PM

You are not adding debug information.
Try adding "--gstabs" to the as command.

stf92 03-08-2015 03:08 PM

Thanks for that one. What do you think makes this:
Code:

cat t01.S
.data
msg:
.ascii  "Hello world!"
        len = . - msg

.text
        .global _start
_start:

        movl    $len,edx
        movl    $msg,%ecx
        movl    $1,%ebx
        movl    $4,%eax
        int    $0x80

        movl    $0,%ebx
        movl    $1,%eax
        int    $0x80

get segmetation fault?

ntubski 03-08-2015 03:14 PM

You can't use Linux system calls on Cygwin.

stf92 03-08-2015 04:48 PM

aLL right. Do you know a BIOS quick reference for the int calls?

ntubski 03-08-2015 05:03 PM

You could check http://en.wikipedia.org/wiki/BIOS_interrupt_call I guess.

I don't think BIOS interrupts work under Cygwin/Windows either.

stf92 03-08-2015 06:43 PM

I rewrote the program so it reads:
Code:

$ cat h01.S
        .intel_syntax noprefix
.data
msg:
        .ascii  "Hello world! $"
        len = . - msg

.text
        .global _start
_start:

//      org 0x100
        mov dx, offset msg
        mov ah, 9
        int 0x21

        mov ah,0x4c
        int 0x21

Usuario@user-PC ~
$ as -o h01.o h01.S

Usuario@user-PC ~
$ ld -o h01 h01.o
h01.o:fake:(.text+0x2): reubicación truncada para ajustar: 16 contra `.data'

Usuario@user-PC ~
$

All of this runs under Cygwin, which unluckily puts messages not in English. ld message is something like this: relocation truncated to ajust 16 against '.data'. Should I use some sort of an org?

ntubski 03-08-2015 07:01 PM

Would export LANG=C give english messages?

I guess the problem is you're trying to put a 32-bit address into a 16 bit register.

stf92 03-08-2015 07:17 PM

I now have messages i English! Thanks. No. offset msg should be handled by the assembler as a 16-bit displacement, which shure Works in 8086 and following architectures.

ntubski 03-08-2015 07:47 PM

Quote:

Originally Posted by stf92 (Post 5328948)
offset msg should be handled by the assembler as a 16-bit displacement,

How would that work, given you have a 32-bit address space?

stf92 03-08-2015 07:54 PM

Very simply. Still the x86 architecture provides for 16-bit segment registers. This is a 64KB address space.

ntubski 03-08-2015 09:06 PM

You've a made a 32bit exe, therefore the address space is 32 bit.
Quote:

http://en.wikipedia.org/wiki/Segment...protected_mode

In the Intel 80386 and later, ... address offsets are 32-bit (instead of 16-bit), and the segment base in each segment descriptor is also 32-bit (instead of 24-bit).

NevemTeve 03-09-2015 12:53 AM

Actually, Windows is neither linux nor DOS. Windows' system-calls aren't meant to use from user-programs; the standard way is calling Windows API functions from DLL's like KERNEL32.DLL, USER32.DLL, WS2_32.DLL

stf92 03-09-2015 05:54 AM

Quote:

Originally Posted by ntubski (Post 5328993)
You've a made a 32bit exe, therefore the address space is 32 bit.

nEVER mind. One: x86 is downwards compatible, so code written for 8086 will run on 80586 and upwords. Two: you have three ways to run a modern x86: flat, segmented and real (which is also segmented). I think this puts an end to our discussion.

NevemTeve 03-09-2015 07:17 AM

Almost. You should keep in mind that Windows is not DOS. It might contain an DOS-emulator but not every version does.


All times are GMT -5. The time now is 07:36 AM.