-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8c3123
commit 8dc6479
Showing
8 changed files
with
198 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
IDA Pro plugin | ||
Loads a VC/Borland/Dede/GCC/IDA map file into IDA Database. | ||
The ".map" file may be generated during compilation, and contain some of debug info (function names, global variables). | ||
|
||
compiled with IDA 6.1 SDK, compiler - GCC 4.5.0 | ||
This plugin was compiled with IDA 6.2 SDK, compiler - GCC 4.8.0; it is 32-bit. | ||
IDA SDK required small patch to cooperate with that gcc - it is within src. | ||
|
||
See src/LoadMap.cpp for credits, license and changelog. | ||
|
||
Installation: | ||
* Copy LoadMAP.plw to IDA plugins folder | ||
* Open any PE/LE file project | ||
* Click Load MAP with Shift to see options | ||
|
||
Known issues: | ||
Currently it doesn't understand MAP files with 64-bit offsets - new versions of GCC produce files with such long offsets. | ||
WA for this is to just remove excessive zeros from offsets in MAP file before loading it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Fix for ida 6.2 sdk to compile plugins with gcc 4.8 | ||
--- plugin.gcc.mak.orig 2011-09-16 19:04:16 +0000 | ||
+++ plugin.gcc.mak 2014-10-12 20:16:53 +0000 | ||
@@ -18 +18 @@ | ||
-L=$(IDAUNIX)lib/gcc.w32/ | ||
+L=$(IDAUNIX)lib/x86_win_gcc_32/ | ||
@@ -22 +22 @@ | ||
-F=obj/gcc.w32/ | ||
+F=obj/x86_win_gcc_32/ | ||
@@ -35 +35 @@ | ||
-CFLAGS=-I$(I) -DWIN32 -D__NT__ -D__IDP__ -mrtd -mno-cygwin $(__CFLAGS) | ||
+CFLAGS=-I$(I) -DWIN32 -D__NT__ -D__IDP__ -m32 $(__CFLAGS) | ||
@@ -41 +41 @@ | ||
-LDFLAGS=--def ../plugin.def -Wl,--dll -shared -mno-cygwin $(_LDFLAGS) | ||
+LDFLAGS=--def ../plugin.def -Wl,--dll -shared -m32 $(_LDFLAGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
/// Based on the idea of loadmap plugin by Toshiyuki Tega. | ||
/// @author TQN <[email protected]> | ||
/// @author TL <[email protected]> | ||
/// @date 2004.09.11 - 2011.09.13 | ||
/// @date 2004.09.11 - 2012.07.18 | ||
/// @version 1.2 - 2012.07.18 - Loading GCC MAP files, compiling in IDA 6.2 | ||
/// @version 1.1 - 2011.09.13 - Loading Watcom MAP files, compiling in IDA 6.1 | ||
/// @version 1.0 - 2004.09.11 - Initial release | ||
/// @par Copying and copyrights: | ||
|
@@ -15,16 +16,31 @@ | |
/// the Free Software Foundation; either version 2 of the License, or | ||
/// (at your option) any later version. | ||
//////////////////////////////////////////////////////////////////////////////// | ||
#define PLUG_VERSION "1.1" | ||
#define PLUG_VERSION "1.2" | ||
|
||
// standard library headers. | ||
#include <cstdio> | ||
// Makes gcc stdlib to not define non-underscored versions of non-ANSI functions (ie memicmp, strlwr) | ||
#define _NO_OLDNAMES | ||
#include <cstring> | ||
#undef _NO_OLDNAMES | ||
|
||
// other headers. | ||
#include "MAPReader.h" | ||
#include "stdafx.h" | ||
|
||
#define USE_STANDARD_FILE_FUNCTIONS | ||
#define USE_DANGEROUS_FUNCTIONS | ||
|
||
// IDA SDK Header Files | ||
#include <ida.hpp> | ||
#include <idp.hpp> | ||
#include <loader.hpp> | ||
#include <bytes.hpp> | ||
#include <name.hpp> | ||
#include <entry.hpp> | ||
#include <fpro.h> | ||
|
||
typedef struct _tagPLUGIN_OPTIONS { | ||
bool bNameApply; //< true - apply to name, false - apply to comment | ||
bool bReplace; //< replace the existing name or comment | ||
|
@@ -46,29 +62,17 @@ static char g_szLoadMapSection[] = "LoadMap"; | |
static char g_szOptionsKey[] = "Options"; | ||
/// @} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
/// @brief Changes extension in given file name buffer | ||
/// @return void | ||
/// @author TL | ||
/// @date 2011.08.07 | ||
//////////////////////////////////////////////////////////////////////////////// | ||
static void pathExtensionSwitch(char * fname, const char * newext, size_t fnbuf_len) | ||
void linearAddressToSymbolAddr(MapFile::MAPSymbol &sym, unsigned long linear_addr) | ||
{ | ||
size_t len,extlen; | ||
char * target; | ||
char * mintarget; | ||
len = std::strlen(fname); | ||
target = std::strrchr(fname,'.'); | ||
mintarget = std::strpbrk(fname,":\\/"); | ||
if ( (target == NULL) || (target <= mintarget) ) | ||
target = fname+len; | ||
extlen = std::strlen(newext); | ||
// If end of the buffer | ||
if (target+extlen+1 >= fname+fnbuf_len) | ||
return; | ||
qstrncpy(target, newext, extlen+1); | ||
sym.seg = segs.get_area_num(linear_addr); | ||
segment_t * sseg = getnseg((int) sym.seg); | ||
if (sseg != NULL) | ||
sym.addr = linear_addr - sseg->startEA; | ||
else | ||
sym.addr = -1; | ||
} | ||
|
||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
/// @brief Output a formatted string to messages window [analog of printf()] | ||
/// only when the verbose flag of plugin's options is true | ||
|
@@ -275,7 +279,7 @@ void idaapi run(int /* arg */) | |
MapFile::ParseResult parsed; | ||
prvsym.seg = sym.seg; | ||
prvsym.addr = sym.addr; | ||
qstrncpy(prvsym.name,sym.name,sizeof(sym.name)); | ||
strncpy(prvsym.name,sym.name,sizeof(sym.name)); | ||
sym.seg = SREG_NUM; | ||
sym.addr = BADADDR; | ||
sym.name[0] = '\0'; | ||
|
@@ -294,6 +298,9 @@ void idaapi run(int /* arg */) | |
case MapFile::WATCOM_MAP: | ||
parsed = parseWatcomSymbolLine(sym,pLine,lineLen,g_minLineLen,numOfSegs); | ||
break; | ||
case MapFile::GCC_MAP: | ||
parsed = parseGccSymbolLine(sym,pLine,lineLen,g_minLineLen,numOfSegs); | ||
break; | ||
} | ||
|
||
if (parsed == MapFile::SKIP_LINE) | ||
|
@@ -404,7 +411,7 @@ void idaapi run(int /* arg */) | |
else | ||
{ | ||
// Save file name for next askfile_c dialog | ||
qstrncpy(mapFileName, fname, sizeof(mapFileName)); | ||
strncpy(mapFileName, fname, sizeof(mapFileName)); | ||
|
||
// Show the result | ||
msg("Result of loading and parsing the Map file '%s'\n" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.