Looks like the shell nm command will work on .exe files if they are not stripped.
(Freebasic strips the .exe)
But plain gcc (as in Dev-c++), doesn't strip the .exe.
I tested on pascal .exe files, but
nm: hello.exe: File format not recognized
is given.
Code: Select all
function pipeout(byval s as string="") byref as string
var f=freefile
dim as string tmp
Open Pipe s For Input As #f
s=""
Do Until EOF(f)
Line Input #f,tmp
s+=tmp+chr(10)
Loop
close #f
return s
end function
function look(filename as string,switch as string="") as string
return pipeout( "nm "+ " "+switch+" "+filename)
end function
var info= look ("hello.exe") 'compiled by a c compiler, unstripped .exe
print info
sleep
'============================
/' SWITCHES
-A
prefixes each line with the file name or archive member name.
-a
displays all symbols, including line number entries on systems which support them.
-e
displays only global (external) and static symbols.
-f
displays full output. This is the default, since this implementation does not suppress any output.
-g
displays only global symbols.
-n
is equivalent to -v.
-o
displays output in octal (same as -t o).
-P
displays output in a portable POSIX-compliant format, with blanks separating the output fields. If you specified -A and file is not a library, the format is
file: name type value size
If you specified -A and file is a library, the format is
file[object_file]: name type value size
where object_file is the object file in the library which contains the symbol being described. If you did not specify -A, the format is
name type value size
If you did not also specify the -t option, nm displays value and size in hexadecimal.
If you did not specify -A and the command line contains more than one file, or file is a library, nm displays a line preceding the list of symbols for each specified file or each object file in a specified library. If file is a library, this line has the following format:
file[object_file]:
If file is not a library, the format is simply
file:
-p
does not sort output.
-r
reverses sort order.
-s
includes symbol size for each symbol.
-t format
defines the numeric value formatting base. The format shall be one of d, o, or x, for decimal, octal, or hexadecimal, respectively. If this option is not used, numbers are displayed in decimal.
-u
displays only undefined symbols.
-v
sorts output by value.
-x
displays information in hexadecimal (same as -t x).
'/
So ghidra doesn't seem to need the symbols (if stripped)