projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
merge from trunk at 97714
[mono.git]
/
mono
/
metadata
/
debug-mono-symfile.c
diff --git
a/mono/metadata/debug-mono-symfile.c
b/mono/metadata/debug-mono-symfile.c
index 0cdb5ffcd9a680858d02c2c5c67c830d1143e146..000f9b8ef1635a712530cc7e319bf571c817be96 100644
(file)
--- a/
mono/metadata/debug-mono-symfile.c
+++ b/
mono/metadata/debug-mono-symfile.c
@@
-4,7
+4,9
@@
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#include <sys/param.h>
+#endif
#include <sys/stat.h>
#include <mono/metadata/metadata.h>
#include <mono/metadata/tabledefs.h>
#include <sys/stat.h>
#include <mono/metadata/metadata.h>
#include <mono/metadata/tabledefs.h>
@@
-21,7
+23,9
@@
#include <mono/metadata/class-internals.h>
#include <fcntl.h>
#include <mono/metadata/class-internals.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#include <unistd.h>
+#endif
#define RANGE_TABLE_CHUNK_SIZE 256
#define CLASS_TABLE_CHUNK_SIZE 256
#define RANGE_TABLE_CHUNK_SIZE 256
#define CLASS_TABLE_CHUNK_SIZE 256
@@
-59,7
+63,7
@@
load_symfile (MonoDebugHandle *handle, MonoSymbolFile *symfile, gboolean in_the_
guint64 magic;
long version;
guint64 magic;
long version;
- ptr = start = symfile->raw_contents;
+ ptr = start =
(const char*)
symfile->raw_contents;
if (!ptr)
return FALSE;
if (!ptr)
return FALSE;
@@
-73,7
+77,7
@@
load_symfile (MonoDebugHandle *handle, MonoSymbolFile *symfile, gboolean in_the_
version = read32(ptr);
ptr += sizeof(guint32);
version = read32(ptr);
ptr += sizeof(guint32);
- if (
version != MONO_SYMBOL_FILE_VERSION
) {
+ if (
(version != MONO_SYMBOL_FILE_VERSION) && (version != MONO_SYMBOL_FILE_COMPATIBILITY_VERSION)
) {
if (!in_the_debugger)
g_warning ("Symbol file %s has incorrect version "
"(expected %d, got %ld)", symfile->filename,
if (!in_the_debugger)
g_warning ("Symbol file %s has incorrect version "
"(expected %d, got %ld)", symfile->filename,
@@
-93,6
+97,8
@@
load_symfile (MonoDebugHandle *handle, MonoSymbolFile *symfile, gboolean in_the_
return FALSE;
}
return FALSE;
}
+ symfile->version = version;
+
symfile->offset_table = (MonoSymbolFileOffsetTable *) ptr;
symfile->method_hash = g_hash_table_new_full (
symfile->offset_table = (MonoSymbolFileOffsetTable *) ptr;
symfile->method_hash = g_hash_table_new_full (
@@
-113,14
+119,15
@@
mono_debug_open_mono_symbols (MonoDebugHandle *handle, const guint8 *raw_content
symfile = g_new0 (MonoSymbolFile, 1);
if (raw_contents != NULL) {
symfile = g_new0 (MonoSymbolFile, 1);
if (raw_contents != NULL) {
+ unsigned char *p;
symfile->raw_contents_size = size;
symfile->raw_contents_size = size;
- symfile->raw_contents = g_malloc (size);
- memcpy
(symfile->raw_contents
, raw_contents, size);
+ symfile->raw_contents =
p =
g_malloc (size);
+ memcpy
(p
, raw_contents, size);
symfile->filename = g_strdup_printf ("LoadedFromMemory");
} else {
symfile->filename = g_strdup_printf ("%s.mdb", mono_image_get_filename (handle->image));
symfile->filename = g_strdup_printf ("LoadedFromMemory");
} else {
symfile->filename = g_strdup_printf ("%s.mdb", mono_image_get_filename (handle->image));
- if ((f = fopen (symfile->filename, "rb"))
> 0
) {
+ if ((f = fopen (symfile->filename, "rb"))) {
struct stat stat_buf;
if (fstat (fileno (f), &stat_buf) < 0) {
struct stat stat_buf;
if (fstat (fileno (f), &stat_buf) < 0) {
@@
-211,7
+218,7
@@
mono_debug_symfile_lookup_location (MonoDebugMethodInfo *minfo, guint32 offset)
MonoSymbolFileLineNumberEntry *lne;
MonoSymbolFile *symfile;
gchar *source_file = NULL;
MonoSymbolFileLineNumberEntry *lne;
MonoSymbolFile *symfile;
gchar *source_file = NULL;
- const char *ptr;
+ const
unsigned
char *ptr;
int count, i;
if ((symfile = minfo->handle->symfile) == NULL)
int count, i;
if ((symfile = minfo->handle->symfile) == NULL)
@@
-224,7
+231,7
@@
mono_debug_symfile_lookup_location (MonoDebugMethodInfo *minfo, guint32 offset)
(read32(&(minfo->entry->_source_index)) - 1) * sizeof (MonoSymbolFileSourceEntry);
MonoSymbolFileSourceEntry *se = (MonoSymbolFileSourceEntry *) (symfile->raw_contents + offset);
(read32(&(minfo->entry->_source_index)) - 1) * sizeof (MonoSymbolFileSourceEntry);
MonoSymbolFileSourceEntry *se = (MonoSymbolFileSourceEntry *) (symfile->raw_contents + offset);
- source_file = read_string (symfile->raw_contents + read32(&(se->_name_offset)));
+ source_file = read_string (
(const char*)
symfile->raw_contents + read32(&(se->_name_offset)));
}
ptr = symfile->raw_contents + read32(&(minfo->entry->_line_number_table_offset));
}
ptr = symfile->raw_contents + read32(&(minfo->entry->_line_number_table_offset));
@@
-262,11
+269,13
@@
_mono_debug_address_from_il_offset (MonoDebugMethodJitInfo *jit, guint32 il_offs
for (i = jit->num_line_numbers - 1; i >= 0; i--) {
MonoDebugLineNumberEntry lne = jit->line_numbers [i];
for (i = jit->num_line_numbers - 1; i >= 0; i--) {
MonoDebugLineNumberEntry lne = jit->line_numbers [i];
+ if (lne.il_offset < 0)
+ continue;
if (lne.il_offset <= il_offset)
return lne.native_offset;
}
if (lne.il_offset <= il_offset)
return lne.native_offset;
}
- return
-1
;
+ return
0
;
}
static int
}
static int
@@
-314,9
+323,7
@@
mono_debug_symfile_lookup_method (MonoDebugHandle *handle, MonoMethod *method)
minfo->num_il_offsets = read32(&(me->_num_line_numbers));
minfo->il_offsets = (MonoSymbolFileLineNumberEntry *)
(symfile->raw_contents + read32(&(me->_line_number_table_offset)));
minfo->num_il_offsets = read32(&(me->_num_line_numbers));
minfo->il_offsets = (MonoSymbolFileLineNumberEntry *)
(symfile->raw_contents + read32(&(me->_line_number_table_offset)));
- minfo->num_lexical_blocks = read32(&(me->_num_lexical_blocks));
- minfo->lexical_blocks = (MonoSymbolFileLexicalBlockEntry *)
- (symfile->raw_contents + read32(&(me->_lexical_block_table_offset)));
+
minfo->entry = me;
g_hash_table_insert (symfile->method_hash, method, minfo);
minfo->entry = me;
g_hash_table_insert (symfile->method_hash, method, minfo);