Author: martin
Date: 2007-08-22 12:00:44 -0400 (Wed, 22 Aug 2007)
New Revision: 84645

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/backend/arch/Bfd.cs
   trunk/debugger/backend/arch/BfdContainer.cs
   trunk/debugger/backend/arch/CoreFile.cs
   trunk/debugger/backend/arch/DwarfReader.cs
   trunk/debugger/backend/arch/bfdglue.c
   trunk/debugger/backend/arch/bfdglue.h
Log:
2007-08-22  Martin Baulig  <[EMAIL PROTECTED]>

        * backend/arch/Bfd.cs
        (Bfd): Several bug fixes; mostly for core files.
        (Bfd.LookupLocalSymbol): New public method.
        (bfd.FindSection): New internal method.

        * backend/arch/BfdContainer.cs
        (BfdContainer.LookupLibrary): New public method.
        (BfdContainer.FindLibrary): New public method.

        * backend/arch/CoreFile.cs: Make this work again.

        * backend/arch/bfdglue.c
        (bfd_glue_get_errormsg): New public function.
        (bfd_glue_get_section_size): Removed the `raw_section' argument.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2007-08-22 15:55:26 UTC (rev 84644)
+++ trunk/debugger/ChangeLog    2007-08-22 16:00:44 UTC (rev 84645)
@@ -1,5 +1,22 @@
 2007-08-22  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * backend/arch/Bfd.cs
+       (Bfd): Several bug fixes; mostly for core files.
+       (Bfd.LookupLocalSymbol): New public method.
+       (bfd.FindSection): New internal method.
+
+       * backend/arch/BfdContainer.cs
+       (BfdContainer.LookupLibrary): New public method.
+       (BfdContainer.FindLibrary): New public method.
+
+       * backend/arch/CoreFile.cs: Make this work again.
+
+       * backend/arch/bfdglue.c
+       (bfd_glue_get_errormsg): New public function.
+       (bfd_glue_get_section_size): Removed the `raw_section' argument.
+
+2007-08-22  Martin Baulig  <[EMAIL PROTECTED]>
+
        * languages/mono/MonoLanguageBackend.cs: Reflect latest runtime
        changes; the method range entries are now stored on a per-domain
        basis and are free'ed when the domain gets unloaded.  Add support

Modified: trunk/debugger/backend/arch/Bfd.cs
===================================================================
--- trunk/debugger/backend/arch/Bfd.cs  2007-08-22 15:55:26 UTC (rev 84644)
+++ trunk/debugger/backend/arch/Bfd.cs  2007-08-22 16:00:44 UTC (rev 84645)
@@ -25,6 +25,7 @@
                TargetAddress entry_point = TargetAddress.Null;
                bool is_loaded;
                Hashtable symbols;
+               Hashtable local_symbols;
                ArrayList simple_symbols;
                BfdSymbolTable simple_symtab;
                DwarfReader dwarf;
@@ -64,7 +65,7 @@
 
                                this.name = bfd_glue_get_section_name (section);
                                this.vma = bfd_glue_get_section_vma (section);
-                               this.size = bfd_glue_get_section_size (section, 
true);
+                               this.size = bfd_glue_get_section_size (section);
                                this.flags = bfd_glue_get_section_flags 
(section);
 
                                contents = new ObjectCache (
@@ -73,7 +74,7 @@
 
                        object get_section_contents (object user_data)
                        {
-                               byte[] data = bfd.GetSectionContents (section, 
true);
+                               byte[] data = bfd.GetSectionContents (section);
                                if (data == null)
                                        throw new SymbolTableException ("Can't 
get bfd section {0}", name);
                                return new TargetReader (data, bfd.info);
@@ -82,7 +83,7 @@
                        public TargetReader GetReader (TargetAddress address)
                        {
                                TargetReader reader = (TargetReader) 
contents.Data;
-                               reader.Offset = address.Address - vma;
+                               reader.Offset = address.Address - 
bfd.BaseAddress.Address - vma;
                                return reader;
                        }
 
@@ -103,6 +104,9 @@
                extern static bool bfd_close (IntPtr bfd);
 
                [DllImport("monodebuggerserver")]
+               extern static string bfd_glue_get_errormsg ();
+
+               [DllImport("monodebuggerserver")]
                extern static string bfd_glue_get_target_name (IntPtr bfd);
 
                [DllImport("monodebuggerserver")]
@@ -145,7 +149,7 @@
                extern static string bfd_glue_get_section_name (IntPtr section);
 
                [DllImport("monodebuggerserver")]
-               extern static int bfd_glue_get_section_size (IntPtr section, 
bool raw_section);
+               extern static int bfd_glue_get_section_size (IntPtr section);
 
                [DllImport("monodebuggerserver")]
                extern static SectionFlags bfd_glue_get_section_flags (IntPtr 
section);
@@ -195,6 +199,7 @@
 
                                if (!is_coredump) {
                                        Section text = GetSectionByName 
(".text", true);
+                                       Section bss = GetSectionByName (".bss", 
true);
 
                                        if (!base_address.IsNull)
                                                start_address = new 
TargetAddress (
@@ -203,10 +208,14 @@
                                        else
                                                start_address = new 
TargetAddress (
                                                        info.AddressDomain, 
text.vma);
-                                       end_address = start_address + text.size;
-                               } else {
-                                       start_address = main_bfd.StartAddress;
-                                       end_address = main_bfd.EndAddress;
+
+                                       if (!base_address.IsNull)
+                                               end_address = new TargetAddress 
(
+                                                       info.AddressDomain,
+                                                       base_address.Address + 
bss.vma + bss.size);
+                                       else
+                                               end_address = new TargetAddress 
(
+                                                       info.AddressDomain, 
bss.vma + bss.size);
                                }
 
                                read_bfd_symbols ();
@@ -258,6 +267,7 @@
                        int num_symbols = bfd_glue_get_symbols (bfd, out 
symtab);
 
                        symbols = new Hashtable ();
+                       local_symbols = new Hashtable ();
                        simple_symbols = new ArrayList ();
 
                        for (int i = 0; i < num_symbols; i++) {
@@ -275,9 +285,8 @@
                                        symbols.Add (name, relocated);
                                else if ((main_bfd == null) && name.StartsWith 
("MONO_DEBUGGER__"))
                                        symbols.Add (name, relocated);
-                               else if (name.StartsWith ("__pthread_") ||
-                                        (name == "__libc_pthread_functions"))
-                                       symbols.Add (name, relocated);
+                               else if (!local_symbols.Contains (name))
+                                       local_symbols.Add (name, relocated);
 
                                simple_symbols.Add (new Symbol (name, 
relocated, 0));
                        }
@@ -592,7 +601,7 @@
                        long vma_base = base_address.IsNull ? 0 : 
base_address.Address;
                        Section section = GetSectionByName (".debug_frame", 
false);
                        if (section != null) {
-                               byte[] contents = GetSectionContents 
(section.section, false);
+                               byte[] contents = GetSectionContents 
(section.section);
                                TargetBlob blob = new TargetBlob (contents, 
info);
                                frame_reader = new DwarfFrameReader (
                                        this, blob, vma_base + section.vma, 
false);
@@ -600,7 +609,7 @@
 
                        section = GetSectionByName (".eh_frame", false);
                        if (section != null) {
-                               byte[] contents = GetSectionContents 
(section.section, false);
+                               byte[] contents = GetSectionContents 
(section.section);
                                TargetBlob blob = new TargetBlob (contents, 
info);
                                eh_frame_reader = new DwarfFrameReader (
                                        this, blob, vma_base + section.vma, 
true);
@@ -681,22 +690,41 @@
                        }
                }
 
+               public TargetAddress LookupLocalSymbol (string name)
+               {
+                       if (local_symbols == null)
+                               return TargetAddress.Null;
+
+                       if (local_symbols.Contains (name))
+                               return (TargetAddress) local_symbols [name];
+
+                       return TargetAddress.Null;
+               }
+
+               internal Section FindSection (long address)
+               {
+                       read_sections ();
+                       foreach (Section section in sections) {
+                               long relocated = base_address.Address + 
section.vma;
+
+                               if ((address < relocated) || (address >= 
relocated + section.size))
+                                       continue;
+
+                                       return section;
+                       }
+
+                       return null;
+               }
+
                internal Section this [long address] {
                        get {
-                               read_sections ();
-                               foreach (Section section in sections) {
-                                       if ((address < section.vma) || (address 
>= section.vma + section.size))
-                                               continue;
-
+                               Section section = FindSection (address);
+                               if (section != null)
                                        return section;
-                               }
 
-                               if (main_bfd != null)
-                                       return main_bfd [address];
-
-                               throw new SymbolTableException (String.Format (
+                               throw new SymbolTableException (
                                        "No section in file {1} contains 
address {0:x}.", address,
-                                       filename));
+                                       filename);
                        }
                }
 
@@ -755,10 +783,18 @@
                        return maps;
                }
 
-               public TargetReader GetReader (TargetAddress address)
+               public TargetReader GetReader (TargetAddress address, bool 
may_fail)
                {
-                       Section section = this [address.Address];
-                       return section.GetReader (address);
+                       Section section = FindSection (address.Address);
+                       if (section != null)
+                               return section.GetReader (address);
+
+                       if (may_fail)
+                               return null;
+
+                       throw new SymbolTableException (
+                               "No section in file {1} contains address 
{0:x}.", address,
+                               filename);
                }
 
                public TargetAddress GetSectionAddress (string name)
@@ -773,36 +809,41 @@
                        return GetAddress (vma);
                }
 
-               public byte[] GetSectionContents (string name, bool raw_section)
+               public byte[] GetSectionContents (string name)
                {
                        IntPtr section;
 
                        section = bfd_get_section_by_name (bfd, name);
                        if (section == IntPtr.Zero)
-                               throw new SymbolTableException ("Can't get bfd 
section {0}", name);
+                               throw new SymbolTableException ("Can't find bfd 
section {0}", name);
 
-                       byte[] contents = GetSectionContents (section, 
raw_section);
+                       byte[] contents = GetSectionContents (section);
                        if (contents == null)
-                               throw new SymbolTableException ("Can't get bfd 
section {0}", name);
+                               throw new SymbolTableException ("Can't read bfd 
section {0}", name);
                        return contents;
                }
 
-               public TargetReader GetSectionReader (string name, bool 
raw_section)
+               public TargetReader GetSectionReader (string name)
                {
-                       byte[] contents = GetSectionContents (name, 
raw_section);
+                       byte[] contents = GetSectionContents (name);
                        if (contents == null)
-                               throw new SymbolTableException ("Can't get bfd 
section {0}", name);
+                               throw new SymbolTableException ("Can't read bfd 
section {0}", name);
                        return new TargetReader (contents, info);
                }
 
-               byte[] GetSectionContents (IntPtr section, bool raw_section)
+               byte[] GetSectionContents (IntPtr section)
                {
-                       int size = bfd_glue_get_section_size (section, 
raw_section);
+                       int size = bfd_glue_get_section_size (section);
                        IntPtr data = IntPtr.Zero;
                        try {
                                data = Marshal.AllocHGlobal (size);
-                               if (!bfd_glue_get_section_contents (bfd, 
section, data, size))
-                                       return null;
+                               if (!bfd_glue_get_section_contents (bfd, 
section, data, size)) {
+                                       string error = bfd_glue_get_errormsg ();
+                                       string name = bfd_glue_get_section_name 
(section);
+
+                                       throw new SymbolTableException (
+                                               "Can't read bfd section {0}: 
{1}", name, error);
+                               }
                                byte[] retval = new byte [size];
                                Marshal.Copy (data, retval, 0, size);
                                return retval;
@@ -877,7 +918,7 @@
 
                public bool IsContinuous {
                        get {
-                               return !end_address.IsNull;
+                               return !is_coredump && !end_address.IsNull;
                        }
                }
 
@@ -1026,18 +1067,16 @@
                {
                        Bfd bfd;
                        Symbol[] list;
-                       TargetAddress start, end;
 
                        public BfdSymbolTable (Bfd bfd)
                        {
                                this.bfd = bfd;
-                               this.start = bfd.StartAddress;
-                               this.end = bfd.EndAddress;
                        }
 
                        public Symbol SimpleLookup (TargetAddress address, bool 
exact_match)
                        {
-                               if ((address < start) || (address >= end))
+                               if (bfd.IsContinuous &&
+                                   ((address < bfd.StartAddress) || (address 
>= bfd.EndAddress)))
                                        return null;
 
                                if (list == null) {

Modified: trunk/debugger/backend/arch/BfdContainer.cs
===================================================================
--- trunk/debugger/backend/arch/BfdContainer.cs 2007-08-22 15:55:26 UTC (rev 
84644)
+++ trunk/debugger/backend/arch/BfdContainer.cs 2007-08-22 16:00:44 UTC (rev 
84645)
@@ -39,6 +39,19 @@
                        }
                }
 
+               public Bfd LookupLibrary (TargetAddress address)
+               {
+                       foreach (Bfd bfd in bfd_hash.Values) {
+                               if (!bfd.IsContinuous)
+                                       continue;
+
+                               if ((address >= bfd.StartAddress) && (address < 
bfd.EndAddress))
+                                       return bfd;
+                       }
+
+                       return null;
+               }
+
                internal void SetupInferior (TargetInfo info, Bfd main_bfd)
                {
                        this.main_bfd = main_bfd;
@@ -103,6 +116,16 @@
                        bfd.Dispose ();
                }
 
+               public Bfd FindLibrary (string name)
+               {
+                       foreach (Bfd bfd in bfd_hash.Values) {
+                               if (Path.GetFileName (bfd.FileName) == name)
+                                       return bfd;
+                       }
+
+                       return null;
+               }
+
                //
                // IDisposable
                //

Modified: trunk/debugger/backend/arch/CoreFile.cs
===================================================================
--- trunk/debugger/backend/arch/CoreFile.cs     2007-08-22 15:55:26 UTC (rev 
84644)
+++ trunk/debugger/backend/arch/CoreFile.cs     2007-08-22 16:00:44 UTC (rev 
84645)
@@ -3,6 +3,7 @@
 using System.Collections;
 using System.Runtime.InteropServices;
 using Mono.Debugger.Languages;
+using Mono.Debugger.Languages.Mono;
 
 namespace Mono.Debugger.Backends
 {
@@ -14,6 +15,8 @@
                string application;
                ArrayList threads;
 
+               MonoDebuggerInfo debugger_info;
+
                public static CoreFile OpenCoreFile (ThreadManager manager, 
ProcessStart start)
                {
                        return new CoreFile (manager, start);
@@ -28,6 +31,8 @@
                                info, start.TargetApplication, 
TargetAddress.Null,
                                start.LoadNativeSymbolTable, true);
 
+                       BfdContainer.SetupInferior (info, bfd);
+
                        core_file = start.CoreFile;
                        application = bfd.FileName;
 
@@ -63,14 +68,83 @@
                        read_note_section ();
                        main_thread = (CoreFileThread) threads [0];
 
-                       InitializeModules ();
+                       bfd.UpdateSharedLibraryInfo (null, main_thread);
+
+                       TargetAddress mdb_debug_info = bfd.GetSectionAddress 
(".mdb_debug_info");
+                       if (!mdb_debug_info.IsNull) {
+                               mdb_debug_info = main_thread.ReadAddress 
(mdb_debug_info);
+                               debugger_info = MonoDebuggerInfo.Create 
(main_thread, mdb_debug_info);
+                               read_thread_table ();
+                               CreateMonoLanguage (debugger_info);
+                               mono_language.InitializeCoreFile (main_thread);
+                               mono_language.Update (main_thread);
+                       }
                }
 
-               public void InitializeModules ()
+               void read_thread_table ()
                {
-                       bfd.UpdateSharedLibraryInfo (null, main_thread);
+                       TargetAddress ptr = main_thread.ReadAddress 
(debugger_info.ThreadTable);
+                       Console.WriteLine ("READ THREAD TABLE: {0}", ptr);
+                       while (!ptr.IsNull) {
+                               int size = 56 + 
main_thread.TargetInfo.TargetAddressSize;
+                               TargetReader reader = new TargetReader 
(main_thread.ReadMemory (ptr, size));
+
+                               long tid = reader.ReadLongInteger ();
+                               TargetAddress lmf_addr = reader.ReadAddress ();
+                               TargetAddress end_stack = reader.ReadAddress ();
+
+                               ptr = reader.ReadAddress ();
+
+                               TargetAddress stack_start = reader.ReadAddress 
();
+                               TargetAddress signal_stack_start = 
reader.ReadAddress ();
+                               int stack_size = reader.ReadInteger ();
+                               int signal_stack_size = reader.ReadInteger ();
+
+                               Console.WriteLine ("READ THREAD TABLE #1: {0:x} 
{1} {2} {3} {4} {5} {6}",
+                                                  tid, lmf_addr, end_stack,
+                                                  stack_start, stack_start + 
stack_size,
+                                                  signal_stack_start,
+                                                  signal_stack_start + 
signal_stack_size);
+
+                               bool found = false;
+                               foreach (CoreFileThread thread in threads) {
+                                       TargetAddress sp = 
thread.CurrentFrame.StackPointer;
+
+                                       if ((sp >= stack_start) && (sp < 
stack_start + stack_size)) {
+                                               Console.WriteLine ("SET LMF: 
{0} {1:x} {2}",
+                                                                  thread, tid, 
lmf_addr);
+                                               thread.SetLMFAddress (tid, 
lmf_addr);
+                                               found = true;
+                                               break;
+                                       } else if (!signal_stack_start.IsNull &&
+                                                  (sp >= signal_stack_start) &&
+                                                  (sp < signal_stack_start + 
signal_stack_size)) {
+                                               Console.WriteLine ("SET LMF: 
{0} {1:x} {2}",
+                                                                  thread, tid, 
lmf_addr);
+                                               thread.SetLMFAddress (tid, 
lmf_addr);
+                                               found = true;
+                                               break;
+                                       }
+                               }
+
+                               if (!found)
+                                       Console.WriteLine ("FUCK!");
+                       }
                }
 
+               protected TargetReader GetReader (TargetAddress address)
+               {
+                       TargetReader reader = core_bfd.GetReader (address, 
true);
+                       if (reader != null)
+                               return reader;
+
+                       Bfd bfd = BfdContainer.LookupLibrary (address);
+                       if (bfd != null)
+                               return bfd.GetReader (address, false);
+
+                       return null;
+               }
+
                void read_note_section ()
                {
                        threads = new ArrayList ();
@@ -84,19 +158,14 @@
                                threads.Add (thread);
                        }
 
-                       return;
-
 #if FIXME
-                       TargetReader reader = core_bfd.GetSectionReader 
("note0", true);
+                       TargetReader reader = core_bfd.GetSectionReader 
("note0");
                        while (reader.Offset < reader.Size) {
                                long offset = reader.Offset;
                                int namesz = reader.ReadInteger ();
                                int descsz = reader.ReadInteger ();
                                int type = reader.ReadInteger ();
 
-                               Console.WriteLine ("NOTE: {0} {1} {2} {3:x}", 
offset, namesz,
-                                                  descsz, type);
-
                                string name = null;
                                if (namesz != 0) {
                                        char[] namebuf = new char [namesz];
@@ -110,8 +179,8 @@
                                if (descsz != 0)
                                        desc = reader.BinaryReader.ReadBuffer 
(descsz);
 
-                               Console.WriteLine ("NOTE #1: {0} {1} {2:x} - 
{3} {4}", namesz, descsz,
-                                                  type, name, 
TargetBinaryReader.HexDump (desc));
+                               // Console.WriteLine ("NOTE: {0} {1:x} {2}", 
offset, type, name);
+                               // Console.WriteLine 
(TargetBinaryReader.HexDump (desc));
 
                                reader.Offset += 4 - (reader.Offset % 4);
                        }
@@ -143,8 +212,11 @@
                        Backtrace current_backtrace;
                        StackFrame current_frame;
                        Method current_method;
+                       long tid;
                        int pid;
 
+                       TargetAddress lmf_address = TargetAddress.Null;
+
                        public CoreFileThread (CoreFile core, int pid)
                                : base (core.ThreadManager, core)
                        {
@@ -159,7 +231,7 @@
                        Registers read_registers ()
                        {
                                string sname = String.Format (".reg/{0}", PID);
-                               TargetReader reader = 
CoreFile.CoreBfd.GetSectionReader (sname, true);
+                               TargetReader reader = 
CoreFile.CoreBfd.GetSectionReader (sname);
 
                                Architecture arch = CoreFile.Architecture;
                                long[] values = new long [arch.CountRegisters];
@@ -176,6 +248,12 @@
                                return new Registers (arch, values);
                        }
 
+                       internal void SetLMFAddress (long tid, TargetAddress 
lmf)
+                       {
+                               this.tid = tid;
+                               this.lmf_address = lmf;
+                       }
+
                        internal override ThreadManager ThreadManager {
                                get { return CoreFile.ThreadManager; }
                        }
@@ -197,15 +275,15 @@
                        }
 
                        public override long TID {
-                               get { return -1; }
+                               get { return tid; }
                        }
 
                        public override TargetAddress LMFAddress {
-                               get { return TargetAddress.Null; }
+                               get { return lmf_address; }
                        }
 
                        public override bool IsAlive {
-                               get { return false; }
+                               get { return true; }
                        }
 
                        public override bool CanRun {
@@ -331,27 +409,27 @@
 
                        public override byte ReadByte (TargetAddress address)
                        {
-                               return CoreFile.CoreBfd.GetReader 
(address).ReadByte ();
+                               return CoreFile.GetReader (address).ReadByte ();
                        }
 
                        public override int ReadInteger (TargetAddress address)
                        {
-                               return CoreFile.CoreBfd.GetReader 
(address).ReadInteger ();
+                               return CoreFile.GetReader (address).ReadInteger 
();
                        }
 
                        public override long ReadLongInteger (TargetAddress 
address)
                        {
-                               return CoreFile.CoreBfd.GetReader 
(address).ReadLongInteger ();
+                               return CoreFile.GetReader 
(address).ReadLongInteger ();
                        }
 
                        public override TargetAddress ReadAddress 
(TargetAddress address)
                        {
-                               return CoreFile.CoreBfd.GetReader 
(address).ReadAddress ();
+                               return CoreFile.GetReader (address).ReadAddress 
();
                        }
 
                        public override string ReadString (TargetAddress 
address)
                        {
-                               return CoreFile.CoreBfd.GetReader 
(address).BinaryReader.ReadString ();
+                               return CoreFile.GetReader 
(address).BinaryReader.ReadString ();
                        }
 
                        public override TargetBlob ReadMemory (TargetAddress 
address, int size)
@@ -361,13 +439,13 @@
 
                        public override byte[] ReadBuffer (TargetAddress 
address, int size)
                        {
-                               return CoreFile.CoreBfd.GetReader 
(address).BinaryReader.ReadBuffer (size);
+                               return CoreFile.GetReader 
(address).BinaryReader.ReadBuffer (size);
                        }
 
                        internal override Registers GetCallbackFrame 
(TargetAddress stack_pointer,
                                                                      bool 
exact_match)
                        {
-                               throw new InvalidOperationException ();
+                               return null;
                        }
 
                        public override bool CanWrite {
@@ -456,9 +534,7 @@
                        }
 
                        public override void Kill ()
-                       {
-                               throw new InvalidOperationException ();
-                       }
+                       { }
 
                        public override void Detach ()
                        {
@@ -488,12 +564,12 @@
                        public override string PrintObject (Style style, 
TargetObject obj,
                                                            DisplayFormat 
format)
                        {
-                               throw new InvalidOperationException ();
+                               return style.FormatObject (Thread, obj, format);
                        }
 
                        public override string PrintType (Style style, 
TargetType type)
                        {
-                               throw new InvalidOperationException ();
+                               return style.FormatType (Thread, type);
                        }
 
                        public override void RuntimeInvoke (TargetFunctionType 
function,

Modified: trunk/debugger/backend/arch/DwarfReader.cs
===================================================================
--- trunk/debugger/backend/arch/DwarfReader.cs  2007-08-22 15:55:26 UTC (rev 
84644)
+++ trunk/debugger/backend/arch/DwarfReader.cs  2007-08-22 16:00:44 UTC (rev 
84645)
@@ -698,7 +698,7 @@
                object create_reader_func (object user_data)
                {
                        try {
-                               byte[] contents = bfd.GetSectionContents 
((string) user_data, false);
+                               byte[] contents = bfd.GetSectionContents 
((string) user_data);
                                return new TargetBlob (contents, 
bfd.TargetInfo);
                        } catch {
                                Report.Debug (DebugFlags.DwarfReader,

Modified: trunk/debugger/backend/arch/bfdglue.c
===================================================================
--- trunk/debugger/backend/arch/bfdglue.c       2007-08-22 15:55:26 UTC (rev 
84644)
+++ trunk/debugger/backend/arch/bfdglue.c       2007-08-22 16:00:44 UTC (rev 
84645)
@@ -63,6 +63,8 @@
 
        if ((symbol->flags & (BSF_WEAK | BSF_DYNAMIC)) == (BSF_WEAK | 
BSF_DYNAMIC))
                return NULL;
+       if ((symbol->flags & BSF_DEBUGGING) || !symbol->name || !strlen 
(symbol->name))
+               return NULL;
 
        flags = symbol->flags & ~(BSF_DYNAMIC | BSF_NOT_AT_END);
 
@@ -76,10 +78,12 @@
                *is_function = 1;
                *address = symbol->section->vma + symbol->value;
        } else if (flags == (BSF_OBJECT | BSF_LOCAL)) {
+#if 0
                if (strncmp (symbol->name, "__pthread_", 10) &&
                    strncmp (symbol->name, "MONO_DEBUGGER_", 14) &&
                    strcmp (symbol->name, "__libc_pthread_functions"))
                        return NULL;
+#endif
 
                *is_function = 0;
                *address = symbol->section->vma + symbol->value;
@@ -219,10 +223,16 @@
        return g_strdup (p->name);
 }
 
+gchar *
+bfd_glue_get_errormsg (void)
+{
+       return g_strdup (bfd_errmsg (bfd_get_error ()));
+}
+
 guint32
-bfd_glue_get_section_size (asection *p, gboolean raw_section)
+bfd_glue_get_section_size (asection *p)
 {
-       return raw_section ? p->_raw_size : p->_cooked_size;
+       return p->_raw_size;
 }
 
 BfdGlueSectionFlags

Modified: trunk/debugger/backend/arch/bfdglue.h
===================================================================
--- trunk/debugger/backend/arch/bfdglue.h       2007-08-22 15:55:26 UTC (rev 
84644)
+++ trunk/debugger/backend/arch/bfdglue.h       2007-08-22 16:00:44 UTC (rev 
84645)
@@ -47,6 +47,9 @@
 extern bfd *
 bfd_glue_openr (const char *filename, const char *target);
 
+extern gchar *
+bfd_glue_get_errormsg (void);
+
 extern void
 bfd_glue_setup_disassembler (struct disassemble_info *info, 
BfdGlueReadMemoryHandler read_memory_cb,
                             BfdGlueOutputHandler output_cb, 
BfdGluePrintAddressHandler print_address_cb);
@@ -67,7 +70,7 @@
 bfd_glue_get_section_name (asection *p);
 
 extern guint32
-bfd_glue_get_section_size (asection *p, gboolean raw_section);
+bfd_glue_get_section_size (asection *p);
 
 extern BfdGlueSectionFlags
 bfd_glue_get_section_flags (asection *p);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to