Pwrcdr87
Pwrcdr87

Reputation: 965

No Symbol Table using GDB on Compiled Programs

Let me preface this by stating this is for a project for my first C programming class. I'm not going to give my code since it is working, but just need assistance with an error I receive from GDB during execution.

With that said, the first portion of my project was to write a program that will take any file in byte form, and locate strings of a certain length. This works. The next portion is I'm provided (3) compiled C files and I need to use GDB along with a hex editor and my program to figure out the hidden password to unlock the program. I got the first one, but the second and third are increasing in difficulty and I can't figure out what I'm doing wrong.

Here is my issue:

When I use GDB to start running the compiled file, I'm immediately met with a blinking cursor in GDB. I press cntrl c to interrupt the program which pauses the program in its tracks. I then enter back and get a list of (9) lines, their memory locations, and the names of their methods. Here is where my problem lies, if I want to go to main(), and I try to enter a break, it tells me No symbol table is loaded. Use the "file" command.

Starting program: [program path on university server] 
^C
Program received signal SIGINT, Interrupt.
0x00110430 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-
1.132.el6_5.3.i686
(gdb) list
No symbol table is loaded.  Use the "file" command.
(gdb) back
#0  0x00110430 in __kernel_vsyscall ()
#1  0x00c8f8d3 in __read_nocancel () from /lib/libc.so.6
#2  0x00c2972b in _IO_new_file_underflow () from /lib/libc.so.6
#3  0x00c2b44b in _IO_default_uflow_internal () from /lib/libc.so.6
#4  0x00c2ca5a in __uflow () from /lib/libc.so.6
#5  0x00c1f36c in _IO_getline_info_internal () from /lib/libc.so.6
#6  0x00c1f2b1 in _IO_getline_internal () from /lib/libc.so.6
#7  0x00c1e1ea in fgets () from /lib/libc.so.6
#8  0x0804851c in main ()
(gdb) 

I've looked at other threads like gdb: "No symbol table is loaded" and I don't think that this pertains to me since the files I'm attempting to "crack" are already compiled and provided to me. So I'm not exactly debugging a C source file, but the compressed file after.

This is my struggle right now, and would appreciate any explanation or help with how I can solve the No symbol table is loaded. issue I'm having.

Upvotes: 4

Views: 10589

Answers (1)

Employed Russian
Employed Russian

Reputation: 213375

The No symbol table loaded message you are getting is misleading: all GDB is telling you is that your binary does not have any debugging info in it.

Usually this is solved by rebuilding the binary with -g flag, but since you are given an already compiled and linked file, you can't do that.

Without debug info, certain commands, such as list, break file.c:line, or break line will not work. But other commands, such as: disassemble and break function will work, and that's the commands you'll have to use for this assignment.

Is there a command list of codes that are available and not available

Not that I am aware of. But you can deduce what that list is from understanding what debugging info contains.

Debugging info generally contains:

  1. Mapping from code address (i.e. program counter) to source file and line number. (Without such mapping, list and break foo.c:123 can't work.)
  2. Types and names of local and global variables. (Without this, ptype and whatis and info locals can't work.)
  3. Location of local variables and parameters on the stack. (Again info locals, print a_local_var, print &a_local_var can't work.)

Upvotes: 10

Related Questions