Configuration
Before you can debug a project . The project must be build by BTR first.
cd d:\BTR
bd.bat
bd > build
d:\test\myproject
bd.exe read the file d:\test\myproject\bdebug.ini, collect all parameters to build a project which include btrue debug package.
Where is the bdebug.ini? The file bdebug.ini must be saved at the same directory with the project.
The content of bdebug.ini contains like:
(1)Focus code path and focus code file.
(2)BD debugger IP.
(3)Target result file
(4)Language and its property
(5)Debug output property
(6)Assign special device( phone , MCU , embed board )
All above configuration can be easy set while build command executes.
If BD and debug app in same pc , BD ip may set 127.0.0.1
bd > build d:\test\myproject
(1)Focus code, BD IP and target file
(2)Vc version
bd > build /home/usr/linux/qtproject
or
bd > build E:\win\myqtproject
(1)Focus code, BD IP and target file
(2)Qt platform [ vc , gcc , mingw , android ]
bd > build /home/usr/test/myproject
(1)Focus code, BD IP and target file
bd > build /home/john/android/samp1
(1)Focus code, BD IP and target file
(2)Android c or android java
android network , set ip when build time:
android( in AVD )---------------BTR debugger PC
android( connect wifi )-------------BTR debugger PC
android( connet ether )------------BTR debugger PC
if ( android in AVD ) ip = 10.0.2.2
else if ( android connect wifi ) ip = BTR debugger PC ip
else if ( android connect ether ) ip = BTR debugger PC ip
Note: android-----ADB cable------BTR debugger PC, can not debug .
windows:
bd > build c:\Wdk8.1\samples\SIOCTL\c++\sys
(1) Focus code, target file
(2) Debug output function name, usually , it is OutputDebugString() .
Linux kernel include : linux
driver , linux module
bd > build /home/usr/mymodule
(1)Focus code, target file
(2)printk debug level :
4:KERN_WARNING 5: KERN_NOTICE 6:KERN_INFO 7: KERN_DEBUG
bd > build /opt/ubootembed/myuboot
(1)Focus code, project name
bd > build /project/mcu/mymcu
(1)Focus code, target file
(2)Debug output function
(3)RAM type( SMALL , MIDDLE , LARGE )
bd > build d:\test\mypython
(1)Focus code, BD IP and project name
bd > build d:\test\my_src_goprj
(1)Focus code, BD IP and project name
bd >
build E:\exer\phptest
(1)Focus code, BD IP and project name
bd >
build E:\app\nodejs_web
(1)Focus code, BD IP and project name
Config Matlab
bd > build d:\test\my_src_matlab
(1)Focus code, BD IP and project name
(2)OS: win
, linux , unix , macos or ios.
bd > build d:\test\my_src_ocprj
(3)Focus code, BD IP and project name
(4)OS: macos or ios.
bd > build d:\test\my_src_swiftprj
(1)Focus code, BD IP and project name
(2)OS: macos or ios.
Embed projects include more type, please see gcc , mcu ,uboot ,qt , android kernel chapters.
bd > build d:\test\myjavaprj
(1)Focus code, BD IP and project name
(2)src root path, class root path
If .class .java files in same path , src_root == class_root
bd > build d:\test\mycsharp
(1)Focus code, BD IP and project name will save in bdebug.ini
PV
functions are P function and V function. P function like:
handle = pfunc(....);
or
pointer = pfunc(....);
V
function like:
vfunc( handle );
or
vfunc(
pointer );
Where
handle is int type( int or short ) , pointer is ram address.
PV
function is resource management function, The first use of resource is P function . The last use of resource is V function.
( malloc
, free ) is a pair of c , c++ PV functions.
pointer = ( PSTRUCT )malloc( size );
free( ( void *)pointer );
Java and
C# PV function only like:
handle = pfunc(....);
vfunc( handle );
By
default, BTR trace the ( malloc,
free ) , ( new , delete ) functions in any time. Others PV function must defined in bdebug.ini.
For
example:
file bdebug.ini:
[PV_FUNCTION]
( fopen , fclose )
( myopensock , myclosesock
)
( AddANode , DelANode )
When debug a project, use command "pv" to
see the un-released resource. BTR look resource handle as pointer.
bd.exe
bd >F2
bd >pv
Usually ,
use bins command add break point , not use bwp (
watch point ). Some processes cannot stop such as kernel, driver, mcu, phone, use watch point instead of break point. Plugin
function bwp() , like:
…
bwp();
…
Process will save the log at watch
point which used for bug analysis.
1) Windriver must set bwp()
2) Linux kernel must set bwp()
3) Uboot must set bwp()
4) MCU must set bwp()
5) Mobile phone may not plugin bwp() ,
but break point is hanled as watch point .
6) Noswjs may not plugin bwp() , but break point is hanled as watch point .
VC
1) build failed
Q:Sometimes
, I use BTR build vc project failed?
A:Please
compile and link vc project in visual studio first ,
then you use BTR build the project.
2) variable
Q: Can I watch all
heap & stack variable?
A: Yes
, you can! vmap command can watch all heap
variables and stack variables . vlog command can watch the history of one
variable.
GCC
1) VMWare
Q: gcc
in VMWare , BD in Windows, how can I debug gcc?
A: Install BD in VMWare . BD in VMWare is as easy as its in windows
Java
1) class root path
Q: my java project have no
class root path , what shall I do?
A: set java rootpath == class rootpath . You should learn
from idea and eclipse . java root path and class root
path in different path.
C#
1) sliverlight
Q: C# app which build by BTR
debugger can run in sliverlight?
A: Yes.
2) 32BIT 64BIT
Q: BTR debugger and .net pc
are not the same pc, one is 32 BIT and another is 64 bit, how can I do?
A: BD is 64 bit, C# is 32
bit, BD can also debug C# project.
PV
Function
1) wrong pv function
Q: error_num
= fopen_s(
&fstream , fname
, "wb" ); Is fopen_s
pv function ?
A: fopen_s( ... ) is not pv function , because error_num
is not resource handle or pointer. You can convert fopen_s( ... ) into pv funtion. For example:
FILE *CConvert::myfopen( const char *fname , const char *mode )
{
FILE *fstream ;
errrno_t
error_num;
error_num
= fopen_s( &fstream , fname , mode );
if ( !error_num ) fstream = NULL;
return fstream;
}
Then , ( myfopen , fclose ) is a pair of pv
function.
2) ( malloc , free ) , ( new , delete )
Q: I add (
malloc , free ) for [PV_FUNCTION] parameter in
bdebug.ini. Is that right?
A: You should not add ( malloc , free ) , ( new , delete
) in bdebug.ini. BTR has already regards them as pv
functions. Bye the way , ram pointer resource pv functions only in C project is valid. Java and c# have integer handle resource pv
functions only.
command
1) log loss
Q: I use BTR debug my project , why its log have no [file][no] location
information.
A: Because your project is
too large and BTR is free version. This problem isn't exist
in BTR enterprise version.
2) build library project
Q: A project use B lib project , lib B use BTR and A does not use BTR build project
, why does it cause error?
A: Rebuild B by hand , then build B by BTR ,then build A by BTR , at last
everything will be OK !