OpenCores
no use no use 1/1 no use no use
is or1ksim debugable with GDB?
by brxue on Aug 31, 2011
brxue
Posts: 11
Joined: Sep 21, 2010
Last seen: Nov 5, 2013
Hi,

I'm debuging or1ksim using GDB/DDD, but it's very curious that sometimes the source line can not match the GDB execution line.

What I want to know is that whether or1ksim is compiled with some optimization flags which possibly yields some lines of code optimized?

I configured or1ksim with target or32-elf and a prefix, no source files changed.

Thanks,
Brian
RE: is or1ksim debugable with GDB?
by jeremybennett on Sep 1, 2011
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

Hi,

I'm debuging or1ksim using GDB/DDD, but it's very curious that sometimes the source line can not match the GDB execution line.

What I want to know is that whether or1ksim is compiled with some optimization flags which possibly yields some lines of code optimized?

Hi Brian,

Simple answer. Yes.

If you want to debug Or1ksim, build a version without optimization. It will run slower, but you will get more accurate line numbers, fewer values optimized away etc.

    make CFLAGS+="-O0"
    

should do the trick (don't forget to "make clean" if you have a build already complete).

HTH

Jeremy

--
Tel: +44 (1590) 610184
Cell: +44 (7970) 676050
SkypeID: jeremybennett
Email: jeremy.bennett@embecosm.com
Web: www.embecosm.com

RE: is or1ksim debugable with GDB?
by brxue on Sep 2, 2011
brxue
Posts: 11
Joined: Sep 21, 2010
Last seen: Nov 5, 2013
Thanks very much for your reply, Jeremy.

Brian
RE: is or1ksim debugable with GDB?
by brxue on Sep 9, 2011
brxue
Posts: 11
Joined: Sep 21, 2010
Last seen: Nov 5, 2013

Hi,

I'm debuging or1ksim using GDB/DDD, but it's very curious that sometimes the source line can not match the GDB execution line.

What I want to know is that whether or1ksim is compiled with some optimization flags which possibly yields some lines of code optimized?

Hi Brian,

Simple answer. Yes.

If you want to debug Or1ksim, build a version without optimization. It will run slower, but you will get more accurate line numbers, fewer values optimized away etc.

    make CFLAGS+="-O0"
    

should do the trick (don't forget to "make clean" if you have a build already complete).

HTH

Jeremy

--
Tel: +44 (1590) 610184
Cell: +44 (7970) 676050
SkypeID: jeremybennett
Email: jeremy.bennett@embecosm.com
Web: www.embecosm.com



Hi Jeremy,

I'm compiling or1ksim as your said, but it reports the following error. Can you help?

I've tried that when I use "make" instead of "make CFLAGS+=-O0" compilation will pass.

libtool: link: ranlib .libs/libsim.a
libtool: link: rm -fr .libs/libsim.lax
libtool: link: ( cd ".libs" && rm -f "libsim.la" && ln -s "../libsim.la" "libsim.la" )
gcc -DHAVE_CONFIG_H -I. -I.. -I./cpu/or32 -I.. -I../cpu/common -I../cpu/or1k -I../cache -I../mmu -I../bpb -I../peripheral -I../tick -I../peripheral/channels -I../pm -I../pic -I../debug -I../vapi -I../support -I../cuc -I../port -I../argtable2 -I../softfloat -I../pcu -O0 -MT toplevel.o -MD -MP -MF .deps/toplevel.Tpo -c -o toplevel.o ../toplevel.c
mv -f .deps/toplevel.Tpo .deps/toplevel.Po
/bin/sh ./libtool --tag=CC --mode=link gcc -O0 -o sim toplevel.o libor1ksys.la
libtool: link: gcc -O0 -o sim toplevel.o ./.libs/libor1ksys.a -lm
./.libs/libor1ksys.a(softfloat.o): In function `estimateDiv128To64':
softfloat.c:(.text+0x86): undefined reference to `mul64To128'
softfloat.c:(.text+0xb2): undefined reference to `sub128'
softfloat.c:(.text+0xfa): undefined reference to `add128'
./.libs/libor1ksys.a(softfloat.o): In function `roundAndPackFloat32':
softfloat.c:(.text+0x9da): undefined reference to `packFloat32'
softfloat.c:(.text+0xa44): undefined reference to `shift32RightJamming'
RE: is or1ksim debugable with GDB?
by jeremybennett on Sep 9, 2011
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

Hi Brian,

The problem is the third party softfloat package. I see there is guidance in its README file:

    Note that the code cannot be compiled with -O0 for debugging purpose, because of the approach used to code inlining. Additional macros have been added to ease this problem. For debugging purposes, Or1ksim should be configured adding CFLAGS="-O0 -DINLINE=static -DNO_SOFTFLOAT_UNUSED" to the configure line.

Rather embarrassingly, I see that warning was written by me only last year :(

Hopefully you can now get on with building Or1ksim unoptimized.

Jeremy

RE: is or1ksim debugable with GDB?
by brxue on Sep 12, 2011
brxue
Posts: 11
Joined: Sep 21, 2010
Last seen: Nov 5, 2013
Thanks Jeremy, it works now. I've added to this wiki link:

http://opencores.org/or1k/Or1ksim#Installation_under_Linux.2FCygwin

Best Regards,
Brian
RE: is or1ksim debugable with GDB?
by jeremybennett on Sep 12, 2011
jeremybennett
Posts: 815
Joined: May 29, 2008
Last seen: Jun 13, 2019

Hi Brian,

Thanks for contributing to the Wiki. That helps everyone in future.

Hope your work is successful. We'll be very interested in any improvements that you can add to Or1ksim.

Jeremy

no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.