public Symbol(ref RawSymbol R) { name = R.field6; if (name != "foo") { address = R.field1; section = R.field4; try { dimension = Convert.ToInt16(R.field5, 16); } catch { dimension = 0; } } }
private void openFileDialog3_FileOk(object sender, CancelEventArgs e) { Process p; ProcessStartInfo p_info; // System.IO.StreamReader fileBase; StreamWriter filedump; StreamWriter filebss; StreamWriter filecalib; // string output = null ; string line = null; StreamReader SR; RawSymbol C; Symbol S; string dumpline; Containr = new Cont(); filedump = new System.IO.StreamWriter(@"d:/tmp/objdump.temp"); filebss = new System.IO.StreamWriter(@"d:/tmp/objdump.bss"); filecalib = new System.IO.StreamWriter(@"d:/tmp/objdump.calib"); /* Retrieve filename */ OBJfilePath = openFileDialog3.FileName; textBox3.Text = OBJfilePath; /* Create symbol tabel using objdump */ p = new Process(); p_info = p.StartInfo; p_info.RedirectStandardOutput = true; p_info.UseShellExecute = false; p_info.FileName = "objdump.exe"; p_info.Arguments = "-x " + OBJfilePath; p.Start(); SR = p.StandardOutput; line = SR.ReadLine(); if (line != null) { do { line = SR.ReadLine(); C = new RawSymbol(ref line); S = new Symbol(ref C); if (S.section == ".bss") { S.section = "bss"; Containr.SymbolBssList.Add(S); dumpline = S.ConvertToLine(); if (dumpline != null) { filebss.WriteLine(dumpline); } } else if (S.section == ".calibu") { S.section = "cal"; Containr.SymbolCalList.Add(S); dumpline = S.ConvertToLine(); if (dumpline != null) { filecalib.WriteLine(dumpline); } } dumpline = S.ConvertToLine(); if (dumpline != null) { filedump.WriteLine(dumpline); } } while (line != null); } p.WaitForExit(); // MessageBox.Show(output); filedump.Close(); filebss.Close(); filecalib.Close(); MessageBox.Show("Symbol table created"); Containr.SymbolTableExists = true; }