; -------------------------------------------------------------------------------- ; @Title: VLX Symbol Autoloader Script ; @Description: Autoload script, called by TRACE32 if symbols are to be loaded ; @Keywords: VLX ; @Author: DIE ; @Copyright: (c) 1989-2014 Lauterbach GmbH, licensed for use with TRACE32(R) only ; -------------------------------------------------------------------------------- ; $Id: autoload.cmm 3546 2018-08-08 14:27:40Z rdienstbeck $ // Autoload script, called by TRACE32 if symbols are to be loaded // VLX version // define local macros local &filename &type &code &data &space local &filename &basename &progname &access local &symfilename1 &symfilename2 // get filename and relocation information // these parameters are passed from TRACE32 when calling this skript entry &filename &type &code &data &space //print "autoload: " &filename " " &type " " &code " " &data " " &space // &filename: name of process/file // &type: type of file: 1=process, 2=library, 3=kernel module // &code: text segment address // &data: data segment address // &space: space id of process // get symbol file name and program name &filepath="" &basename=string.cut(&filename,-string.len(os.file.extension(&filename))) if (&type==1) ( // processes &symfilename1="&basename" // without extension &symfilename2=&filename // as given in parameter if task.y.o.s(rootpath)!="" ( // root path option set, use target path local &magic &magic=task.proc.magic(&filename) &filepath=task.y.o.s(rootpath)+task.proc.path(&magic) ) ) if ((&type&0xffff)==2) ( // libraries &symfilename1=&filename &symfilename2="&basename"+".so" if task.y.o.s(rootpath)!="" ( // root path option set, use target path local &magic &magic=task.proc.sid2magic(&type>>16.) &filepath=task.y.o.s(rootpath)+task.lib.path(&filename,&magic) ) ) if (&type==3) ( // kernel modules &symfilename1="&basename"+".ko" // Linux converts dashes to underlines - try to reverse this local &ul &len &symfilename2="&basename"+".ko" &len=string.len("&symfilename2") &ul=string.scan("&symfilename2","_",0) while &ul!=-1 ( &symfilename2=string.cut("&symfilename2",&ul-&len)+"-"+string.cut("&symfilename2",&ul+1) &ul=string.scan("&symfilename2","_",0) ) ) // get program name &progname=os.file.name("&basename") // set space id to zero if not given if "&space"=="" &space=0 // get host/guest mode access &access=ext.vmaccess() // delete symbols if they already exist if y.exist("\\&progname") ( // create program path - due to possible special characters &progpath="`"+"\\"+"&progname"+"`" sYmbol.Delete &progpath ) GROUP.Delete "&progname" // check if preset file path is valid if !os.file("&filepath") &filepath=y.searchfile("&symfilename1") // search file in source search path and open dialog when not there if !os.file("&filepath") &filepath=y.searchfile("&symfilename2") if !os.file("&filepath") ( local &file &spath &file=os.file.name("&symfilename1") winpos ,,,,,, filebox normal "Searching symbols for &filename" dialog.file "*&file*" entry %line &filepath if "&filepath"=="" enddo &spath=os.file.path("&filepath") sYmbol.SourcePATH.Set "&spath" ) // load symbol file (options for sourcepath, e.g. /STRIPPART may need to be added when required) if (&type==1) // processes ( Data.LOAD.Elf "&filepath" &access:&space:0 /nocode /noclear GROUP.Create "&progname" &access:&space:0x0--0xffffffff /GREEN ) if (&type==3) // modules ( Data.LOAD.Elf "&filepath" &access:0:0 /nocode /noclear /name &progname /reloctype &type GROUP.Create "&progname" y.secrange(\\&progname\.text) /YELLOW ) if ((&type&0xffff)==2) // libraries ( Data.LOAD.Elf "&filepath" &access:&space:&code /nocode /noclear ) enddo