This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Breakpoint and static functions


Here is the output from my GDB session.  Comments after <=====

Thanks.

=============================================================================

$ sparc-coff-gdb --nw
GNU gdb 5.2.1
Copyright 2002 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=i686-pc-cygwin32 --target=sparc-coff".
(gdb) set remotebaud 57600
(gdb) file 330dm4.cof                         <===== OS symbol file
Reading symbols from 330dm4.cof...done.
(gdb) add-symbol-file He.abs 0x084819a0       <===== application symbol file
add symbol table from file "He.abs" at
        .text_addr = 0x84819a0                <===== memory load address (got from loader).
(y or n) y
Reading symbols from He.abs...done.
(gdb) target rem com1
Remote debugging using com1
Ignoring packet error, continuing...

0x07a5465c in breakinst ()                    <===== application is halted while loaded by the loader
(gdb) bt
#0  0x07a5465c in breakinst ()
#1  0x07837ef4 in _ld_Breakpoint ()
    at d:/os33b104/target/src/loader/piloader.cpp:1783
#2  0x085a9b90 in BreakOnInit () at ./src/dm/gui/tw/uim/uimtmain.c:132
#3  0x085ac230 in root (notUsed=0x0) at ./src/dm/gui/tw/uim/uimtmain.c:1936
#4  0x078185b0 in pk_Shell (code=0x85ac208 <root>, data=0x1, notify=0x0)
    at d:/os33b104/target/src/pk/pk_mi.cpp:1927
#5  0x0781856c in pk_Shell (code=0x85ac208 <root>, data=0x1, notify=0x0)
    at d:/os33b104/target/src/pk/pk_mi.cpp:1913

(gdb) b x_LoadFromSource                      <===== break in static function
Breakpoint 1 at 0x84a3018: file ./src/dm/cmn/ctm/ctm_rqst.c, line 9874.
(gdb) c
Continuing.

Breakpoint 1, x_LoadFromSource (rm=0x8648b08, ri=0x83d14d8, t=0x864ba30,
    flags=140818992, retRequestId=0x0) at ./src/dm/cmn/ctm/ctm_rqst.c:9874
9874            if ( ( cw = CM_TargetContentWindow ( t ) ) != NULL )
Current language:  auto; currently c
(gdb) bt
#0  x_LoadFromSource (rm=0x8648b08, ri=0x83d14d8, t=0x864ba30,
    flags=140818992, retRequestId=0x0) at ./src/dm/cmn/ctm/ctm_rqst.c:9874
#1  0x084a276c in x_LoadFromCache (rm=0x8648b08, ri=0x83d14d8, t=0x864ba30,
    flags=2048, retRequestId=0x864ba30) at ./src/dm/cmn/ctm/ctm_rqst.c:9486
#2  0x084a5288 in x_Load (xrm=0x800, ri=0x83d14d8, t=0x864ba30,
    flags=140818992, retRequestId=0x0, doPendingRequest=140806920)
    at ./src/dm/cmn/ctm/ctm_rqst.c:11029
#3  0x084a5028 in x_LoadFacade (xrm=0x8648b08, ri=0x83d14d8, t=0x864ba30,
    flags=2048, retRequestId=0x0) at ./src/dm/cmn/ctm/ctm_rqst.c:10996
#4  0x084a7290 in x_LoadContinuation (cm=0x8648b08, ri=0x800,
    target=0x83d14d8, method=0x864ba30 "TARG", url=0x864ba30 "TARG", flags=0,
    retRequestId=0x0) at ./src/dm/cmn/ctm/ctm.c:714
#5  0x084a8010 in x_GoTo (xcm=0x8648b08, cw=0x800, url=0x83d14d8 "",
    flags=140818992) at ./src/dm/cmn/ctm/ctm.c:1428
#6  0x084aa684 in CM_ContentManagerGoTo (cw=0xb3, url=0x83d1023 "°\bK5o",
    flags=2048) at ./src/dm/cmn/ctm/ctm.c:3744
#7  0x08486d60 in _ahe_LoadURL (window=0x864ba30,
    url=0x800 <Address 0x800 out of bounds>) at ./src/he/api/he.c:778
#8  0x0848334c in _ahe_APIDispatch (event=0x83d14d8)
    at ./src/he/api/hesend.c:1094
#9  0x08483bcc in _ahe_ProcessEvent (context=0x800, event=0x801ea90)
    at ./src/he/api/hesend.c:1260
#10 0x085abc68 in x_UIM_Run (xuim=0x0) at ./src/dm/gui/tw/uim/uimtmain.c:1756
#11 0x085ac3d8 in root (notUsed=0x8648b08)
---Type <return> to continue, or q <return> to quit---q
 at ./src/dm/gui/tw/uim/uimtmain.c:200Quit

(gdb) del 1                                                 <===== "delete" static function breakpoint and continue
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.     <=====  This is the weird part
x_LoadFromSource (rm=0x8648b08, ri=0x83d14d8, t=0x864ba30, flags=140818992,
    retRequestId=0x0) at ./src/dm/cmn/ctm/ctm_rqst.c:9874
9874            if ( ( cw = CM_TargetContentWindow ( t ) ) != NULL )
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.     <===== "continue" does not work
x_LoadFromSource (rm=0x8648b08, ri=0x83d14d8, t=0x864ba30, flags=140818992,
    retRequestId=0x0) at ./src/dm/cmn/ctm/ctm_rqst.c:9874
9874            if ( ( cw = CM_TargetContentWindow ( t ) ) != NULL )
(gdb)

-----Original Message-----
From: Daniel Jacobowitz [mailto:drow@mvista.com] 
Sent: Monday, December 16, 2002 6:07 PM
To: Cheng, Cheuk
Cc: gdb@sources.redhat.com
Subject: Re: Breakpoint and static functions


On Mon, Dec 16, 2002 at 05:24:41PM -0800, Cheng, Cheuk wrote:
> Hi, I am new to GDB and am having problem with the following.  I am 
> using a propietary OS running from ROM on an usparc based embedded 
> system.  This OS has a GDB nub (written in C and inline assembly) in 
> it. Here is what I do.
> 
> - Boot up usparc hardware containing debug build of OS in ROM.
> 
> - set up GDB remote debug link from my PC to the hardware.
> 
> - Enter "file osdebug.cof" at GDB prompt.
> 
> - Enter "add-symbol-file application.cof <load_address>" at GDB 
> prompt.
> 
> - Enter "target rem com1" at GDB prompt.
> 
> - Enter command to load application into RAM inside a PC terminal 
> program.  Wait for it to finish loading.
> 
> - Enter command inside PC terminal program to tell the OS to break 
> into GDB.
> 
> - Enter "b <some_static_function>" at GDB prompt.  Continue 
> application execution.
> 
> - GDB breaks at <some_static_function>.  Enter "continue" to go on.
> 
> - GDB returns "Program received signal SIGTRAP, Trace/breakpoint 
> trap." Now even after I use the "delete" command to remove the 
> breakpoint, if I "continue" GDB will still break at the same spot.  
> Using the "clear" command does not help too.
> 
> - Now if I change the source code of the application to make the 
> function non-static (by removing "static" in the function prototype 
> and rebuild the application binary), then the above message will still 
> appear (and the line number indicated by this message is still a few 
> lines before where I originally set the breakpoint, e.g. b <> was at 
> 9874 while the message indicated break at 9871").  However after I 
> "delete" the original breakpoint, the message appears once and then I 
> can "continue" one more time and no more stopping from now on.
> 
> Am I doing something wrong in GDB?  Or can that be our GDB nub inside 
> the OS is bad (although I can always use the "list" command to view 
> any source module without any problem)?  Or is the use of static 
> function with GDB problematic?  Is it sufficient to have a GDB nub 
> linked into the OS which is running from ROM or the application has to 
> have its own GDB nub?

It sounds like it's having a problem with the technique that you're using for single stepping, at a guess.  Could you send the output of this session after saying 'set debug target 1' and 'set debug remote 1' (before you say "target remote com1").

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


- - - - - - - Appended by PowerTV, Inc. - - - - - - - 
This e-mail and any attachments may contain information that is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]