[fpc-devel] FPC 2.2.2 on Linux/SPARC

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Thu Sep 11 16:02:38 CEST 2008


Mark Morgan Lloyd wrote:
> Jonas Maebe wrote:

>> It's been merged to 2.2.3 now. You can either download the source 
>> zipfile from 
>> ftp://ftp.freepascal.org/pub/fpc/snapshot/v22/source/fpc.zip, or get 
>> it from svn as described here: 
>> http://www.freepascal.org/develop.var#svn (make sure you use the 
>> checkout url mentioned in the "Fixes to 2.2.x" section).
> 
> fpc and fp appear to work on linux/sparc. However trying to single-step 
> or run to a breakpoint in fp fails with another bus error or misaligned 
> data access- do I stand any realistic chance of generating a useful 
> backtrace for this?

I've had no success trying to drive fpc interactively across ttys to get
to the point of failure. However while tinkering I found that failure
depends on compilation options:

none		Fails (fpc reports RTE 217)
"OPT=-g"	Fails as above
"OPT=-O- -g"	No failure
"OPT=-O-"	No failure
"OPT=-O1 -g"	Fails as above

Using the last of those and driving the debugger blind I get

Program received signal SIGBUS, Bus error.
0x002b0e08 in find_pc_sect_line (pc=65764, section=0x0, notcurrent=0) at 
symtab.c:2201
         in symtab.c
Current language:  auto; currently c
(gdb) backtrace
#0  0x002b0e08 in find_pc_sect_line (pc=65764, section=0x0, 
notcurrent=0) at symtab.c:2201
#1  0x002b10a8 in find_pc_line (pc=65764, notcurrent=0) at symtab.c:2214
#2  0x0005364c in ANNOTATE_STOPPED () at gdbint.pp:1501
#3  0x002c4114 in normal_stop () at infrun.c:3045
#4  0x002dee9c in find_default_create_inferior (exec_file=0xffffffff 
<Address 0xffffffff out of bounds>,
     allargs=0x5a4400 "", env=0x1, from_tty=0) at target.c:1516
#5  0x002bdf74 in run_command (args=0x0, from_tty=0) at infcmd.c:481
#6  0x00347968 in do_cfunc (c=0x5bf268, args=0x5da668 
"/home/markMLl/test", from_tty=0) at cli/cli-decode.c:57
#7  0x00349838 in cmd_func (cmd=0x5bf268, args=0x0, from_tty=0) at 
cli/cli-decode.c:1599
#8  0x00314914 in execute_command (p=0xff15277f "", from_tty=0) at top.c:733
#9  0x000540c4 in GDBINT_EXECUTE_COMMAND (COMMAND=0x0, FROM_TTY=1, 
MASK=0) at gdbint.pp:2161
#10 0x0031445c in do_catch_errors (uiout=0x5a6138, data=0xff1524f0) at 
top.c:524
#11 0x003142d8 in catcher (func=0x31444c <do_catch_errors>, 
func_uiout=0x5a6138, func_args=0xff1524f0,
     func_val=0xff1524ec, func_caught=0xff1524e8, errstring=0x0, 
gdberrmsg=0x0, mask=-1) at top.c:431
#12 0x00314498 in catch_errors (func=0x540ac <GDBINT_EXECUTE_COMMAND>, 
func_args=0xff15277c, errstring=0x0, mask=-1)
     at top.c:536
#13 0x0005440c in TGDBINTERFACE__GDB_COMMAND (S= [...] ) at gdbint.pp:2263
#14 0x001f5e94 in TGDBCONTROLLER__COMMAND (S= [...] ) at gdbcon.pp:163
#15 0x001f6178 in TGDBCONTROLLER__RUN () at gdbcon.pp:251
#16 0x000e10e4 in TDEBUGCONTROLLER__RUN () at fpdebug.pas:906
#17 0x001f6158 in TGDBCONTROLLER__STARTTRACE () at gdbcon.pp:246
#18 0x000acce8 in TIDEAPP__DOSTEPOVER () at fpmrun.inc:82
#19 0x000a8c40 in TIDEAPP__HANDLEEVENT (EVENT=
       {WHAT = 2648947360, BUTTONS = 128 '\200', DOUBLE = 162, WHERE = 
{X = 310378512, Y = 16777216}, KEYCODE = 32930,
  SCANCODE = 128 '\200', CHARCODE = 162 '<A2>', KEYSHIFT = 32 ' ', 
COMMAND = 2158108688, ID = 310378512, DATA = 7.2911
276715319871e-304, INFOPTR = 0x1300000b, INFOLONG = 318767115, INFOWORD 
= 4864, INFOINT = 4864, INFOBYTE = 19 '\023',
  INFOCHAR = 19 '\023'}) at fpide.pas:1259
#20 0x0005983c in TGROUP__EXECUTE () at views.pas:2030
#21 0x00062238 in TPROGRAM__RUN () at app.pas:780
#22 0x0001402c in main () at fp.pas:451
(gdb)

If I'm interpreting that correctly then either the command blocks in #14 
and #13 are wrong when the Pascal code is optimised (I have not 
recompiled the GDB interface library), or find_pc_sect_line is finding 
something it doesn't like. In case it's the former here are the full lines:

#13 0x0005440c in TGDBINTERFACE__GDB_COMMAND (S=
         {length = 157 '\235', st = {227 '<E3>', 191 '<BF>', 160 '<A0>', 
17 '\021', 0 '\0', 20 '\024', 58 ':', 208 '
<D0>', 2 '\002', 32 ' ', 144 '\220', 128 '\200', 162 '<A2>', 0 '\0', 0 
'\0', 2 '\002', 128 '\200', 0 '\0', 32 ' ', 1
'\001', 0 '\0', 0 '\0', 0 '\0', 208 '<D0>', 6 '\006', 32 ' ', 200 
'<C8>', 128 '\200', 162 '<A2>', 32 ' ', 1 '\001', 4
  '\004', 128 '\200', 0 '\0', 28 '\034', 1 '\001', 0 '\0', 0 '\0', 0 
'\0', 144 '\220', 16 '\020', 0 '\0', 24 '\030', 6
4 '@', 4 '\004', 84 'T', 72 'H', 1 '\001', 0 '\0', 0 '\0', 0 '\0', 127 
'\177', 252 '<FC>', 216 '<D8>', 180 '<B4>', 1
'\001', 0 '\0', 0 '\0', 0 '\0', 128 '\200', 162 '<A2>', 32 ' ', 0 '\0', 
4 '\004', 128 '\200', 0 '\0', 11 '\v', 1 '\00
1', 0 '\0', 0 '\0', 0 '\0', 17 '\021', 0 '\0', 20 '\024', 58 ':', 224 
'<E0>', 2 '\002', 32 ' ', 144 '\220', 144 '\220
', 16 '\020', 0 '\0', 24 '\030', 64 '@', 4 '\004', 84 'T', 62 '>', 1 
'\001', 0 '\0', 0 '\0', 0 '\0', 146 '\222', 16 '
\020', 0 '\0', 8 '\b', 144 '\220', 16 '\020', 0 '\0', 16 '\020', 127 
'\177', 255 '<FF>', 162 '<A2>', 22 '\026', 1 '\0
01', 0 '\0', 0 '\0', 0 '\0', 17 '\021', 0 '\0', 20 '\024', 58 ':', 224 
'<E0>', 2 '\002', 32 ' ', 144 '\220', 144 '\22
0', 16 '\020', 0 '\0', 24 '\030', 64 '@', 4 '\004', 84 'T', 49 '1', 1 
'\001', 0 '\0', 0 '\0', 0 '\0', 146 '\222', 16
'\020', 0 '\0', 8 '\b', 144 '\220', 16 '\020', 0 '\0', 16 '\020', 127 
'\177', 255 '<FF>', 162 '<A2>', 5 '\005', 1 '\0
01', 0 '\0', 0 '\0', 0 '\0', 17 '\021', 0 '\0', 20 '\024', 58 ':', 208 
'<D0>', 2 '\002', 32 ' ', 144 '\220', 128 '\20
0', 162 '<A2>', 0 '\0', 0 '\0', 2 '\002', 128 '\200', 0 '\0', 7 '\a', 1 
'\001', 0 '\0', 0 '\0', 0 '\0', 17 '\021', 0
'\0', 20 '\024', 58 ':', 208 '<D0>', 2 '\002', 32 ' ', 144 '\220', 146 
'\222', 16 '\020', 0 '\0', 25 '\031', 127 '\17
7', 255 '<FF>', 162 '<A2>', 11 '\v', 1 '\001', 0 '\0', 0 '\0', 0 '\0', 
129 '\201', 199 '<C7>', 224 '<E0>', 8 '\b', 12
9 '\201', 232 '<E8>', 0 '\0', 0 '\0', 157 '\235', 227 '<E3>', 191 
'<BF>', 160 '<A0>', 17 '\021', 0 '\0', 20 '\024', 5
8 ':', 208 '<D0>'...}}) at gdbint.pp:2263
#14 0x001f5e94 in TGDBCONTROLLER__COMMAND (S=
         {length = 3 '\003', st = {99 'c', 100 'd', 32 ' ', 0 '\0', 0 
'\0', 0 '\0', 0 '\0', 5 '\005', 102 'f', 105 'i'
, 108 'l', 101 'e', 32 ' ', 0 '\0', 0 '\0', 9 '\t', 115 's', 101 'e', 
116 't', 32 ' ', 97 'a', 114 'r', 103 'g', 115
's', 32 ' ', 0 '\0', 0 '\0', 4 '\004', 107 'k', 105 'i', 108 'l', 108 
'l', 0 '\0', 0 '\0', 0 '\0', 17 '\021', 116 't'
, 98 'b', 114 'r', 101 'e', 97 'a', 107 'k', 32 ' ', 80 'P', 65 'A', 83 
'S', 67 'C', 65 'A', 76 'L', 77 'M', 65 'A',
73 'I', 78 'N', 0 '\0', 0 '\0', 3 '\003', 114 'r', 117 'u', 110 'n', 0 
'\0', 0 '\0', 0 '\0', 0 '\0', 4 '\004', 115 's
', 116 't', 101 'e', 112 'p', 0 '\0', 0 '\0', 0 '\0', 4 '\004', 110 'n', 
101 'e', 120 'x', 116 't', 0 '\0', 0 '\0', 0
  '\0', 5 '\005', 115 's', 116 't', 101 'e', 112 'p', 105 'i', 0 '\0', 0 
'\0', 5 '\005', 110 'n', 101 'e', 120 'x', 11
6 't', 105 'i', 0 '\0', 0 '\0', 8 '\b', 99 'c', 111 'o', 110 'n', 116 
't', 105 'i', 110 'n', 117 'u', 101 'e', 0 '\0'
, 0 '\0', 0 '\0', 4 '\004', 102 'f', 105 'i', 108 'l', 101 'e', 0 '\0', 
0 '\0', 0 '\0', 2 '\002', 45 '-', 100 'd', 0
'\0', 1 '\001', 91 '[', 0 '\0', 0 '\0', 2 '\002', 93 ']', 32 ' ', 0 
'\0', 1 '\001', 32 ' ', 0 '\0', 0 '\0', 0 '\0', 0
  '\0', 0 '\0', 0 '\0', 15 '\017', 67 'C', 111 'o', 109 'm', 112 'p', 
105 'i', 108 'l', 101 'e', 114 'r', 32 ' ', 101
'e', 120 'x', 105 'i', 116 't', 101 'e', 100 'd', 0 '\0', 0 '\0', 0 
'\0', 0 '\0', 4 '\004', 46 '.', 80 'P', 82 'R', 7
3 'I', 0 '\0' <repeats 15 times>, 64 '@', 245 '<F5>', 24 '\030', 0 '\0', 
0 '\0', 0 '\0', 0 '\0', 0 '\0', 1 '\001', 46
  '.', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 64 '@', 36 '$', 0 
'\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0',
  2 '\002', 44 ',', 32 ' ', 0 '\0', 1 '\001', 32 ' '...}}) at gdbcon.pp:163

Hope this makes sense.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-devel mailing list