groupUrl: https://ez.analog.com/dsp/software-and-development-tools/linux-blackfin/
Analog.com Analog Dialogue Wiki English
Analog.com Analog Dialogue Wiki 简体中文
EngineerZone
EngineerZone
  • Site
  • User
  • Site
  • Search
  • User
EngineerZone
EngineerZone
  • Log in
  • Site
  • Search
  • Log in
  • Home
  • Blogs ⌵
    • EZ Spotlight
    • The Engineering Mind
  • Browse ⌵
    • All Groups
    • All Members
  • Support ⌵
    • 3D ToF Depth Sensing
    • A2B
    • Aerospace and Defense (ADEF)
    • Amplifiers
    • Analog Microcontrollers
    • Analysis Control Evaluation (ACE) Software
    • Audio
    • Clock and Timing
    • Condition-Based Monitoring
    • Data Converters
    • Design Tools and Calculators
    • Direct Digital Synthesis (DDS)
    • Embedded Vision Sensing
    • Energy Monitoring and Metering
    • FPGA Reference Designs
    • Industrial Ethernet
    • Interface and Isolation
    • Low Power RF Transceivers
    • MEMS Inertial Sensors
    • Motor Control Hardware Platforms
    • Optical Sensing
    • Power Management
    • Precision Technology Signal Chains
    • Processors and DSP
    • Reference Circuits
    • RF and Microwave
    • Signal Chain Power (SCP)
    • Switches/Multiplexers
    • Temperature Sensors
    • Video
    • Wide Band RF Transceivers
    • Wireless Sensor Networks Reference Library
  • About EZ
  • More
  • Cancel
  • 主页
  • 浏览 ⌵
    • 收件箱
    • 个人设置
    • 会员
    • 专区列表
  • 论坛专区 ⌵
    • 放大器专区
    • 精密转换器专区
    • 音频专区
    • ADE电能计量专区
    • MEMS和传感器专区
    • 接口和隔离专区
    • Power 中文专区
    • ADUC微处理器专区
    • 锁相环专区
    • 开关和多路复用器专区
    • 温度传感器
    • 基准电压源专区
    • 资源库
    • 论坛使用指南
    • 技术支持参考库
    • 在线研讨会
    • 论坛社群活动
    • 论坛激励活动
  • More
  • Cancel
Linux Distribution for Blackfin
  • Processors and DSP
  • Software and Development Tools
  • Linux Distribution for Blackfin
  • Cancel
Linux Distribution for Blackfin
Documents FAQ: GDB commands for newbie.
  • Q&A
  • Discussions
  • Documents
  • Sub-Groups
  • Members
  • Tags
  • Reports
  • Managers
  • More
  • Cancel
  • New
Linux Distribution for Blackfin requires membership for participation - click to join
  • Documents
  • 2005-06-18 08:54:21     how load and compile the uClinux kernel
  • 2007-04-03 05:21:47     SPI eeprom write read
  • 2007-06-05 06:05:45     How to load Linux from JFFS2/NAND flash
  • 2011-10-18 00:59:25     Attention: help forums are moving to the Analog Devices' EngineerZone Since Oct.24
  • 2013R1 Linux release for Blackfin
  • AD5700/AD5700-1 RXD Activity After HART Carrier Off
  • DAS U-BOOT FOR BLACKFIN BUGS ARCHIVE
  • Development of the Blackfin Linux Projects is moved to sourceforge.net since Jul. 20, 2013.
  • FAQ: Demo the video capability on BF609
  • FAQ: Does ADI u-boot support BF70x processors?
  • FAQ: GDB commands for newbie.
  • FAQ: Getting Started with SDP-B using GCC Toolchain
  • FAQ: How do I re-use projects built in VDSP in a GCC Bare metal environment?
  • FAQ: How to make u-boot to do somthing automatically after booting
  • FAQ: Moving to a newer Blacinfin Linux release version
  • FAQ: Why I get compile errors with the default ADI release
  • GNU TOOLCHAIN FOR BLACKFIN BUGS ARCHIVE
  • GNU TOOLCHAIN FOR BLACKFIN SUPPORT COMMUNITY
  • How can I flash the uImage into Flash and boot from it?
  • How to autorun applications in uClinux
  • I want to use the second core of Blackfin in Linux to boost the performance, is there a quick guide?
  • LINUX DISTRIBUTION FOR BLACKFIN SUPPORT COMMUNITY
  • +Parent Document for U-Boot Bug Archive
  • +Parent Document for U-Boot Bug Forum Archive
  • +Parent for all content moved from GNU Archive
  • Re: bf537 SPI Bus: To use Kernel, Userspace, or Bitbang control
  • TAGS LIST: Interface and Isolation
  • The 2013R1 Linux release for Blackfin
  • The development of the Blackfin Linux Projects is moved to sourceforge.net since Jul. 20, 2013.
  • Use gdbproxy to debug kernel
  • Use the ADI test scripts to auto config and build a target for a set of function
  • what does a successful "loading u-boot over uart" look like?
  • Where can I get Linux Blackfin documents?
  • [#3812] svn head u-boot build fails initcode.c on older parts
  • [#5809] gcc/g++ test on trunk head regression compared with testing on 09r1.1
  • [#5825] gdb: symbols cannot map to correct source file
  • [#5826] gdb.cp/userdef.exp fails to load executable's loadmap in fdpic testing
  • [#5827] gcc.dg/trampoline-1.c test on hardware fdpic fails on bf527 but pass on bf548
  • [#5828] libstdc++-4.3 21_strings/basic_string/capacity/char/18654.cc test on fdpic would fail
  • [#5842] gdb.base/sigall.exp would fail when debug through serial port 1
  • [#5845] gdb.gdbtk/c_variable.exp fails to be tested through /dev/ttyBF1
  • [#5858] gcc.c-torture/execute/memset-2.c regression now
  • [#5880] ldr-utils build fails
  • [#5886] bfin-elf-libstdc++-4.3 has two regression case compared with libstdc++-4.1
  • [#5887] bfin-uclinux-libstdc++-4.3 ext/headers.cc regress
  • [#5888] bfin-uclinux-libmudflap-4.3.sum pass40-frag.c output pattern test regress
  • [#5889] toolchain-regtest -r (test compare) option has multiple issues
  • [#5890] toolchain-regtest does not handle unknown args very well
  • [#5891] trunk head gdbproxy can't find and open urjtag device
  • [#5892] bfin-uclinux-libstdc++-4.3 23_containers/set/modifiers/16728.cc fail sometimes
  • [#5895] prepare_target_solibs in toolchain-regtest fail to check the libs
  • [#5922] gcc/g++ testcase regression in simulator test for Unhandled instruction
  • [#5928] gas has problems with local labels in LOOP instructions
  • [#5935] toolchain-regtest can't find the toolchain to be tested now
  • [#5938] toolchain-regtest aborts when previous results are missing
  • [#5953] test libmudflap fails for mfconfig.exp.in missing
  • [#5962] mcpu doesn't get passed in testing linux-uclibc toolchain
  • [#5965] elf-simulator test cases regress for program stopped with signal 11
  • [#5966] build sim binutils fails now
  • [#5970] Build oprofile failed at bfd library after toolchain upgrade from 3801 to 3852
  • [#5974] CPLB fault or SIGABRT when throwing&catching C++ exception in static FDPIC ELF
  • [#5980] trunk toolchain cannot find -lbffastfp with -mfast-fp
  • [#5981] gas tests have regressions due to SHIFT->LSHIFT change
  • [#5989] build toolchain fails at binutils-2.17/sim/bfin
  • [#6018] gcc-4.3 ICEs with {interrupt,exception,nmi}_handler function attributes in copyprop_hardreg_forward_1, at regrename.c:1787
  • [#6030] test bfin-elf via simulator, it stops in gdb.gdbtk/c_variable.exp with case "stop in subroutine1"
  • [#7702] GDB fails to find prologue
  • [#7806] gdb test regression after using buildroot as target os
  • [DOC] Configuring Qt Creator as SDK for uClinux

FAQ: GDB commands for newbie.

Q.

Can you provide some quick GDB commands for a newbie?

--------------------------------------------------------------------------

A.

This is a quick FAQ written in a typical debug sequence and is only meant for beginners. I just extracted the contents of the uploaded file in Doc Site:

http://docs.blackfin.uclinux.org/lib/exe/fetch.php?media=presentations:toolchain:gdb_for_dummies.pdf

Fact Sheet

What is GDB? http://shop.fsf.org/product/debugging-gdb-gnu-source-level-debugger/

“GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed. GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:

  • Start your program, specifying anything that might affect its behavior.
  • Make your program stop on specified conditions.
  • Examine what has happened, when your program has stopped.
  • Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another. ”

What is GDB Server? http://en.wikipedia.org/wiki/Gdbserver

“gdb-server is a computer program that makes it possible to remotely debug other programs.Running on the same system as the program to be debugged, it allows the GNU Debugger to connect from another system; that is, only the executable to be debugged needs to be resident on the target system, while the source code and a copy of the binary file to be debugged reside on the developer’s local computer. The connection can be either TCP or a serial line”

What is GDB Proxy? https://docs.blackfin.uclinux.org/doku.php?id=toolchain:debug:gdbproxy

When debugging under the gdb environment, the debugger needs to know what target to connect to. This target is a tiny server daemon, typically running on the host computer. It is equivalent to a gdbserver, although it does not run on the target hardware. This server is called gdbproxy and is derived from rproxy-0.7.

What is Eclipse? http://en.wikipedia.org/wiki/Eclipse_(software)

Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-in system. It is written mostly in Java and can be used to develop applications in Java and, by means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Perl, PHP, Python, R. Ruby (including Ruby on Rails framework), Scala, Clojure, and Scheme.

What is GDB/mi Interface? http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html#GDB_002fMI

GDB/MI is a line based machine oriented text interface to GDB and is activated by specifying using the --interpreter command line option (see Mode Options). It is specifically intended to support the development of systems which use the debugger as just one small component as a larger system {Eclipse}.

Lets learn from a simple no-hardware code as below. All following gdb commands are sequentially tested…

Sample code for debugging

int global_data = 1111;

void func1();

void func2();

int main(void);

int main(void)

{

      func1();

      return 0;

}

void func1()

{

      int local_data = 1234;

      global_data = 5678;

      func2();

}

void func2()

{

}

Start the GDB first:

C:\Program Files\Analog Devices\GNU Toolchain\2010R1\elf\bin>bfin-elf-gdb.exe gdb_debugging

GNU gdb 6.6

Copyright (C) 2006 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "--host=i386-mingw32msvc --target=bfin-elf"...

(gdb) target remote localhost:2000

Remote debugging using localhost:2000

main () at ../src/gdb_debugging.c:9

9               func1();

(gdb) load

Loading section .rodata, size 0x8 lma 0xff800000

Loading section .eh_frame, size 0x4 lma 0xff800008

Loading section .ctors, size 0x8 lma 0xff80000c

Loading section .dtors, size 0x8 lma 0xff800014

Loading section .jcr, size 0x4 lma 0xff80001c

Loading section .data, size 0x40c lma 0xff800020

Loading section .text, size 0x510 lma 0xffa00000

Loading section .init, size 0x12 lma 0xffa00510

Loading section .fini, size 0xe lma 0xffa00522

Start address 0xffa00000, load size 2396

Transfer rate: 140941 bits/sec, 266 bytes/write.

Insert some break points – at the entry of each function:

(gdb) break main

Breakpoint 1 at 0xffa00274: file ../src/gdb_debugging.c, line 9.

(gdb) break func1

Breakpoint 2 at 0xffa00284: file ../src/gdb_debugging.c, line 17.

(gdb) break func2

Breakpoint 3 at 0xffa002ac: file ../src/gdb_debugging.c, line 28.

Run the code and it should hit breakpoints.

(gdb) continue

Continuing.

Breakpoint 1, main () at ../src/gdb_debugging.c:9

9               func1();

(gdb) continue

Continuing.

Breakpoint 2, func1 () at ../src/gdb_debugging.c:17

17              int local_data = 1234;

Let’s play with breakpoints. See the information of the breakpoints, how it can be disabled.

(gdb) info breakpoints

Num Type           Disp Enb Address    What

1   breakpoint     keep y   0xffa00274 in main at ../src/gdb_debugging.c:9

        breakpoint already hit 1 time

2   breakpoint     keep y   0xffa00284 in func1 at ../src/gdb_debugging.c:17

        breakpoint already hit 1 time

3   breakpoint     keep y   0xffa002ac in func2 at ../src/gdb_debugging.c:28

(gdb) disable 2

(gdb) info breakpoints

Num Type           Disp Enb Address    What

1   breakpoint     keep y   0xffa00274 in main at ../src/gdb_debugging.c:9

        breakpoint already hit 1 time

2   breakpoint     keep n   0xffa00284 in func1 at ../src/gdb_debugging.c:17

        breakpoint already hit 1 time

3   breakpoint     keep y   0xffa002ac in func2 at ../src/gdb_debugging.c:28

Where are we now?
gdb) where

#0  func1 () at ../src/gdb_debugging.c:17

#1  0xffa00278 in main () at ../src/gdb_debugging.c:9

Single stepping the code…

(gdb) step

19              global_data = 5678;

Let’s print the local variable..

(gdb) info local

local_data = 1234

And the global variable…

(gdb) print/x global_data

$1 = 0x457

Check out the dis-assembly

(gdb) disassemble 0xffa00280 0xffa002a0

Dump of assembler code from 0xffa00280 to 0xffa002a0:

0xffa00280 <func1+0>:   LINK 0x10;                 /* (16) */

0xffa00284 <func1+4>:   R0 = 0x4d2 (X);         /*              R0=0x0x4d2(1234) */

0xffa00288 <func1+8>:   [FP -0x4] = R0;

0xffa0028a <func1+10>:  P2.H = 0xff80;          /* (-128)       P2=0x0xff800000<_global_impure_ptr> */

0xffa0028e <func1+14>:  P2.L = 0x24;             /* ( 36)        P2=0x0xff800024<global_data> */

0xffa00292 <func1+18>:  R0 = 0x162e (X);     /*              R0=0x0x162e(5678) */

0xffa00296 <func1+22>:  [P2] = R0;

0xffa00298 <func1+24>:  CALL 0x0xffa002a4 <func2>;

0xffa0029c <func1+28>:  UNLINK;

End of assembler dump.

We run again…

(gdb) continue

Continuing.

Breakpoint 3, func2 () at ../src/gdb_debugging.c:28

28      }

Look at the back-trace info of function calls and frame info.

(gdb) bt

#0  func2 () at ../src/gdb_debugging.c:28

#1  0xffa0029c in func1 () at ../src/gdb_debugging.c:21

#2  0xffa00278 in main () at ../src/gdb_debugging.c:9

(gdb) backtrace full

#0  func2 () at ../src/gdb_debugging.c:28

No locals.

#1  0xffa0029c in func1 () at ../src/gdb_debugging.c:21

        local_data = 1234

#2  0xffa00278 in main () at ../src/gdb_debugging.c:9

No locals.

(gdb) frame

#0  func2 () at ../src/gdb_debugging.c:28

28      }

Core register information...

(gdb) info registers

r0             0x162e   5678

r1             0xff80042c       -8387540

r2             0x0      0A

r3             0x0      0

r4             0x8000   32768

r5             0x989680 10000000

r6             0x0      0

r7             0x0      0

p0             0xff800178       0xff800178

p1             0x1      0x1

p2             0xff800024       0xff800024

p3             0x3f1ff80        0x3f1ff80

p4             0x3f22148        0x3f22148

p5             0xffc03060       0xffc03060

sp             0xffb00f9c       0xffb00f9c

fp             0xffb00f9c       0xffb00f9c

i0             0xffe01300       -2092288

i1             0xffe00300       -2096384

i2             0x7d801048       2105544776

i3             0x7f900840       2140145728

m0             0x0      0

m1             0x0      0

m2             0xff807ffc       -8355844

m3             0x0      0

b0             0x7fa7e73e       2141710142

b1             0xb5025ff6       -1258135562

b2             0x5b4597f7       1531287543

b3             0x4c3dac51       1279110225

l0             0x0      0

l1             0x0      0

l2             0x0      0

l3             0x0      0

a0x            0x0      0

a0w            0x3200000        52428800

a1x            0x0      0

a1w            0x2b53   11091

astat          0x2001025        33558565

rets           0xffa0029c       0xffa0029c <func1+28>

lc0            0x0      0

lt0            0xffa0005c       -6291364

lb0            0xffa0005d       -6291363

lc1            0x0      0

lt1            0xffa00366       -6290586

lb1            0xffa00367       -6290585

cycles         0xa07d46a4       -1602402652

cycles2        0x0      0

usp            0xffb00ff4       0xffb00ff4

seqstat        0x0      0

syscfg         0x32     50

reti           0xffa000e8       -6291224

retx           0xffa004d6       -6290218

retn           0x986b21f        159822367

rete           0xffa002ac       -6290772

pc             0xffa002ac       0xffa002ac <func2+8>

cc             0x1      1

text_addr      0x0      0

text_end_addr  0x0      0

data_addr      0x0      0

fdpic_exec     0x0      0

fdpic_interp   0x0      0

ipend          0x0      0

Set some global data

(gdb) set global_data = 9999

(gdb) print global_data

$2 = 9999

GDB/MI interface is meant for IDDE such as Eclipse. There are of course some simple useful commands. But beware – the console out seems terribly bad, when these commands are invoked directly.

Setting up as usual.

C:\Program Files\Analog Devices\GNU Toolchain\2010R1\elf\bin>bfin-elf-gdb.exe --interpreter=mi gdb_debugging

~"GNU gdb 6.6\n"

~"Copyright (C) 2006 Free Software Foundation, Inc.\n"

~"GDB is free software, covered by the GNU General Public License, and you are\n"

~"welcome to change it and/or distribute copies of it under certain conditions.\n"

~"Type \"show copying\" to see the conditions.\n"

~"There is absolutely no warranty for GDB.  Type \"show warranty\" for details.\n"

~"This GDB was configured as \"--host=i386-mingw32msvc --target=bfin-elf\"...\n"

(gdb)

target remote localhost:2000

&"target remote localhost:2000\n"

~"Remote debugging using localhost:2000\n"

~"main () at ../src/gdb_debugging.c:9\n"

~"9\t\tfunc1();\n"

^done

Dis-assembly

(gdb)

-data-disassemble -f gdb_debugging.c -l 15 -n 3 -- 0

^done,asm_insns=

[{address="0xffa00280",func-name="func1",offset="0",inst="LINK 0x10;\t\t/* (16) */"},

{address="0xffa00284",func-name="func1",offset="4",inst="R0 = 0x4d2 (X);\t\t/*\t\tR0=0x0x4d2(1234) */"},

{address="0xffa00288",func-name="func1",offset="8",inst="[FP -0x4] = R0;"}]

Reading and writing data

(gdb)

-data-read-memory 0xff800000 x 1 3 3

^done,addr="0xff800000",nr-bytes="9",total-bytes="9",next-row="0xff800003",prev-row="0xff7ffffd",next-page="0xff800009",prev-page="0xff7ffff7",

memory=[{addr="0xff800000",data=["0x00","0x00","0x00"]},

{addr="0xff800003",data=["0x00","0x43","0x00"]},

{addr="0xff800006",data=["0x00","0x00","0xff"]}]

(gdb)

-data-write-memory 0xff800000 x 1 0x11

^done

(gdb)

-data-write-memory 0xff800001 x 1 0x22

^done

(gdb)

-data-write-memory 0xff800001 x 1 0x33

^done

(gdb)

-data-read-memory 0xff800000 x 1 3 3

^done,addr="0xff800000",nr-bytes="9",total-bytes="9",next-row="0xff800003",prev-row="0xff7ffffd",next-page="0xff800009",prev-page="0xff7ffff7",

memory=[{addr="0xff800000",data=["0x11","0x33","0x00"]},

{addr="0xff800003",data=["0x00","0x43","0x00"]},

{addr="0xff800006",data=["0x00","0x00","0xff"]}]

(gdb)

  • Share
  • History
  • More
  • Cancel
Comments
Anonymous
  • ADIApproved
    ADIApproved over 10 years ago in reply to KenJackson

    Hi Ken,

    I’m going to email you from processor.tools.support@analog.com so that we can discuss the problems you’re having with VisualDSP++, and what’s blocking you right now. We may also be able to figure out a plan for trading in your HPUSBs for ICE-100Bs.

    Regards,

    Linda

    Linda Gray

    Processor Tools Support Manager

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • More
    • Cancel
  • KenJackson
    KenJackson over 10 years ago in reply to PrasanthR

    Prasanth, that's a non sequitir.  Just because open source tools are inexpensive or no cost, doesn't mean they're not the best.  When you're company pays top dollar for a tools like HPUSB-ICEs, you shouldn't have to suffer with VDSP, but right now that's the only option.

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • More
    • Cancel
  • jiez
    jiez over 10 years ago in reply to KenJackson

    At the bottom of http://docs.blackfin.uclinux.org/doku.php?id=hw:jtag , it lists all the jtag devices gdbproxy supports now. If you happen to have some in the list, you can try. I would recommend ICE-100B and gnICE+ .

    You can look up where to buy them here:

    http://docs.blackfin.uclinux.org/doku.php?id=buy_stuff

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • More
    • Cancel
  • KenJackson
    KenJackson over 10 years ago in reply to jiez

    Yes, we could use some other ICE if our company had not already spent beaucoup bucks on loads of HPUSB-ICEs.  But since it has, it's difficult to go back and ask for yet another.  It sure would be nice if we could get gdbproxy support for HPUSB-ICE.  Or perhaps some documentation so someone else could do it.

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • More
    • Cancel
  • PrasanthR
    PrasanthR over 10 years ago in reply to KenJackson

    As I see it, HP USB is way too costly, so it doesn't align with the low cost concept in open source development. Besides ICE 100B is a low cost product.

    • Cancel
    • Vote Up 0 Vote Down
    • Reply
    • More
    • Cancel
>
Related
 
社交网络
快速链接
  • 关于ADI
  • Partners
  • 模拟对话
  • 职业
  • 联系我们
  • 投资信息
  • 新闻中心
  • 质量和可靠性
  • 办事处与代理商
  • Analog Garage
语言
  • English
  • 简体中文
  • 日本語
  • Руccкий
电子快讯

欲获得最新ADI产品、设计工具、培训与活动的相关新闻与文章,请从我们的在线快讯中选出您感兴趣的产品类别,每月或每季度都会发送至您的收件箱。

订阅
Switch to mobile view
Analog Logo
© 1995 - 2022 Analog Devices, Inc. All Rights Reserved 沪ICP备09046653号-1
  • ©
  • 1995 - 2022 Analog Devices, Inc. All Rights Reserved
  • 沪ICP备09046653号-1
  • 网站地图
  • 隐私和保密政策
  • 隐私设置
  • 使用条款
 
Social
Quick Links
  • About ADI
  • Partners
  • Analog Dialogue
  • Careers
  • Contact us
  • Investor Relations
  • News Room
  • Quality & Reliability
  • Sales & Distribution
  • Analog Garage
Languages
  • English
  • 简体中文
  • 日本語
  • Руccкий
Newsletters

Interested in the latest news and articles about ADI products, design tools, training and events? Choose from one of our 12 newsletters that match your product area of interest, delivered monthly or quarterly to your inbox.

Sign Up
Switch to mobile view
Analog Logo
© 1995 - 2022 Analog Devices, Inc. All Rights Reserved 沪ICP备09046653号-1
  • ©
  • 1995 - 2022 Analog Devices, Inc. All Rights Reserved
  • 沪ICP备09046653号-1
  • Sitemap
  • Privacy & Security
  • Privacy Settings
  • Terms of use
EngineerZone Uses cookies to ensure you get the best experience in our community. For more information on cookies, please read our Privacy & Security Statement.