Re: [hatari-devel] Is it me or the symbols prg option is broken ?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On keskiviikko 29 huhtikuu 2015, Konador, Cyprian wrote:
> Files sent,

By adding "symbols prg" as first line to "wait.ini" file [1], everything 
works fine for me, with all of the binaries you provided.

Btw. I also like to trace GEMDOS operations to see how things process:
------- wait.ini --------
symbols prg
trace gemdos
b PC = mainloop :once :trace :file trace.ini
-------------------------

Because in your case there's a crash before next VBL and program terminates 
before breakpoint for the VBL, there aren't anymore:
- valid debug symbols when profile is saved (they're removed at Pterm)
- profile doesn't include program TEXT section address, so that you could 
give debug symbols to profile post-processor

=> I would recommend setting profile save breakpoint also for Pterm:
----- trace.ini ---------
profile on
b VBL = "VBL+1" :trace :file disable.ini
# save profile also on crash & Pterm
b GemdosOpcode = 0x4C :trace :file disable.ini
-------------------------

Attached is graph of:

	# get the profile
	hatari --parse break.ini bt4pc_dx.prg 

	# get symbols for profile post-processing
	gst2ascii bt4pc_dx.prg > symbols.txt

	# post-process profile, output top-lists & callgraphs
	hatari_profile.py -stpg -r symbols.txt --compact myprofile.txt

	# convert callgraph to SVG
	dot -Tsvg myprofile-2.dot  > myprofile-cycles.svg

Attached SVG file can be viewed with Browser.

(And as I stated, program crashes before next VBL, so it's not full frame.)


	- Eero

[1] symbols are loaded automatically only when Hatari drops you to debugger 
prompt, but that doesn't happen with breakpoints having ":trace" option.  
With them you need to tell debugger to load the symbols.


> Thanks for help
> 
> Regards
> Cyprian
> 
> > -----Original Message-----
> > From: Eero Tamminen
> > Sent: 29 April 2015 22:21
> > To: hatari-devel@xxxxxxxxxxxxxxxxxxx
> > Subject: Re: [hatari-devel] Is it me or the symbols prg option is
> > broken ?
> > 
> > Hi,
> > 
> > On keskiviikko 29 huhtikuu 2015, Konador, Cyprian wrote:
> > > Hmm, I'm a bit confused.
> > > They works fine from desktop, they have 0x601A in the header and also
> > > valid debug symbols (normal or extended as I described below).
> > 
> > Maybe it's a Windows issue.  Could you try changing fopen() "r"
> > argument to "rb" in src/debug/symbols.c?
> > 
> > If that doesn't help, could you send the binary to me, so that I can
> > check it?
> > 
> > 	- Eero
> > 	
> > > Thanks
> > > 
> > > Regards
> > > Cyprian
> > > 
> > > > -----Original Message-----
> > > > From: Eero Tamminen,
> > > > Sent: 29 April 2015 19:07
> > > > To: hatari-devel@xxxxxxxxxxxxxxxxxxx
> > > > Subject: Re: [hatari-devel] Is it me or the symbols prg option is
> > > > broken ?
> > > > 
> > > > Hi,
> > > > 
> > > > "ASCII symbols" message means that the program header at the start
> > > > of your binary doesn't contain the magic word (0x601A) that
> > > > identifies it as Atari program.
> > > > 
> > > > 	- Eero
> > > > 
> > > > On keskiviikko 29 huhtikuu 2015, Konador, Cyprian wrote:
> > > > > I'm trying to analyze some of code. Below you can find a complete
> > > > > content of my parser files.
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > Regards
> > > > > Cyprian
> > > > > 
> > > > > 
> > > > > TRACE.BAT
> > > > > 
> > > > > 	hatari.exe -c cfgSTE.cfg --parse break.ini BT4PC_Dx.PRG
> > > > > 
> > > > > BREAK.INI
> > > > > 
> > > > > 	b GemdosOpcode = 0x3D :trace :once :file program.ini
> > > > > 
> > > > > PROGRAM.INI
> > > > > 
> > > > > 	b pc = TEXT :trace :once :file wait.ini
> > > > > 
> > > > > WAIT.INI
> > > > > 
> > > > > 	b PC = mainloop :once :trace :file trace.ini
> > > > > 
> > > > > TRACE.INI
> > > > > 
> > > > > 	profile on
> > > > > 	b VBL = "VBL+1" :trace :file disable.ini
> > > > > 
> > > > > DISABLE.INI
> > > > > 
> > > > > 	trace none
> > > > > 	b all
> > > > > 	profile save myprofile.txt
> > > > > 	q
> > > > > 	
> > > > > > -----Original Message-----
> > > > > > From: Eero Tamminen
> > > > > > Sent: 28 April 2015 20:44
> > > > > > To: hatari-devel@xxxxxxxxxxxxxxxxxxx
> > > > > > Subject: Re: [hatari-devel] Is it me or the symbols prg option
> > > > > > is broken ?
> > > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > What exactly you're doing?
> > > > > > 
> > > > > > (binaries should be read as binary with debug symbols, not as
> > > > > > ASCII symbol files)
> > > > > > 
> > > > > > 	- Eero
> > > > > > 
> > > > > > On tiistai 28 huhtikuu 2015, Konador, Cyprian wrote:
> > > > > > > Hi All,
> > > > > > > 
> > > > > > > I've just face an issue with symbols in Hatari 1.8.
> > > > > > > I compiled test program with VASM and Devpac as described
> > > > > > > below:
> > > > > > > 
> > > > > > > Devpac-3
> > > > > > > 
> > > > > > > 	BT4PC_Dn.PRG	Debug symbol Normal
> > > > > > > 	BT4PC_Dx.PRG	Debug symbol Extended
> > > > > > > 
> > > > > > > VASM
> > > > > > > 
> > > > > > > 	BT4PC_Dx.TOS	OPT D+,X+
> > > > > > > 
> > > > > > > All tests show me following error message:
> > > > > > > --
> > > > > > > Reading 'nm' style ASCII symbols from 'BT4PC_D.TOS'...
> > > > > > > ERROR: no symbols.
> > > > > > > ERROR: reading symbols from 'BT4PC_D.TOS' failed!
> > > > > > > --
> > > > > > > Reading 'nm' style ASCII symbols from 'BT4PC_Dn.PRG'...
> > > > > > > ERROR: no symbols.
> > > > > > > ERROR: reading symbols from 'BT4PC_Dn.PRG' failed!
> > > > > > > --
> > > > > > > Reading 'nm' style ASCII symbols from 'BT4PC_Dx.PRG'...
> > > > > > > ERROR: no symbols.
> > > > > > > ERROR: reading symbols from 'BT4PC_Dx.PRG' failed!
> > > > > > > --
> > > > > > > 
> > > > > > > 'PC = mainloop'
> > > > > > > 
> > > > > > >       ^-invalid variable/register/symbol name
> > > > > > > 
> > > > > > > Regards
> > > > > > > Cyprian
> > > > > > > 
> > > > > > > > -----Original Message-----
> > > > > > > > From: Eero Tamminen
> > > > > > > > Sent: 13 June 2014 22:26
> > > > > > > > To: hatari-devel@xxxxxxxxxxxxxxxxxxx
> > > > > > > > Subject: Re: [hatari-devel] Is it me or the symbols prg
> > > > > > > > option is broken ?
> > > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > On perjantai 13 kesäkuu 2014, Laurent Sallafranque wrote:
> > > > > > > > >  > Does symbol loading work now? Le 12/06/2014 23:44,
> > > > > > > > >  > Eero Tamminen
> > > > > > 
> > > > > > a
> > > > > > 
> > > > > > > > > écrit :
> > > > > > > > > 
> > > > > > > > > Yes it works again. Great job Eero.
> > > > > > > > 
> > > > > > > > Ok, good.
> > > > > > > > 
> > > > > > > > I added the same fallback also for gst2ascii tool (it
> > > > > > > > already had that, but it used it only if it detected
> > > > > > > > program to be VBCC compiled).
> > > > > > > > 
> > > > > > > > > What is fun is that now, I don't have to enter "symbols
> > > > > > > > > prg", when I break the program, hatari debugger
> > > > > > > > > immediatly loads the symbol table by itself.
> > > > > > > > 
> > > > > > > > Yes, I think it quite handy too.  :-)
> > > > > > > > 
> > > > > > > > 	- Eero
> > > > > > > > 	
> > > > > > > > > Laurent
> > > > > > > > > 
> > > > > > > > > > Hi,
> > > > > > > > > > 
> > > > > > > > > > On torstai 12 kesäkuu 2014, Laurent Sallafranque wrote:
> > > > > > > > > >> Here is what I get :
> > > > > > > > > >>   > symbols prg
> > > > > > > > > >> 
> > > > > > > > > >> Reading symbols from program
> > 
> > '/media/Win_NTFS/Jeux/Atari/DiskDur.FAL/Thadoss/RACER/RACER/RACER.P
> > 
> > > > > > > > RG'
> > > > > > > > 
> > > > > > > > > >> symbol table...
> > > > > > > > > >> 0x7 program flags, reloc=0, TOS executable, DRI / GST
> > > > > > > > > >> symbol table. Trying to load symbol table at offset
> > > > > > > > > >> 0x8cee0... WARNING: ignoring symbol 'DTA' of B type in
> > > > > > > > > >> slot 1 with invalid offset 0x183b40 (>= 0xf6cab).
> > > > > > > > > >> WARNING: ignoring symbol 'MAXY' of D type in slot 6
> > > > > > > > > >> with invalid offset 0x104114 (>= 0xe8e4b).
> > > > > > > > > >> ERROR: too many invalid offsets, skipping rest of
> > > > > > > > > >> symbols!
> > > > > > > > > > 
> > > > > > > > > > Hm.  Devpac could be using TEXT-relative symbol offsets
> > > > > > > > > > in its symbol table.  Whereas e.g. GCC uses offsets
> > > > > > > > > > that are relative to the section where those symbols
> > > > > > > > > > are, and so do some other things (for which I fixed
> > > > > > > > > > Hatari a while ago).
> > > > > > > > > > 
> > > > > > > > > > I added code to Hatari to try to load the DATA & BSS
> > > > > > > > > > symbols as TEXT relative if loading them as relative to
> > > > > > > > > > their own section fails (i.e. offsets would be outside
> > > > > > > > > > of that section).
> > > > > > > > > > 
> > > > > > > > > > Does symbol loading work now?
> > > > > > > > > > 
> > > > > > > > > > If not, please provide Hatari "info basepage" output
> > > > > > > > > > for your program and Atari "nm" tool ouput for your
> > > > > > > > > > binary symbol table.
> > > > > > > > > > 
> > > > > > > > > > 	- Eero
> > > > > > > > > > 
> > > > > > > > > > PS. If somebody knows a flag in program header or DRI
> > > > > > > > > > symbols which tells to what the offsets are supposed to
> > > > > > > > > > be relative to, I would appreciate it.
> > > > > > > > > > 
> > > > > > > > > >> ERROR: reading symbols from
> > 
> > '/media/Win_NTFS/Jeux/Atari/DiskDur.FAL/Thadoss/RACER/RACER/RACER.P
> > 
> > > > > > > > RG'
> > > > > > > > 
> > > > > > > > > >> failed!
> > > > > > > > > >> 'symbols' - load CPU symbols & their addresses
> > > > > > > > > >> Usage:  symbols <filename|prg|addr|name|free> [<T
> > 
> > offset>
> > 
> > > > [<D
> > > > 
> > > > > > > > offset>
> > > > > > > > 
> > > > > > > > > >> <B offset>]]
> > > > > > > > > >> 
> > > > > > > > > >>       Loads symbol names and their addresses from the
> > > > > > > > > >>       given file. If there were previously loaded
> > > > > > > > > >>       symbols, they're replaced.
> > > > > > > > > >>       
> > > > > > > > > >>       Giving 'prg' instead of a file name, loads
> > > > > > > > > >>       DRI/GST symbol table from the last program
> > > > > > > > > >>       executed through the GEMDOS HD emulation.
> > > > > > > > > >>       
> > > > > > > > > >>       Giving either 'name' or 'addr' instead of a file
> > > > > > > > > >>       name, will list the currently loaded symbols.
> > > > > > > > > >>       Giving 'free' will remove the loaded symbols.
> > > > > > > > > >>       
> > > > > > > > > >>       If one base address/offset is given, its added
> > > > > > > > > >>       to all addresses. If three offsets are given
> > > > > > > > > >>       (and non-zero), they're applied to text (T),
> > > > > > > > > >>       data (D) and BSS (B) symbols. Given offsets are
> > > > > > > > > >>       used only when loading ASCII symbol files.
> > > > > > > > > >> 
> > > > > > > > > >> Laurent
> > > > > > > > > >> 
> > > > > > > > > >> Le 12/06/2014 20:24, Eero Tamminen a écrit :
> > > > > > > > > >>> Hi,
> > > > > > > > > >>> 
> > > > > > > > > >>> On torstai 12 kesäkuu 2014, Laurent Sallafranque 
wrote:
> > > > > > > > > >>>> I compile Racer with the following options as I
> > > > > > > > > >>>> always did before:
> > > > > > > > > >>>> 
> > > > > > > > > >>>> opt    p=68030/68882,NOCASE,D+,X+
> > > > > > > > > >>>> 
> > > > > > > > > >>>> Then, I run Racer and break it in the main menu, but
> > > > > > > > > >>>> I get the following
> > > > > > > > > >>>> 
> > > > > > > > > >>>> error message:
> > > > > > > > > >>>>    > symbols prg
> > > > > > > > > >>>> 
> > > > > > > > > >>>> ERROR: no program loaded (through GEMDOS HD emu)!
> > > > > > > > > >>> 
> > > > > > > > > >>> Because autoloading of the symbols failed, Hatari
> > > > > > > > > >>> removed
> > > > > > > > 
> > > > > > > > information
> > > > > > > > 
> > > > > > > > > >>> about the program path from debug symbol code. 
> > > > > > > > > >>> That's why you get this strange error on following
> > > > > > > > > >>> "symbols prg" commands.  I commited an improvement
> > > > > > > > > >>> which allows you
> > > > 
> > > > seeing
> > > > 
> > > > > > > > > >>> the errors again.
> > > > > > > > > >>> 
> > > > > > > > > >>> What error you get from symbols autoloading?
> > > > > > > > > >>> 
> > > > > > > > > >>> 	- Eero
> > > > > > > > > >>> 	
> > > > > > > > > >>>> Laurent
> > > > > > > > > >>>> 
> > > > > > > > > >>>> Le 11/06/2014 23:09, Eero Tamminen a écrit :
> > > > > > > > > >>>>> Hi,
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>> On keskiviikko 11 kesäkuu 2014, Laurent
> > > > > > > > > >>>>> Sallafranque
> > 
> > wrote:
> > > > > > > > > >>>>>> I can't use symbols prg with the latest release.
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>> What this means?
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>>> Is it me or something is broken here ?
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>> Nowadays Hatari nowadays loads symbols
> > > > > > > > > >>>>> automatically
> > 
> > if
> > 
> > > > > > program
> > > > > > 
> > > > > > > > has
> > > > > > > > 
> > > > > > > > > >>>>> them.
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>> Note that:
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>> * with GCC you need to ask linker to generate old
> > > > > > > > > >>>>> style (DRI) symbols.
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>>      More detailed a.out format symbols you need to
> > > > > > > > > >>>>>      output with nm and read as separate ASCII
> > > > > > > > > >>>>>      symbols file.
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>> * if you're using VBCC, make sure that you use a
> > > > > > > > > >>>>> version with fixed linker.
> > > > > > > > > >>>>> 
> > > > > > > > > >>>>>      Older VBCC linker used broken data/bss symbol
> > > > > > > > > >>>>>      offsets. For those you need to use gst2ascii
> > > > > > > > > >>>>>      program and load symbols as ASCII.
> > > > > > > > > >>>>> 	
> > > > > > > > > >>>>> 	- Eero

Attachment: myprofile-cycles.svg
Description: image/svg



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/