* RFA: sim/arm/wrapper.c fix
@ 2000-04-01 0:00 glen mccready
2000-03-22 13:18 ` glen mccready
0 siblings, 1 reply; 2+ messages in thread
From: glen mccready @ 2000-04-01 0:00 UTC (permalink / raw)
To: gdb-patches
[Sorry about the first message; misfired.]
Error messages that used `myname' were coming out garbled when
the memory it pointed to got freed too early.
Index: ChangeLog
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/arm/ChangeLog,v
retrieving revision 1.77
diff -c -b -r1.77 ChangeLog
*** ChangeLog 1998/09/14 17:04:36 1.77
- --- ChangeLog 2000/03/22 20:27:15
***************
*** 1,3 ****
- --- 1,7 ----
+ Wed Mar 22 15:24:21 2000 glen mccready <gkm@pobox.com>
+
+ * wrapper.c (sim_open,sim_close): Copy into myname, free myname
+
Mon Sep 14 09:00:05 1998 Nick Clifton <nickc@cygnus.com>
* wrapper.c (sim_open): Set endianness according to BFD or command
Index: wrapper.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/arm/wrapper.c,v
retrieving revision 1.24
diff -c -b -r1.24 wrapper.c
*** wrapper.c 1998/09/14 17:04:36 1.24
- --- wrapper.c 2000/03/22 20:27:15
***************
*** 347,353 ****
char **argv;
{
sim_kind = kind;
! myname = argv[0];
sim_callback = ptr;
/* Decide upon the endian-ness of the processor.
- --- 347,354 ----
char **argv;
{
sim_kind = kind;
! if (myname) free(myname);
! myname = xstrdup(argv[0]);
sim_callback = ptr;
/* Decide upon the endian-ness of the processor.
***************
*** 405,411 ****
SIM_DESC sd;
int quitting;
{
! /* nothing to do */
}
SIM_RC
- --- 406,413 ----
SIM_DESC sd;
int quitting;
{
! if (myname) free(myname);
! myname = 0;
}
SIM_RC
From dima@Chg.RU Sat Apr 01 00:00:00 2000
From: Dmitry Sivachenko <dima@Chg.RU>
To: eliz@is.elta.co.il
Cc: gdb-patches@sourceware.cygnus.com, kettenis@wins.uva.nl, shebs@shebs.cnchost.com
Subject: Re: patch for gdb.texinfo
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200001301820.VAA60073@netserv1.chg.ru>
References: <200001291157.GAA13687@indy.delorie.com>
X-SW-Source: 2000-q1/msg00050.html
Content-length: 760
> I'd expect most users to invoke texi2dvi for this, and texi2dvi
> invokes makeinfo internally. So you probably meant to say ``include
> gdb.dvi'', not texinfo.tex. GDB 4.18 does include the DVI files, so
> printing the unchanged manual is indeed possible without Texinfo being
> involved. You do need makeinfo if you change the Texinfo sources and
> want to update the printed docs.
This sounds like 'I will not use C++ templates, because gcc 2.7 handles them
ugly and many users have that version installed'.
If there is texinfo in your source repository, you may include .dvi version
of unchanged manual into the distribution, and ask user to checkout
texinfo if they are willing to produce .dvi by themselves. It is not so
hard, I think.
BR,
--dima
From eliz@delorie.com Sat Apr 01 00:00:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: jimb@cygnus.com
Cc: hjl@lucon.org, gdb@sourceware.cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: Problems with hardware watchpoint on ia32.
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003312323.SAA07185@indy.delorie.com>
References: <20000307132401.A20282@valinux.com> <200003081008.FAA16481@indy.delorie.com> <20000308084304.A3150@lucon.org> <200003091210.HAA19857@indy.delorie.com> <npya7c6zn7.fsf@zwingli.cygnus.com> <200003221806.NAA14225@indy.delorie.com> <npbt4040t3.fsf@zwingli.cygnus.com>
X-SW-Source: 2000-q1/msg01144.html
Content-length: 905
> > I seem to be unable to reproduce the problem, at least in a C program:
> > whenever I say "watch foo == bar" (where foo and bar are structs), GDB
> > curses thusly:
> >
> > Structure has no component named operator==.
> >
> > Am I missing something?
>
> As Michael points out, structure comparison is broken. But that
> doesn't change my original point --- that it's perfectly legitimate to
> have `struct value' objects representing structures, which should be
> watched in their entirety.
The current sources do support watching an entire struct, the patches
I sent (and Michael commited) have special provisions for this case.
I asked for an example because I want to look into the problem you
were describing and fix it. Do you have any other case where this
problem could happen?
If every instance of such a situation is equally broken, then the
users won't miss this functionality ;-).
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: "Peter.Schauer" <Peter.Schauer@regent.e-technik.tu-muenchen.de>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: RFA: procfs.c:proc_set_watchpoint bug fix
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38C7A799.A06CF13B@cygnus.com>
References: <200003072114.WAA26143@reisser.regent.e-technik.tu-muenchen.de>
X-SW-Source: 2000-q1/msg00617.html
Content-length: 845
"Peter.Schauer" wrote:
> * procfs.c (proc_set_watchpoint): Declare addr parameter as
> CORE_ADDR, to match call from procfs_set_watchpoint.
Might as well get the knife out - convert the definition to ISO-C and
make it static. (Good find, outch!)
enjoy,
Andrew
> *** gdb/procfs.c.orig Wed Mar 1 21:54:05 2000
> --- gdb/procfs.c Sun Mar 5 12:05:33 2000
> ***************
> *** 2580,2586 ****
> int
> proc_set_watchpoint (pi, addr, len, wflags)
> procinfo *pi;
> ! void *addr;
> int len;
> int wflags;
> {
> --- 2580,2586 ----
> int
> proc_set_watchpoint (pi, addr, len, wflags)
> procinfo *pi;
> ! CORE_ADDR addr;
> int len;
> int wflags;
> {
>
> --
> Peter Schauer pes@regent.e-technik.tu-muenchen.de
From ezannoni@cygnus.com Sat Apr 01 00:00:00 2000
From: Elena Zannoni <ezannoni@cygnus.com>
To: Fernando Nasser <fnasser@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: RFA: set unwindonsignal (as promissed)
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <14513.29887.421803.132154@kwikemart.cygnus.com>
References: <38ADFA6A.A45CC83A@cygnus.com>
X-SW-Source: 2000-q1/msg00282.html
Content-length: 8431
Fernando Nasser writes:
> This patch makes everybody happy. Just set the flag as you like.
>
> The default behavior is what gdb used to do before: stay in the frame
> where the signal occurred.
>
>
> 2000-02-18 Fernando Nasser <fnasser@cygnus.com>
>
> * top.c (init_main): Add command set unwindonsignal.
> * infcmd.c (run_stack_dummy): Do not pop frame on random signal.
> * valops.c (hand_function_call): Test for unwind_on_signal and
> act accordingly.
>
Question: Does this command really belong to top.c? Should it be in
valops.c instead, so you avoid the 'extern' in there? I would prefer
so.
(see previous partially aborted idea with 'abandon'. BTW should we
delete that?)
Elena
>
> --
> Fernando Nasser
> Red Hat - Toronto E-Mail: fnasser@cygnus.com
> 2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
> Toronto, Ontario M4P 2C9 Fax: 416-482-6299
>
>
>
> Index: top.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/top.c,v
> retrieving revision 1.2
> diff -c -p -r1.2 top.c
> *** top.c 2000/02/09 03:28:18 1.2
> --- top.c 2000/02/19 01:57:16
> *************** int linesize = 100;
> *** 298,304 ****
> --- 298,311 ----
> from the user, and have the user not notice that the user interface
> is issuing commands too. */
> int server_command;
> +
> + /* This boolean tells what gdb should do if a signal is received while
> in
> + a function called from gdb (call dummy). If set, gdb unwinds the
> stack
> + and restore the context to what as it was before the call.
> + The default is to stop in the frame where the signal was received.
> */
>
> + int unwind_on_signal_p = 0;
> +
> /* Baud rate specified for talking to serial target systems. Default
> is left as -1, so targets can choose their own defaults. */
> /* FIXME: This means that "show remotebaud" and gr_files_info can
> print -1
> *************** The conditional expression must follow t
> *** 4266,4271 ****
> --- 4273,4288 ----
> followed by a new line. The nested commands must be entered one per
> line,\n\
> and should be terminated by the word 'else' or `end'. If an else
> clause\n\
> is used, the same rules apply to its nested commands as to the first
> ones.");
> +
> + add_show_from_set (
> + add_set_cmd ("unwindonsignal", no_class, var_boolean,
> + (char *) &unwind_on_signal_p,
> + "Set unwinding of stack if a signal is received while in a call
> dummy.\n\
> + The unwindonsignal lets the user determine what gdb should do if a
> signal\n\
> + is received while in a function called from gdb (call dummy). If set,
> gdb\n\
> + unwinds the stack and restore the context to what as it was before the
> call.\n\
> + The default is to stop in the frame where the signal was received.",
> &setlist),
> + &showlist);
>
> /* If target is open when baud changes, it doesn't take effect until
> the
> next open (I think, not sure). */
> Index: valops.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/valops.c,v
> retrieving revision 1.1.1.11
> diff -c -p -r1.1.1.11 valops.c
> *** valops.c 2000/02/01 03:19:12 1.1.1.11
> --- valops.c 2000/02/19 01:57:17
> ***************
> *** 47,52 ****
> --- 47,57 ----
> value operations with HP aCC code/runtime. */
> extern int hp_som_som_object_present;
>
> + /* This boolean tells what gdb should do if a signal is received while
> in
> + a function called from gdb (call dummy). If set, gdb unwinds the
> stack
> + and restore the context to what as it was before the call.
> + The default is to stop in the frame where the signal was received.
> */
> + extern int unwind_on_signal_p;
>
> /* Local functions. */
>
> *************** You must use a pointer to function type
> *** 1695,1710 ****
> /* We stopped inside the FUNCTION because of a random signal.
> Further execution of the FUNCTION is not allowed. */
>
> ! /* In this case, we must do the cleanups because we don't
> ! want the dummy anymore (the dummy frame has been poped
> already. */
> ! do_cleanups (old_chain);
> !
> ! /* FIXME: Insert a bunch of wrap_here; name can be very long if
> it's
> ! a C++ name with arguments and stuff. */
> ! error ("\
> ! The program being debugged stopped while in a function called from
> GDB.\n\
> Evaluation of the expression containing the function (%s) will be
> abandoned.",
> ! name);
> }
>
> if (rc == 2)
> --- 1700,1745 ----
> /* We stopped inside the FUNCTION because of a random signal.
> Further execution of the FUNCTION is not allowed. */
>
> ! if (unwind_on_signal_p)
> ! {
> ! /* The user wants the context restored. */
> !
> ! /* We must get back to the frame we were before the dummy
> call. */
> ! POP_FRAME;
> !
> ! /* In this case, we must do the cleanups because we don't
> ! want the dummy anymore */
> ! do_cleanups (old_chain);
> !
> ! /* FIXME: Insert a bunch of wrap_here; name can be very long
> if it's
> ! a C++ name with arguments and stuff. */
> ! error ("\
> ! The program being debugged was signaled while in a function called
> from GDB.\n\
> ! GDB has restored the context to what it was before the call.\n\
> ! To change this behavior use \"set unwindonsignal off\"\n\
> Evaluation of the expression containing the function (%s) will be
> abandoned.",
> ! name);
> ! }
> ! else
> ! {
> ! /* The user wants to stay in the frame where we stopped
> (default).*/
> !
> ! /* If we did the cleanups, we would print a spurious error
> ! message (Unable to restore previously selected frame),
> ! would write the registers from the inf_status (which is
> ! wrong), and would do other wrong things. */
> ! discard_cleanups (old_chain);
> ! discard_inferior_status (inf_status);
> !
> ! /* FIXME: Insert a bunch of wrap_here; name can be very long
> if it's
> ! a C++ name with arguments and stuff. */
> ! error ("\
> ! The program being debugged was signaled while in a function called
> from GDB.\n\
> ! GDB remains in the frame where the signal was received.\n\
> ! To change this behavior use \"set unwindonsignal on\"\n\
> ! Evaluation of the expression containing the function (%s) will be
> abandoned.",
> ! name);
> ! }
> }
>
> if (rc == 2)
> Index: infcmd.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infcmd.c,v
> retrieving revision 1.1.1.17
> diff -c -p -r1.1.1.17 infcmd.c
> *** infcmd.c 2000/02/03 04:14:31 1.1.1.17
> --- infcmd.c 2000/02/19 01:57:18
> *************** run_stack_dummy (addr, buffer)
> *** 926,945 ****
>
> discard_cleanups (old_cleanups);
>
> if (stopped_by_random_signal)
> ! {
> ! /* If the inferior execution fails we need to restore our
> ! stack. It is not done by proceed() in this case. */
> ! /* Pop the empty frame that contains the stack dummy.
> ! POP_FRAME ends with a setting of the current frame, so we
> ! can use that next. */
> ! POP_FRAME;
> ! return 1;
> ! }
>
> /* We may also stop prematurely because we hit a breakpoint in the
> ! called routine. We do not pop the frame as the user may wish
> ! to single step or continue from there. */
> if (!stop_stack_dummy)
> return 2;
>
> --- 926,937 ----
>
> discard_cleanups (old_cleanups);
>
> + /* We can stop during an inferior call because a signal is received.
> */
> if (stopped_by_random_signal)
> ! return 1;
>
> /* We may also stop prematurely because we hit a breakpoint in the
> ! called routine. */
> if (!stop_stack_dummy)
> return 2;
From eliz@delorie.com Sat Apr 01 00:00:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: kingdon@redhat.com
Cc: gdb-patches@sourceware.cygnus.com, shebs@apple.com
Subject: Re: [PATCH] GDB command-line switches and annotations docs
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003120752.CAA24390@indy.delorie.com>
References: <200003101347.IAA21898@indy.delorie.com> <bwvnauczt.fsf@rtl.cygnus.com> <200003101742.MAA22063@indy.delorie.com> <200003101813.NAA21344@devserv.devel.redhat.com>
X-SW-Source: 2000-q1/msg00653.html
Content-length: 279
> (well TeX still isn't getting the "--" right but as far as I know that
> is a texinfo.tex bug, not something we should try to work around).
What is this problem, exactly? Perhaps it should be reported to the
Texinfo maintainer.
What version of texinfo.tex did you use, btw?
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: nsd@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Patch: catch_errors() cleanup chain restore
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38AB5030.C2544706@cygnus.com>
References: <200002112031.UAA02868@nog.bosbc.com>
X-SW-Source: 2000-q1/msg00209.html
Content-length: 1741
nsd@cygnus.com wrote:
>
> Hi,
>
> If a quit happens within catch_errors(RETURN_MASK_ERROR), the cleanup
> chain gets lost.
>
> This is the offending sequence of events:
> 1. catch_errors() calls save_cleanups(), which zeros the cleanup chain.
> 2. catch_errors() redirects the error longjmp target to a location that
> will call restore_cleanups(), but doesn't redirect the quit longjmp
> target similarly when RETURN_MASK_ERROR is specified.
> 3. A subsequent quit event longjmps back to top level, skipping past
> the restore_cleanups() call in catch_errors().
>
> An error within catch_errors(RETURN_MASK_QUIT) would have the same effect,
> but there aren't any such calls in gdb at the moment.
>
> It's easy to fix by:
> 1. unconditionally redirecting both the error and quit longjmp targets;
> 2. calling the function argument;
> 3. restoring the cleanup chain;
> 4. calling return_to_top_level() if appropriate.
>
> I've appended a patch to do that. Comments welcome,
>
> Nick Duffek
> nsd@cygnus.com
Um, I think you've just pointed to a far nastier bug:
Consider the stack:
catch_errors (MASK_ALL)
error_return = quit_return = (1)
...
-> catch_errors (MASK_ERRORS)
saved_error = error_return /* (1) */
error_return = (2)
...
-> catch_errors (MASK_QUIT)
saved_quit = quit_return /* (1) */
quit_return = (3)
...
-> error ()
-> return_to_top_level (ERROR)
where (1), (2), and (3) denote setjmp points. After the long jmp we end
up with:
catch_errors (MASK_ALL)
...
with:
error_return == (1) and quit_return == (3)
A subsequent call to quit() would land GDB in the middle of (3) a popped
stack :-(
Can anyone confirm this?
Andrew
PS: Goto's result in bad kama :-)
From eliz@delorie.com Sat Apr 01 00:00:00 2000
From: Eli Zaretskii <eliz@delorie.com>
To: msnyder@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: gdb.texinfo broken?
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003211819.NAA12435@indy.delorie.com>
References: <38D6CF69.6844@cygnus.com>
X-SW-Source: 2000-q1/msg00861.html
Content-length: 328
> Following the recent spate of patches to gdb.texinfo,
> I find that I cannot build gdb.info; it's been a long
> time since I tried, so I do not know exactly when or
> with what patch it broke.
Can you post the error mesage(s) you get from "make info"? perhaps
they are descriptive enough to identify the offending line(s).
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: David Taylor <taylor@cygnus.com>
Cc: Michael Snyder <msnyder@cygnus.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: [RFC]: internal_error should call target_terminal_ours
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38E29C4F.72C114E3@cygnus.com>
References: <200003292312.SAA26979@texas.cygnus.com>
X-SW-Source: 2000-q1/msg01114.html
Content-length: 1541
David Taylor wrote:
>
> Date: Wed, 29 Mar 2000 12:10:02 -0800
> From: Michael Snyder <msnyder@cygnus.com>
>
> I just encountered a situation where internal_error was called
> while the target program was running, resulting in the following:
>
> gdb-internal-error: gdbarch: gdbarch_breakpoint_from_pc invalid
> An internal GDB error was detected. This may make make further
> debugging unreliable. Continue this debugging session? (y or n)
> Suspended (tty input)
> %] msnyder<547>%
>
> As you can see, instead of waiting for my input, GDB suspended
> because it didn't own the tty.
>
> It's probably a bad thing (tm) to call internal_error while the
> inferior is running, but in case it does happen, I wonder what
> people think about the following?
>
> I think that you're right that adding target_terminal_ours would be a
> good thing. But, my inclination is to put it closer to the actual i/o
> -- namely in internal_verror rather than internal_error.
>
> Additionally, looking at internal_verror, I think that it should call
> quit_force rather than calling exit -- as it is now it just abandons
> the target.
My only thought is that I'm not sure if target_terminal_ours() is
idenpotent. See remote.c where, due to async, it was being called
multiple times. I ended up adding code to make the functions
idenpotent. Should that code be moved to target.c?
David's made a good point. Everything goes through internal_verror().
Hey, i planned it that way :-)
Andrew
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Brian Youmans <3diff@flib.gnu.ai.mit.edu>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: new GDB soon?
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <389F25B8.18196557@cygnus.com>
References: <200002071923.OAA30606@flib.gnu.ai.mit.edu>
X-SW-Source: 2000-q1/msg00085.html
Content-length: 503
Brian Youmans wrote:
>
> Hi everybody! Congrats on the Red Hat buyout!!
>
> Spring is just around the corner (at least at
> Red Hat hq in North Carolina, if not here in Boston.)
> And that means that the FSF is running out of printed
> GDB manuals, and I'd like to know (if possible) when
> the manual for the next version will be ready. I
> assume that a new version of GDB is expected this
> spring?
October? No, the release will be ready a good 6 monts before then -
sometime in March.
Andrew
From jimb@zwingli.cygnus.com Sat Apr 01 00:00:00 2000
From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Kevin Buettner <kevinb@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Linux sigtramp detection code moved to its proper place
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <npsnxp8ix6.fsf@zwingli.cygnus.com>
References: <200003162241.RAA19616@zwingli.cygnus.com> <1000316225504.ZM3009@ocotillo.lan>
X-SW-Source: 2000-q1/msg00757.html
Content-length: 22059
I'm sorry --- this is obviously a tdep issue. Does the following
change look better?
2000-03-17 Jim Blandy <jimb@redhat.com>
* i386-linux-nat.c: No need to #include "frame.h" any more.
(LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0,
LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1,
LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, linux_sigtramp_code,
LINUX_SIGTRAMP_LEN, i386_linux_sigtramp_start,
LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0,
LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1,
linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN,
i386_linux_rt_sigtramp_start, i386_linux_in_sigtramp,
i386_linux_sigcontext_addr, LINUX_SIGCONTEXT_PC_OFFSET,
i386_linux_sigtramp_saved_pc, LINUX_SIGCONTEXT_SP_OFFSET,
i386_linux_sigtramp_saved_sp): Deleted. Folks rightly pointed
out that these are target-dependent, and useful in non-native
configurations. Moved to...
* i386-linux-tdep.c: ... Here, a new file.
* Makefile.in (ALLDEPFILES): Add i386-linux-tdep.c.
(i386-linux-tdep.o): New rule.
(i386-linux-nat.o): We no longer depend on frame.h.
* config/i386/linux.mt (TDEPFILES): Add i386-linux-tdep.o.
Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.13
diff -c -r1.13 Makefile.in
*** gdb/Makefile.in 2000/03/16 10:23:38 1.13
--- gdb/Makefile.in 2000/03/17 19:59:40
***************
*** 1063,1068 ****
--- 1063,1069 ----
i386-tdep.c i386b-nat.c i386mach-nat.c i386v-nat.c i386-linux-nat.c \
i386aix-nat.c i386m3-nat.c i386v4-nat.c i386ly-tdep.c \
i387-tdep.c \
+ i386-linux-tdep.c \
i960-tdep.c \
infptrace.c inftarg.c irix4-nat.c irix5-nat.c isi-xdep.c \
lynx-nat.c m3-nat.c \
***************
*** 1395,1401 ****
$(inferior_h) language.h target.h
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
! $(symtab_h) $(frame_h) symfile.h objfiles.h
i386v4-nat.o: i386v4-nat.c $(defs_h)
--- 1396,1405 ----
$(inferior_h) language.h target.h
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
! $(symtab_h) symfile.h objfiles.h
!
! i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
! $(value_h)
i386v4-nat.o: i386v4-nat.c $(defs_h)
Index: gdb/i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.7
diff -c -r1.7 i386-linux-nat.c
*** gdb/i386-linux-nat.c 2000/03/16 23:53:35 1.7
--- gdb/i386-linux-nat.c 2000/03/17 19:59:41
***************
*** 23,29 ****
/* For i386_linux_skip_solib_resolver. */
#include "symtab.h"
- #include "frame.h"
#include "symfile.h"
#include "objfiles.h"
--- 23,28 ----
***************
*** 1041,1303 ****
return result;
return 0;
- }
-
- \f
- /* Recognizing signal handler frames. */
-
- /* Linux has two flavors of signals. Normal signal handlers, and
- "realtime" (RT) signals. The RT signals can provide additional
- information to the signal handler if the SA_SIGINFO flag is set
- when establishing a signal handler using `sigaction'. It is not
- unlikely that future versions of Linux will support SA_SIGINFO for
- normal signals too. */
-
- /* When the i386 Linux kernel calls a signal handler and the
- SA_RESTORER flag isn't set, the return address points to a bit of
- code on the stack. This function returns whether the PC appears to
- be within this bit of code.
-
- The instruction sequence for normal signals is
- pop %eax
- mov $0x77,%eax
- int $0x80
- or 0x58 0xb8 0x77 0x00 0x00 0x00 0xcd 0x80.
-
- Checking for the code sequence should be somewhat reliable, because
- the effect is to call the system call sigreturn. This is unlikely
- to occur anywhere other than a signal trampoline.
-
- It kind of sucks that we have to read memory from the process in
- order to identify a signal trampoline, but there doesn't seem to be
- any other way. The IN_SIGTRAMP macro in tm-linux.h arranges to
- only call us if no function name could be identified, which should
- be the case since the code is on the stack.
-
- Detection of signal trampolines for handlers that set the
- SA_RESTORER flag is in general not possible. Unfortunately this is
- what the GNU C Library has been doing for quite some time now.
- However, as of version 2.1.2, the GNU C Library uses signal
- trampolines (named __restore and __restore_rt) that are identical
- to the ones used by the kernel. Therefore, these trampolines are
- supported too. */
-
- #define LINUX_SIGTRAMP_INSN0 (0x58) /* pop %eax */
- #define LINUX_SIGTRAMP_OFFSET0 (0)
- #define LINUX_SIGTRAMP_INSN1 (0xb8) /* mov $NNNN,%eax */
- #define LINUX_SIGTRAMP_OFFSET1 (1)
- #define LINUX_SIGTRAMP_INSN2 (0xcd) /* int */
- #define LINUX_SIGTRAMP_OFFSET2 (6)
-
- static const unsigned char linux_sigtramp_code[] =
- {
- LINUX_SIGTRAMP_INSN0, /* pop %eax */
- LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77,%eax */
- LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */
- };
-
- #define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
-
- /* If PC is in a sigtramp routine, return the address of the start of
- the routine. Otherwise, return 0. */
-
- static CORE_ADDR
- i386_linux_sigtramp_start (CORE_ADDR pc)
- {
- unsigned char buf[LINUX_SIGTRAMP_LEN];
-
- /* We only recognize a signal trampoline if PC is at the start of
- one of the three instructions. We optimize for finding the PC at
- the start, as will be the case when the trampoline is not the
- first frame on the stack. We assume that in the case where the
- PC is not at the start of the instruction sequence, there will be
- a few trailing readable bytes on the stack. */
-
- if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0)
- return 0;
-
- if (buf[0] != LINUX_SIGTRAMP_INSN0)
- {
- int adjust;
-
- switch (buf[0])
- {
- case LINUX_SIGTRAMP_INSN1:
- adjust = LINUX_SIGTRAMP_OFFSET1;
- break;
- case LINUX_SIGTRAMP_INSN2:
- adjust = LINUX_SIGTRAMP_OFFSET2;
- break;
- default:
- return 0;
- }
-
- pc -= adjust;
-
- if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0)
- return 0;
- }
-
- if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
- return 0;
-
- return pc;
- }
-
- /* This function does the same for RT signals. Here the instruction
- sequence is
- mov $0xad,%eax
- int $0x80
- or 0xb8 0xad 0x00 0x00 0x00 0xcd 0x80.
-
- The effect is to call the system call rt_sigreturn. */
-
- #define LINUX_RT_SIGTRAMP_INSN0 (0xb8) /* mov $NNNN,%eax */
- #define LINUX_RT_SIGTRAMP_OFFSET0 (0)
- #define LINUX_RT_SIGTRAMP_INSN1 (0xcd) /* int */
- #define LINUX_RT_SIGTRAMP_OFFSET1 (5)
-
- static const unsigned char linux_rt_sigtramp_code[] =
- {
- LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad,%eax */
- LINUX_RT_SIGTRAMP_INSN1, 0x80 /* int $0x80 */
- };
-
- #define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
-
- /* If PC is in a RT sigtramp routine, return the address of the start
- of the routine. Otherwise, return 0. */
-
- static CORE_ADDR
- i386_linux_rt_sigtramp_start (CORE_ADDR pc)
- {
- unsigned char buf[LINUX_RT_SIGTRAMP_LEN];
-
- /* We only recognize a signal trampoline if PC is at the start of
- one of the two instructions. We optimize for finding the PC at
- the start, as will be the case when the trampoline is not the
- first frame on the stack. We assume that in the case where the
- PC is not at the start of the instruction sequence, there will be
- a few trailing readable bytes on the stack. */
-
- if (read_memory_nobpt (pc, (char *) buf, LINUX_RT_SIGTRAMP_LEN) != 0)
- return 0;
-
- if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
- {
- if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
- return 0;
-
- pc -= LINUX_RT_SIGTRAMP_OFFSET1;
-
- if (read_memory_nobpt (pc, (char *) buf, LINUX_RT_SIGTRAMP_LEN) != 0)
- return 0;
- }
-
- if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
- return 0;
-
- return pc;
- }
-
- /* Return whether PC is in a Linux sigtramp routine. */
-
- int
- i386_linux_in_sigtramp (CORE_ADDR pc, char *name)
- {
- if (name)
- return STREQ ("__restore", name) || STREQ ("__restore_rt", name);
-
- return (i386_linux_sigtramp_start (pc) != 0
- || i386_linux_rt_sigtramp_start (pc) != 0);
- }
-
- /* Assuming FRAME is for a Linux sigtramp routine, return the address
- of the associated sigcontext structure. */
-
- CORE_ADDR
- i386_linux_sigcontext_addr (struct frame_info *frame)
- {
- CORE_ADDR pc;
-
- pc = i386_linux_sigtramp_start (frame->pc);
- if (pc)
- {
- CORE_ADDR sp;
-
- if (frame->next)
- /* If this isn't the top frame, the next frame must be for the
- signal handler itself. The sigcontext structure lives on
- the stack, right after the signum argument. */
- return frame->next->frame + 12;
-
- /* This is the top frame. We'll have to find the address of the
- sigcontext structure by looking at the stack pointer. Keep
- in mind that the first instruction of the sigtramp code is
- "pop %eax". If the PC is at this instruction, adjust the
- returned value accordingly. */
- sp = read_register (SP_REGNUM);
- if (pc == frame->pc)
- return sp + 4;
- return sp;
- }
-
- pc = i386_linux_rt_sigtramp_start (frame->pc);
- if (pc)
- {
- if (frame->next)
- /* If this isn't the top frame, the next frame must be for the
- signal handler itself. The sigcontext structure is part of
- the user context. A pointer to the user context is passed
- as the third argument to the signal handler. */
- return read_memory_integer (frame->next->frame + 16, 4) + 20;
-
- /* This is the top frame. Again, use the stack pointer to find
- the address of the sigcontext structure. */
- return read_memory_integer (read_register (SP_REGNUM) + 8, 4) + 20;
- }
-
- error ("Couldn't recognize signal trampoline.");
- return 0;
- }
-
- /* Offset to saved PC in sigcontext, from <asm/sigcontext.h>. */
- #define LINUX_SIGCONTEXT_PC_OFFSET (56)
-
- /* Assuming FRAME is for a Linux sigtramp routine, return the saved
- program counter. */
-
- CORE_ADDR
- i386_linux_sigtramp_saved_pc (struct frame_info *frame)
- {
- CORE_ADDR addr;
- addr = i386_linux_sigcontext_addr (frame);
- return read_memory_integer (addr + LINUX_SIGCONTEXT_PC_OFFSET, 4);
- }
-
- /* Offset to saved SP in sigcontext, from <asm/sigcontext.h>. */
- #define LINUX_SIGCONTEXT_SP_OFFSET (28)
-
- /* Assuming FRAME is for a Linux sigtramp routine, return the saved
- stack pointer. */
-
- CORE_ADDR
- i386_linux_sigtramp_saved_sp (struct frame_info *frame)
- {
- CORE_ADDR addr;
- addr = i386_linux_sigcontext_addr (frame);
- return read_memory_integer (addr + LINUX_SIGCONTEXT_SP_OFFSET, 4);
- }
-
- /* Immediately after a function call, return the saved pc. */
-
- CORE_ADDR
- i386_linux_saved_pc_after_call (struct frame_info *frame)
- {
- if (frame->signal_handler_caller)
- return i386_linux_sigtramp_saved_pc (frame);
-
- return read_memory_integer (read_register (SP_REGNUM), 4);
}
\f
--- 1040,1045 ----
Index: gdb/i386-linux-tdep.c
===================================================================
RCS file: i386-linux-tdep.c
diff -N i386-linux-tdep.c
*** gdb/i386-linux-tdep.c Tue May 5 13:32:27 1998
--- gdb/i386-linux-tdep.c Fri Mar 17 11:59:41 2000
***************
*** 0 ****
--- 1,281 ----
+ /* Target-dependent code for Linux running on i386's, for GDB.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+ #include "defs.h"
+ #include "gdbcore.h"
+ #include "frame.h"
+ #include "value.h"
+
+ \f
+ /* Recognizing signal handler frames. */
+
+ /* Linux has two flavors of signals. Normal signal handlers, and
+ "realtime" (RT) signals. The RT signals can provide additional
+ information to the signal handler if the SA_SIGINFO flag is set
+ when establishing a signal handler using `sigaction'. It is not
+ unlikely that future versions of Linux will support SA_SIGINFO for
+ normal signals too. */
+
+ /* When the i386 Linux kernel calls a signal handler and the
+ SA_RESTORER flag isn't set, the return address points to a bit of
+ code on the stack. This function returns whether the PC appears to
+ be within this bit of code.
+
+ The instruction sequence for normal signals is
+ pop %eax
+ mov $0x77,%eax
+ int $0x80
+ or 0x58 0xb8 0x77 0x00 0x00 0x00 0xcd 0x80.
+
+ Checking for the code sequence should be somewhat reliable, because
+ the effect is to call the system call sigreturn. This is unlikely
+ to occur anywhere other than a signal trampoline.
+
+ It kind of sucks that we have to read memory from the process in
+ order to identify a signal trampoline, but there doesn't seem to be
+ any other way. The IN_SIGTRAMP macro in tm-linux.h arranges to
+ only call us if no function name could be identified, which should
+ be the case since the code is on the stack.
+
+ Detection of signal trampolines for handlers that set the
+ SA_RESTORER flag is in general not possible. Unfortunately this is
+ what the GNU C Library has been doing for quite some time now.
+ However, as of version 2.1.2, the GNU C Library uses signal
+ trampolines (named __restore and __restore_rt) that are identical
+ to the ones used by the kernel. Therefore, these trampolines are
+ supported too. */
+
+ #define LINUX_SIGTRAMP_INSN0 (0x58) /* pop %eax */
+ #define LINUX_SIGTRAMP_OFFSET0 (0)
+ #define LINUX_SIGTRAMP_INSN1 (0xb8) /* mov $NNNN,%eax */
+ #define LINUX_SIGTRAMP_OFFSET1 (1)
+ #define LINUX_SIGTRAMP_INSN2 (0xcd) /* int */
+ #define LINUX_SIGTRAMP_OFFSET2 (6)
+
+ static const unsigned char linux_sigtramp_code[] =
+ {
+ LINUX_SIGTRAMP_INSN0, /* pop %eax */
+ LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77,%eax */
+ LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */
+ };
+
+ #define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
+
+ /* If PC is in a sigtramp routine, return the address of the start of
+ the routine. Otherwise, return 0. */
+
+ static CORE_ADDR
+ i386_linux_sigtramp_start (CORE_ADDR pc)
+ {
+ unsigned char buf[LINUX_SIGTRAMP_LEN];
+
+ /* We only recognize a signal trampoline if PC is at the start of
+ one of the three instructions. We optimize for finding the PC at
+ the start, as will be the case when the trampoline is not the
+ first frame on the stack. We assume that in the case where the
+ PC is not at the start of the instruction sequence, there will be
+ a few trailing readable bytes on the stack. */
+
+ if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0)
+ return 0;
+
+ if (buf[0] != LINUX_SIGTRAMP_INSN0)
+ {
+ int adjust;
+
+ switch (buf[0])
+ {
+ case LINUX_SIGTRAMP_INSN1:
+ adjust = LINUX_SIGTRAMP_OFFSET1;
+ break;
+ case LINUX_SIGTRAMP_INSN2:
+ adjust = LINUX_SIGTRAMP_OFFSET2;
+ break;
+ default:
+ return 0;
+ }
+
+ pc -= adjust;
+
+ if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0)
+ return 0;
+ }
+
+ if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
+ return 0;
+
+ return pc;
+ }
+
+ /* This function does the same for RT signals. Here the instruction
+ sequence is
+ mov $0xad,%eax
+ int $0x80
+ or 0xb8 0xad 0x00 0x00 0x00 0xcd 0x80.
+
+ The effect is to call the system call rt_sigreturn. */
+
+ #define LINUX_RT_SIGTRAMP_INSN0 (0xb8) /* mov $NNNN,%eax */
+ #define LINUX_RT_SIGTRAMP_OFFSET0 (0)
+ #define LINUX_RT_SIGTRAMP_INSN1 (0xcd) /* int */
+ #define LINUX_RT_SIGTRAMP_OFFSET1 (5)
+
+ static const unsigned char linux_rt_sigtramp_code[] =
+ {
+ LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad,%eax */
+ LINUX_RT_SIGTRAMP_INSN1, 0x80 /* int $0x80 */
+ };
+
+ #define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
+
+ /* If PC is in a RT sigtramp routine, return the address of the start
+ of the routine. Otherwise, return 0. */
+
+ static CORE_ADDR
+ i386_linux_rt_sigtramp_start (CORE_ADDR pc)
+ {
+ unsigned char buf[LINUX_RT_SIGTRAMP_LEN];
+
+ /* We only recognize a signal trampoline if PC is at the start of
+ one of the two instructions. We optimize for finding the PC at
+ the start, as will be the case when the trampoline is not the
+ first frame on the stack. We assume that in the case where the
+ PC is not at the start of the instruction sequence, there will be
+ a few trailing readable bytes on the stack. */
+
+ if (read_memory_nobpt (pc, (char *) buf, LINUX_RT_SIGTRAMP_LEN) != 0)
+ return 0;
+
+ if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
+ {
+ if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
+ return 0;
+
+ pc -= LINUX_RT_SIGTRAMP_OFFSET1;
+
+ if (read_memory_nobpt (pc, (char *) buf, LINUX_RT_SIGTRAMP_LEN) != 0)
+ return 0;
+ }
+
+ if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
+ return 0;
+
+ return pc;
+ }
+
+ /* Return whether PC is in a Linux sigtramp routine. */
+
+ int
+ i386_linux_in_sigtramp (CORE_ADDR pc, char *name)
+ {
+ if (name)
+ return STREQ ("__restore", name) || STREQ ("__restore_rt", name);
+
+ return (i386_linux_sigtramp_start (pc) != 0
+ || i386_linux_rt_sigtramp_start (pc) != 0);
+ }
+
+ /* Assuming FRAME is for a Linux sigtramp routine, return the address
+ of the associated sigcontext structure. */
+
+ CORE_ADDR
+ i386_linux_sigcontext_addr (struct frame_info *frame)
+ {
+ CORE_ADDR pc;
+
+ pc = i386_linux_sigtramp_start (frame->pc);
+ if (pc)
+ {
+ CORE_ADDR sp;
+
+ if (frame->next)
+ /* If this isn't the top frame, the next frame must be for the
+ signal handler itself. The sigcontext structure lives on
+ the stack, right after the signum argument. */
+ return frame->next->frame + 12;
+
+ /* This is the top frame. We'll have to find the address of the
+ sigcontext structure by looking at the stack pointer. Keep
+ in mind that the first instruction of the sigtramp code is
+ "pop %eax". If the PC is at this instruction, adjust the
+ returned value accordingly. */
+ sp = read_register (SP_REGNUM);
+ if (pc == frame->pc)
+ return sp + 4;
+ return sp;
+ }
+
+ pc = i386_linux_rt_sigtramp_start (frame->pc);
+ if (pc)
+ {
+ if (frame->next)
+ /* If this isn't the top frame, the next frame must be for the
+ signal handler itself. The sigcontext structure is part of
+ the user context. A pointer to the user context is passed
+ as the third argument to the signal handler. */
+ return read_memory_integer (frame->next->frame + 16, 4) + 20;
+
+ /* This is the top frame. Again, use the stack pointer to find
+ the address of the sigcontext structure. */
+ return read_memory_integer (read_register (SP_REGNUM) + 8, 4) + 20;
+ }
+
+ error ("Couldn't recognize signal trampoline.");
+ return 0;
+ }
+
+ /* Offset to saved PC in sigcontext, from <asm/sigcontext.h>. */
+ #define LINUX_SIGCONTEXT_PC_OFFSET (56)
+
+ /* Assuming FRAME is for a Linux sigtramp routine, return the saved
+ program counter. */
+
+ CORE_ADDR
+ i386_linux_sigtramp_saved_pc (struct frame_info *frame)
+ {
+ CORE_ADDR addr;
+ addr = i386_linux_sigcontext_addr (frame);
+ return read_memory_integer (addr + LINUX_SIGCONTEXT_PC_OFFSET, 4);
+ }
+
+ /* Offset to saved SP in sigcontext, from <asm/sigcontext.h>. */
+ #define LINUX_SIGCONTEXT_SP_OFFSET (28)
+
+ /* Assuming FRAME is for a Linux sigtramp routine, return the saved
+ stack pointer. */
+
+ CORE_ADDR
+ i386_linux_sigtramp_saved_sp (struct frame_info *frame)
+ {
+ CORE_ADDR addr;
+ addr = i386_linux_sigcontext_addr (frame);
+ return read_memory_integer (addr + LINUX_SIGCONTEXT_SP_OFFSET, 4);
+ }
+
+ /* Immediately after a function call, return the saved pc. */
+
+ CORE_ADDR
+ i386_linux_saved_pc_after_call (struct frame_info *frame)
+ {
+ if (frame->signal_handler_caller)
+ return i386_linux_sigtramp_saved_pc (frame);
+
+ return read_memory_integer (read_register (SP_REGNUM), 4);
+ }
Index: gdb/config/i386/linux.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux.mt,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 linux.mt
*** gdb/config/i386/linux.mt 1999/04/16 01:34:19 1.1.1.1
--- gdb/config/i386/linux.mt 2000/03/17 19:59:41
***************
*** 1,5 ****
# Target: Intel 386 running GNU/Linux
! TDEPFILES= i386-tdep.o i387-tdep.o
TM_FILE= tm-linux.h
GDBSERVER_DEPFILES= low-linux.o
--- 1,5 ----
# Target: Intel 386 running GNU/Linux
! TDEPFILES= i386-tdep.o i386-linux-tdep.o i387-tdep.o
TM_FILE= tm-linux.h
GDBSERVER_DEPFILES= low-linux.o
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: green@redhat.com
Cc: gdb-patches@sourceware.cygnus.com, jimb@cygnus.com, tromey@cygnus.com
Subject: Re: Patch: handle N_MAIN stab
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38DF1DC2.17D53B85@cygnus.com>
References: <200003051039.CAA04980@hoser.cygnus.com>
X-SW-Source: 2000-q1/msg01052.html
Content-length: 7737
FYI,
I think this patch slipped into limbo as it tweeks a number of files.
I believe JimK identified a memory leak.
For my part, I'd suggest ``main_name ()'' (or what ever) in symtab.[hc]
or source.h (anyway somewhere more applicable then defs.h which as
enough fluff :-).
enjoy,
Andrew
> 2000-03-05 Anthony Green <green@redhat.com>
>
> * defs.h (main_name): Declare.
> * dbxread.c (process_one_symbol): Handle the N_MAIN stab by
> setting main_name.
> * blockframe.c (inside_main_func): Use main_name instead of
> "main".
> * symtab.c (find_main_psymtab): Ditto.
> * source.c (select_source_symtab): Ditto.
> * nlmread.c (nlm_symfile_read): Ditto.
> * rs6000-tdep.c (skip_prologue): Ditto.
>
> Index: gdb//blockframe.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/blockframe.c,v
> retrieving revision 1.1.1.11
> diff -p -r1.1.1.11 blockframe.c
> *** blockframe.c 1999/12/22 21:45:03 1.1.1.11
> --- blockframe.c 2000/03/05 10:20:27
> *************** inside_main_func (pc)
> *** 127,133 ****
> {
> struct symbol *mainsym;
>
> ! mainsym = lookup_symbol ("main", NULL, VAR_NAMESPACE, NULL, NULL);
> if (mainsym && SYMBOL_CLASS (mainsym) == LOC_BLOCK)
> {
> symfile_objfile->ei.main_func_lowpc =
> --- 127,133 ----
> {
> struct symbol *mainsym;
>
> ! mainsym = lookup_symbol (main_name, NULL, VAR_NAMESPACE, NULL, NULL);
> if (mainsym && SYMBOL_CLASS (mainsym) == LOC_BLOCK)
> {
> symfile_objfile->ei.main_func_lowpc =
> Index: gdb//dbxread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dbxread.c,v
> retrieving revision 1.1.1.10
> diff -p -r1.1.1.10 dbxread.c
> *** dbxread.c 2000/01/06 03:06:36 1.1.1.10
> --- dbxread.c 2000/03/05 10:20:29
> *************** process_one_symbol (type, desc, valu, na
> *** 2426,2438 ****
> }
> break;
>
> /* The following symbol types can be ignored. */
> case N_OBJ: /* Solaris 2: Object file dir and name */
> /* N_UNDF: Solaris 2: file separator mark */
> /* N_UNDF: -- we will never encounter it, since we only process one
> file's symbols at once. */
> case N_ENDM: /* Solaris 2: End of module */
> - case N_MAIN: /* Name of main routine. */
> case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
> break;
> }
> --- 2426,2442 ----
> }
> break;
>
> + case N_MAIN: /* Name of main routine. */
> + if (name)
> + main_name = xstrdup (name);
> + break;
> +
> /* The following symbol types can be ignored. */
> case N_OBJ: /* Solaris 2: Object file dir and name */
> /* N_UNDF: Solaris 2: file separator mark */
> /* N_UNDF: -- we will never encounter it, since we only process one
> file's symbols at once. */
> case N_ENDM: /* Solaris 2: End of module */
> case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
> break;
> }
> Index: gdb//defs.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/defs.h,v
> retrieving revision 1.9
> diff -p -r1.9 defs.h
> *** defs.h 2000/03/04 02:23:06 1.9
> --- defs.h 2000/03/05 10:20:30
> *************** enum gdb_rc gdb_list_thread_ids (/* outp
> *** 1314,1317 ****
> --- 1314,1321 ----
>
> /* Switch thread and print notification. */
> #endif
> +
> + /* From source.c */
> + extern char *main_name;
> +
> #endif /* #ifndef DEFS_H */
> Index: gdb//nlmread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/nlmread.c,v
> retrieving revision 1.1.1.4
> diff -p -r1.1.1.4 nlmread.c
> *** nlmread.c 1999/08/09 21:33:43 1.1.1.4
> --- nlmread.c 2000/03/05 10:20:31
> *************** nlm_symfile_read (objfile, mainline)
> *** 206,212 ****
> stabsect_build_psymtabs (objfile, mainline, ".stab",
> ".stabstr", ".text");
>
> ! mainsym = lookup_symbol ("main", NULL, VAR_NAMESPACE, NULL, NULL);
>
> if (mainsym
> && SYMBOL_CLASS (mainsym) == LOC_BLOCK)
> --- 206,212 ----
> stabsect_build_psymtabs (objfile, mainline, ".stab",
> ".stabstr", ".text");
>
> ! mainsym = lookup_symbol (main_name, NULL, VAR_NAMESPACE, NULL, NULL);
>
> if (mainsym
> && SYMBOL_CLASS (mainsym) == LOC_BLOCK)
> Index: gdb//rs6000-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
> retrieving revision 1.5
> diff -p -r1.5 rs6000-tdep.c
> *** rs6000-tdep.c 2000/02/26 09:30:30 1.5
> --- rs6000-tdep.c 2000/03/05 10:20:32
> *************** skip_prologue (CORE_ADDR pc, struct rs60
> *** 573,579 ****
> function as well. */
>
> tmp = find_pc_misc_function (pc);
> ! if (tmp >= 0 && STREQ (misc_function_vector[tmp].name, "main"))
> return pc + 8;
> }
> }
> --- 573,579 ----
> function as well. */
>
> tmp = find_pc_misc_function (pc);
> ! if (tmp >= 0 && STREQ (misc_function_vector[tmp].name, main_name))
> return pc + 8;
> }
> }
> Index: gdb//source.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/source.c,v
> retrieving revision 1.1.1.12
> diff -p -r1.1.1.12 source.c
> *** source.c 2000/02/03 04:14:35 1.1.1.12
> --- source.c 2000/03/05 10:20:35
> *************** static int first_line_listed;
> *** 119,124 ****
> --- 119,127 ----
>
> static struct symtab *last_source_visited = NULL;
> static int last_source_error = 0;
> +
> + /* The default "main" symbol. */
> + char *main_name = "main";
>
>
> /* Set the source file default for the "list" command to be S.
> *************** select_source_symtab (s)
> *** 151,159 ****
>
> /* Make the default place to list be the function `main'
> if one exists. */
> ! if (lookup_symbol ("main", 0, VAR_NAMESPACE, 0, NULL))
> {
> ! sals = decode_line_spec ("main", 1);
> sal = sals.sals[0];
> free (sals.sals);
> current_source_symtab = sal.symtab;
> --- 154,162 ----
>
> /* Make the default place to list be the function `main'
> if one exists. */
> ! if (lookup_symbol (main_name, 0, VAR_NAMESPACE, 0, NULL))
> {
> ! sals = decode_line_spec (main_name, 1);
> sal = sals.sals[0];
> free (sals.sals);
> current_source_symtab = sal.symtab;
> Index: gdb//symtab.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.c,v
> retrieving revision 1.2
> diff -p -r1.2 symtab.c
> *** symtab.c 2000/02/08 04:39:02 1.2
> --- symtab.c 2000/03/05 10:20:37
> *************** find_main_psymtab ()
> *** 1172,1178 ****
>
> ALL_PSYMTABS (objfile, pst)
> {
> ! if (lookup_partial_symbol (pst, "main", 1, VAR_NAMESPACE))
> {
> return (pst);
> }
> --- 1172,1178 ----
>
> ALL_PSYMTABS (objfile, pst)
> {
> ! if (lookup_partial_symbol (pst, main_name, 1, VAR_NAMESPACE))
> {
> return (pst);
> }
>
> --
> Anthony Green Red Hat
> Sunnyvale, California
From kingdon@redhat.com Sat Apr 01 00:00:00 2000
From: Jim Kingdon <kingdon@redhat.com>
To: eliz@is.elta.co.il
Cc: gdb-patches@sourceware.cygnus.com, shebs@apple.com
Subject: Re: [PATCH] GDB command-line switches and annotations docs
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003101813.NAA21344@devserv.devel.redhat.com>
References: <200003101347.IAA21898@indy.delorie.com> <bwvnauczt.fsf@rtl.cygnus.com> <200003101742.MAA22063@indy.delorie.com>
X-SW-Source: 2000-q1/msg00646.html
Content-length: 485
> Here are the revised changes. I converted all the "@cindex -x"
> entries to the "@cindex @code{-x}" as well, for typeface uniformity.
Looks good to me.
I also ran these through makeinfo and TeX and didn't see any problems
(well TeX still isn't getting the "--" right but as far as I know that
is a texinfo.tex bug, not something we should try to work around).
Stan? I think we're ready for your rubber stamp ^W^W careful and
considered evaluation of whether these should go in.
From fnasser@cygnus.com Sat Apr 01 00:00:00 2000
From: Fernando Nasser <fnasser@cygnus.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com, nickc@cygnus.com
Subject: Re: RFC: Patch to arm-tdep.c -- Register flavors
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38AAE8E9.CC3C4D6F@cygnus.com>
References: <38A9C3F4.20C62065@cygnus.com> <38AA269E.DFC07CAE@cygnus.com>
X-SW-Source: 2000-q1/msg00190.html
Content-length: 1194
Andrew Cagney wrote:
>
> Fernando Nasser wrote:
> >
> > ChageLog: This patch allows the user to choose between any of the
> > flavors available for the disassembly to be used in the "info reg"
> > command and elsewhere in gdb. It prevents having to maintain this
> > information in two places by using the data kept in the opcodes
> > directory.
>
> With regard to the argumet to set dissassembly-flavour et.al. commands,
> is there anything generic in either BFD or opcodes that can be used to
> determine the names?
>
> The argument to ``set architecture'' is determined by BFD. If an
> equivalent is available for this register/opcode stuff then I think
> there would be a greater chance of consistency between the different
> modules.
>
That's the idea. The proposed code does use opcodes as the source for
everything. Even the help text is built from information gathered from
opcodes. Gdb is now 100% consistent with whatever also uses the opcodes
unified code.
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299
From ac131313@cygnus.com Sat Apr 01 00:00:00 2000
From: Andrew Cagney <ac131313@cygnus.com>
To: Jim Blandy <jimb@cygnus.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH] Don't trim addresses in Dwarf debug info
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38E12BD6.E6E357A4@cygnus.com>
References: <200003281624.LAA23161@zwingli.cygnus.com>
X-SW-Source: 2000-q1/msg01094.html
Content-length: 712
Jim Blandy wrote:
>
> I've committed this:
>
> 2000-03-27 Jim Blandy <jimb@redhat.com>
>
> * dwarf2read.c: Revert Andrew Cagney's change of Dec 15, 1997.
> Don't include "bfd-elf.h".
> (address_significant_size): Delete variable.
> (dwarf2_build_psymtabs_hard): Don't set it, or check for
> consistency between it and the Dwarf 2 compilation unit header
> address size.
> (read_address): Don't mask off bits above
> address_significant_size.
> * Makefile.in (dwarf2read.o): Don't depend on $(elf_bfd_h).
> (elf_bfd_h): Remove variable; it's no longer used.
Jim, have you confirmed this doesn't cause any regressions?
Andrew
From fnasser@cygnus.com Sat Apr 01 00:00:00 2000
From: Fernando Nasser <fnasser@cygnus.com>
To: gdb-patches@sourceware.cygnus.com, gdb-local@cygnus.com
Subject: cvs server: [09:25:59] waiting for anoncvs's lock in /cvs/src/src/gdb/rdi-share
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38B56A4E.155F87BC@cygnus.com>
X-SW-Source: 2000-q1/msg00359.html
Content-length: 529
I sort of lied when I said Thomas changes were in. I didn't notice that may commit got into the following:
cvs server: [09:25:59] waiting for anoncvs's lock in /cvs/src/src/gdb/rdi-share
This lock is like that sice yesterday.
As soon as I get someone to look at this, then Thomas changes will be in. Sorry.
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299
From nsd@cygnus.com Sat Apr 01 00:00:00 2000
From: nsd@cygnus.com
To: msnyder@cygnus.com
Cc: cgf@cygnus.com, eliz@delorie.com, gdb-patches@sourceware.cygnus.com, jimb@cygnus.com, john@feith.com
Subject: Re: GDB 4.17 Patch for stack aligned i386 code
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200003242245.WAA07630@nog.bosbc.com>
References: <38DBE6AF.4A7B@cygnus.com>
X-SW-Source: 2000-q1/msg01007.html
Content-length: 780
>Nick Duffek also recently did some work related to frameless
>function backtraces on the X86.
Yup.
>I don't know whether his
>work is checked into the main trunk.
Nope. I wanted to tighten up a couple things before committing the
changes.
>I'd like to see him
>involved in this discussion, so that we don't wind up with
>two solutions to the same problem.
Thanks for the heads-up.
>> It's desirable to omit the frame pointer when compiling leaf functions
>> when targeting the x86 processor as this provides another hard register
>> (%ebp) which can be used by the register allocators.
The code I wrote handles non-leaf functions too. It only works on x86 at
the moment, but I tried to make it architecture-independent.
I'll try to post my patches this weekend.
Nick
From cgf@cygnus.com Sat Apr 01 00:00:00 2000
From: Chris Faylor <cgf@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Subject: [RFA] Avoid core dumping on corrupt stabs entry
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <20000327204057.A24783@cygnus.com>
X-SW-Source: 2000-q1/msg01073.html
Content-length: 786
Any objections to this patch? It seems to be in the spirit of the rest
of the file.
cgf
2000-03-27 Christopher Faylor <cgf@cygnus.com>
* partial-stab.h: Add one more check against corrupted or irregular
stabs entry.
Index: partial-stab.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/partial-stab.h,v
retrieving revision 2.68
diff -u -p -r2.68 partial-stab.h
--- partial-stab.h 1999/09/14 22:50:39 2.68
+++ partial-stab.h 2000/03/28 01:37:53
@@ -393,7 +393,7 @@ switch (CUR_SYMBOL_TYPE)
#ifdef DBXREAD_ONLY
/* See if this is an end of function stab. */
- if (CUR_SYMBOL_TYPE == N_FUN && *namestring == '\000')
+ if (pst && CUR_SYMBOL_TYPE == N_FUN && *namestring == '\000')
{
unsigned long valu;
From fnasser@cygnus.com Sat Apr 01 00:00:00 2000
From: Fernando Nasser <fnasser@cygnus.com>
To: Scott Bambrough <scottb@netwinder.org>
Cc: rearnsha@arm.com, Nick Clifton <nickc@cygnus.com>, GDB Patches Mail List <gdb-patches@sourceware.cygnus.com>
Subject: Re: RFC: Patch to arm-tdep.c -- Register flavors
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <38AAE608.C49A34E7@cygnus.com>
References: <200002161539.PAA12704@cam-mail2.cambridge.arm.com> <38AAC4BC.6F8052A2@netwinder.org>
X-SW-Source: 2000-q1/msg00187.html
Content-length: 1337
Scott Bambrough wrote:
>
> Richard Earnshaw wrote:
> >
> > This is one of the few cases where I would just delete the old name. Old
> > processors never had a specific flags register, so the 'ps' name was
> > 'invented' by the original porter of gdb. Since then the cpsr name has
> > come into use and I doubt that even users debugging in 26-bit mode would
> > object violently to this name changing (maybe we can support "ps" as an
> > alias when parsing user input, but I see no point in ever printing
> > anything other than "cpsr".
>
> This is ok by me. Nick? Fernando?
>
Nick only. One of the reasons I changed this code was that the register
names are maintained at on place only and this place is the opcodes
directory (which, after the unification is the same for gdb and the
disassembly). This ensures coherence and ends up being maintained by
the people who are up to date with the chip manufaturer's latest
specs/standards.
BTW, the patch to change this will have to go through
binutils@sourceware.cygnus.com
I wonder if Nick could give us a hand with that (assuming that he agrees
with the change)?
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299
From taylor@cygnus.com Sat Apr 01 00:00:00 2000
From: David Taylor <taylor@cygnus.com>
To: Jimmy Guo <guo@cup.hp.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg11: hp-symtab-read.c & related
Date: Sat, 01 Apr 2000 00:00:00 -0000
Message-id: <200002230015.TAA06931@texas.cygnus.com>
X-SW-Source: 2000-q1/msg00313.html
Content-length: 1685
Date: Fri, 5 Nov 1999 12:57:57 -0800 (PST)
From: Jimmy Guo <guo@cup.hp.com>
1999-11-04 Jimmy Guo <guo@cup.hp.com>
[...]
* gdbtypes.h (BOUND_BY_VARIABLE,TYPE_ARRAY_HIGH_BOUND_TYPE,
TYPE_ARRAY_LOW_BOUND_TYPE): Define.
[...]
The gdbtypes.h part of this patch is approved.
Index: gdb/gdbtypes.h
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/gdbtypes.h gdb/gdbtypes.h
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/gdbtypes.h Thu Nov 4 14:57:54 1999
--- gdb/gdbtypes.h Thu Nov 4 15:00:42 1999
***************
*** 246,252 ****
/* FIXME, these should probably be restricted to a Fortran-specific
field in some fashion. */
! #define BOUND_CANNOT_BE_DETERMINED 5
#define BOUND_BY_REF_ON_STACK 4
#define BOUND_BY_VALUE_ON_STACK 3
#define BOUND_BY_REF_IN_REG 2
--- 246,253 ----
/* FIXME, these should probably be restricted to a Fortran-specific
field in some fashion. */
! #define BOUND_CANNOT_BE_DETERMINED 6
! #define BOUND_BY_VARIABLE 5
#define BOUND_BY_REF_ON_STACK 4
#define BOUND_BY_VALUE_ON_STACK 3
#define BOUND_BY_REF_IN_REG 2
***************
*** 704,709 ****
--- 705,716 ----
#define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
(TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),0))
+
+ #define TYPE_ARRAY_HIGH_BOUND_TYPE(arraytype) \
+ (TYPE_FIELD_TYPE((TYPE_FIELD_TYPE((arraytype),0)),1))
+
+ #define TYPE_ARRAY_LOW_BOUND_TYPE(arraytype) \
+ (TYPE_FIELD_TYPE((TYPE_FIELD_TYPE((arraytype),0)),0))
/* C++ */
^ permalink raw reply [flat|nested] 2+ messages in thread* RFA: sim/arm/wrapper.c fix
2000-04-01 0:00 RFA: sim/arm/wrapper.c fix glen mccready
@ 2000-03-22 13:18 ` glen mccready
0 siblings, 0 replies; 2+ messages in thread
From: glen mccready @ 2000-03-22 13:18 UTC (permalink / raw)
To: gdb-patches
[Sorry about the first message; misfired.]
Error messages that used `myname' were coming out garbled when
the memory it pointed to got freed too early.
Index: ChangeLog
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/arm/ChangeLog,v
retrieving revision 1.77
diff -c -b -r1.77 ChangeLog
*** ChangeLog 1998/09/14 17:04:36 1.77
- --- ChangeLog 2000/03/22 20:27:15
***************
*** 1,3 ****
- --- 1,7 ----
+ Wed Mar 22 15:24:21 2000 glen mccready <gkm@pobox.com>
+
+ * wrapper.c (sim_open,sim_close): Copy into myname, free myname
+
Mon Sep 14 09:00:05 1998 Nick Clifton <nickc@cygnus.com>
* wrapper.c (sim_open): Set endianness according to BFD or command
Index: wrapper.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/arm/wrapper.c,v
retrieving revision 1.24
diff -c -b -r1.24 wrapper.c
*** wrapper.c 1998/09/14 17:04:36 1.24
- --- wrapper.c 2000/03/22 20:27:15
***************
*** 347,353 ****
char **argv;
{
sim_kind = kind;
! myname = argv[0];
sim_callback = ptr;
/* Decide upon the endian-ness of the processor.
- --- 347,354 ----
char **argv;
{
sim_kind = kind;
! if (myname) free(myname);
! myname = xstrdup(argv[0]);
sim_callback = ptr;
/* Decide upon the endian-ness of the processor.
***************
*** 405,411 ****
SIM_DESC sd;
int quitting;
{
! /* nothing to do */
}
SIM_RC
- --- 406,413 ----
SIM_DESC sd;
int quitting;
{
! if (myname) free(myname);
! myname = 0;
}
SIM_RC
From fnasser@redhat.com Wed Mar 22 14:02:00 2000
From: Fernando Nasser <fnasser@redhat.com>
To: Daniel Berlin <dan@cgsoftware.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [RFC] Better apropos patch
Date: Wed, 22 Mar 2000 14:02:00 -0000
Message-id: <38D9429B.798F82E2@redhat.com>
References: <Pine.LNX.4.10.10003221307320.20082-100000@propylaea.anduin.com>
X-SW-Source: 2000-03/msg00480.html
Content-length: 1043
Daniel Berlin wrote:
>
> Oh, i know it's not.
> I also have no changelog or comments.
> I wanted to make sure nobody saw anything immediately wrong with my method
> (IE Some odd thing that would make the way i search the command lists not
> work properly, or something), and that the general format of the output
> was okay.
I see. Sorry, I should have noticed that it was RFC not RFA.
Well, don't worry about some odd case. If it happens, we fix it.
Maybe the only way to get a feedback with regards to the output format
will be to incorporate it and let people use it.
This is way cool. I am looking forward to the final patch.
P.S.: Are you going to send a gdb.texinfo entry as well? It would be
nice if you do (else I would have to do it myself before checking it in
and my TODO list is approaching infinity).
--
Fernando Nasser
Red Hat, Inc. - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299
From kevinb@cygnus.com Wed Mar 22 14:17:00 2000
From: Kevin Buettner <kevinb@cygnus.com>
To: Fernando Nasser <fnasser@redhat.com>, Daniel Berlin <dan@cgsoftware.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [RFC] Better apropos patch
Date: Wed, 22 Mar 2000 14:17:00 -0000
Message-id: <1000322221717.ZM29415@ocotillo.lan>
References: <Pine.LNX.4.10.10003221307320.20082-100000@propylaea.anduin.com> <38D9429B.798F82E2@redhat.com> <fnasser@redhat.com>
X-SW-Source: 2000-03/msg00481.html
Content-length: 355
On Mar 22, 10:00pm, Fernando Nasser wrote:
> Maybe the only way to get a feedback with regards to the output format
> will be to incorporate it and let people use it.
I think that's a good idea; I'd definitely play around with it if it were
to show up in the repository.
> This is way cool. I am looking forward to the final patch.
So am I.
Kevin
From tm@netcom.com Wed Mar 22 14:18:00 2000
From: Toshiyasu Morita <tm@netcom.com>
To: msnyder@cygnus.com (Michael Snyder)
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: [PATCH]: Allow struct compare in expressions.
Date: Wed, 22 Mar 2000 14:18:00 -0000
Message-id: <200003222218.OAA02705@netcom.com>
References: <200003222043.MAA10512@cleaver.cygnus.com>
X-SW-Source: 2000-03/msg00482.html
Content-length: 4958
Does this compare ignore the padding in the struct?
>
>
> The following change allows GDB to evaluate (and set watchpoints on)
> expressions of the form (a == b) and (a != b), where a and b are
> simple C structs or unions. It would be possible to extend this
> further by allowing simple binary comparison for classes that don't
> have an operator== method: I leave that as an exercise for someone
> else.
>
> Jim Blandy, David Taylor, I think both of your approvals is required.
>
> 2000-03-22 Michael Snyder <msnyder@cleaver.cygnus.com>
>
> * eval.c (evaluate_subexp_standard): allow for simple comparison
> of structures, in the absense of C++ method symbols.
> * symtab.c (total_number_of_methods): make public, for use above.
> * symtab.h (total_number_of_methods): publish prototype.
>
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/src/src/gdb/ChangeLog,v
> retrieving revision 1.163
> diff -c -r1.163 ChangeLog
> *** ChangeLog 2000/03/22 09:45:01 1.163
> --- ChangeLog 2000/03/22 20:38:33
> ***************
> *** 1,3 ****
> --- 1,10 ----
> + 2000-03-22 Michael Snyder <msnyder@cleaver.cygnus.com>
> +
> + * eval.c (evaluate_subexp_standard): allow for simple comparison
> + of structures, in the absense of C++ method symbols.
> + * symtab.c (total_number_of_methods): make public, for use above.
> + * symtab.h (total_number_of_methods): publish prototype.
> +
> 2000-03-22 Mark Kettenis <kettenis@gnu.org>
>
> * config/i386/tm-i386aix.h (I386_AIX_TARGET): Remove.
> Index: eval.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/eval.c,v
> retrieving revision 1.2
> diff -c -r1.2 eval.c
> *** eval.c 2000/03/14 17:01:04 1.2
> --- eval.c 2000/03/22 20:38:34
> ***************
> *** 1448,1454 ****
> arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
> if (noside == EVAL_SKIP)
> goto nosideret;
> ! if (binop_user_defined_p (op, arg1, arg2))
> {
> return value_x_binop (arg1, arg2, op, OP_NULL, noside);
> }
> --- 1448,1459 ----
> arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
> if (noside == EVAL_SKIP)
> goto nosideret;
> !
> ! /* NOTE: because BINOP_EQUAL is a legal operaton for
> ! C structs (as opposed to C++ classes), revert to
> ! simple value comparison if the type has no methods. */
> ! if (binop_user_defined_p (op, arg1, arg2) &&
> ! total_number_of_methods (arg1->type) > 0)
> {
> return value_x_binop (arg1, arg2, op, OP_NULL, noside);
> }
> ***************
> *** 1463,1469 ****
> arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
> if (noside == EVAL_SKIP)
> goto nosideret;
> ! if (binop_user_defined_p (op, arg1, arg2))
> {
> return value_x_binop (arg1, arg2, op, OP_NULL, noside);
> }
> --- 1468,1479 ----
> arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
> if (noside == EVAL_SKIP)
> goto nosideret;
> !
> ! /* NOTE: because BINOP_NOTEQUAL is a legal operaton for
> ! C structs (as opposed to C++ classes), revert to
> ! simple value comparison if the type has no methods. */
> ! if (binop_user_defined_p (op, arg1, arg2) &&
> ! total_number_of_methods (arg1->type) > 0)
> {
> return value_x_binop (arg1, arg2, op, OP_NULL, noside);
> }
> Index: symtab.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.c,v
> retrieving revision 1.2
> diff -c -r1.2 symtab.c
> *** symtab.c 2000/02/08 04:39:02 1.2
> --- symtab.c 2000/03/22 20:38:34
> ***************
> *** 2217,2225 ****
> reader because the type of the baseclass might still be stubbed
> when the definition of the derived class is parsed. */
>
> ! static int total_number_of_methods PARAMS ((struct type * type));
> !
> ! static int
> total_number_of_methods (type)
> struct type *type;
> {
> --- 2217,2223 ----
> reader because the type of the baseclass might still be stubbed
> when the definition of the derived class is parsed. */
>
> ! int
> total_number_of_methods (type)
> struct type *type;
> {
> Index: symtab.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/symtab.h,v
> retrieving revision 1.4
> diff -c -r1.4 symtab.h
> *** symtab.h 2000/03/21 22:37:42 1.4
> --- symtab.h 2000/03/22 20:38:34
> ***************
> *** 1462,1467 ****
> --- 1462,1472 ----
> extern int
> in_prologue PARAMS ((CORE_ADDR pc, CORE_ADDR func_start));
>
> + /* Number of method symbols for TYPE
> + (and all its base classes) */
> + extern int
> + total_number_of_methods PARAMS ((struct type * type));
> +
> extern struct symbol *
> fixup_symbol_section PARAMS ((struct symbol *, struct objfile *));
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-04-01 0:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-01 0:00 RFA: sim/arm/wrapper.c fix glen mccready
2000-03-22 13:18 ` glen mccready
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox