LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-08-2015, 12:38 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
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.
 
Old 03-08-2015, 12:57 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
You are not adding debug information.
Try adding "--gstabs" to the as command.
 
1 members found this post helpful.
Old 03-08-2015, 03:08 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
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?
 
Old 03-08-2015, 03:14 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,774

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
You can't use Linux system calls on Cygwin.
 
1 members found this post helpful.
Old 03-08-2015, 04:48 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Thumbs down

aLL right. Do you know a BIOS quick reference for the int calls?
 
Old 03-08-2015, 05:03 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,774

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

I don't think BIOS interrupts work under Cygwin/Windows either.
 
Old 03-08-2015, 06:43 PM   #7
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
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?
 
Old 03-08-2015, 07:01 PM   #8
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,774

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
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.
 
Old 03-08-2015, 07:17 PM   #9
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
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.
 
Old 03-08-2015, 07:47 PM   #10
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,774

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Quote:
Originally Posted by stf92 View Post
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?
 
Old 03-08-2015, 07:54 PM   #11
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Very simply. Still the x86 architecture provides for 16-bit segment registers. This is a 64KB address space.
 
Old 03-08-2015, 09:06 PM   #12
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,774

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
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).
 
Old 03-09-2015, 12:53 AM   #13
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
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
 
Old 03-09-2015, 05:54 AM   #14
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Quote:
Originally Posted by ntubski View Post
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.
 
Old 03-09-2015, 07:17 AM   #15
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] No symbol table is loaded. Use the "file" command. when setting breakpoints hjc Linux - Newbie 4 04-05-2018 07:36 AM
gdb: a symbol to represent the current line. stf92 Programming 2 08-13-2011 07:09 PM
Library can not be loaded as symbol is missing alaios Linux - Software 16 08-13-2010 04:16 AM
No symbol/function name appears in GDB output and it prints ?? instead jaianand Linux - Newbie 3 05-15-2009 04:59 PM
"No symbol table is loaded." when ddd is remote debugging with gdbserver powah Linux - Software 1 01-18-2008 09:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration