Mono.Debugger.Backend.Bfd.GetSectionContents C# (CSharp) Method

GetSectionContents() private method

private GetSectionContents ( IntPtr section ) : byte[]
section System.IntPtr
return byte[]
        byte[] GetSectionContents(IntPtr 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)) {
                    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;
            } finally {
                Marshal.FreeHGlobal (data);
            }
        }

Same methods

Bfd::GetSectionContents ( string name ) : byte[]

Usage Example

Esempio n. 1
0
 object get_section_contents(object user_data)
 {
     byte[] data = bfd.GetSectionContents(section);
     if (data == null)
     {
         throw new SymbolTableException("Can't get bfd section {0}", name);
     }
     return(new TargetReader(data, bfd.info));
 }