This is the mail archive of the gdb-patches@sourceware.org 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: [PATCH] gdb: add callback defines for new ARGV handling


On Monday, January 10, 2011 17:11:53 Doug Evans wrote:
> On Mon, Jan 10, 2011 at 1:25 PM, Mike Frysinger wrote:
> > On Mon, Jan 10, 2011 at 12:57 PM, Doug Evans wrote:
> >> On Thu, Jan 6, 2011 at 2:15 AM, Mike Frysinger wrote:
> >>> The common sim code has slightly unfinished support for these already,
> >>> but even arch ports are unable to handle these if the common header
> >>> does not define them.  This is because the generated callback header
> >>> includes simple common gdb/sim headers only which causes it to skip
> >>> the new ARGV syscalls.  Plus, it isn't like providing these in the
> >>> common header will break any sim targets which don't want them.
> >>> 
> >>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> >>> 
> >>> 2010-01-06  Mike Frysinger  <vapier@gentoo.org>
> >>> 
> >>>        * callback.h (CB_SYS_argc, CB_SYS_argnlen, CB_SYS_argn): Define.
> >>> ---
> >>>  include/gdb/callback.h |    5 +++++
> >>>  1 files changed, 5 insertions(+), 0 deletions(-)
> >>> 
> >>> diff --git a/include/gdb/callback.h b/include/gdb/callback.h
> >>> index a1f79f9..296dfc3 100644
> >>> --- a/include/gdb/callback.h
> >>> +++ b/include/gdb/callback.h
> >>> @@ -231,6 +231,11 @@ extern host_callback default_callback;
> >>>  #define CB_SYS_truncate        21
> >>>  #define CB_SYS_ftruncate 22
> >>>  #define CB_SYS_pipe    23
> >>> +
> >>> +/* New ARGV support.  */
> >>> +#define CB_SYS_argc    24
> >>> +#define CB_SYS_argnlen 25
> >>> +#define CB_SYS_argn    26
> >>> 
> >>>  /* Struct use to pass and return information necessary to perform a
> >>>    system call.  */
> >> 
> >> The common sim code has CB_SYS_{argv,argvlen}, but I don't see the
> >> above. Where do they come from?
> > 
> > pretty much all the callback "syscalls" that the sim handles are
> > because of newlib/libgloss
> > -mike
> 
> Ah.  src/libgloss/syscall.h has SYS_{argc,argnlen,argn}, added in 2006.
> 
> So now we have CB_SYS_{argv,argvlen,argc,argnlen,argn}.
> Blech.
> It would be nice to know the reasoning behind argn,argnlen.
> 
> For callback.h, IWBN to add some documentation regarding why things
> are the way they are.  E.g. if argn is preferred over argv, why?

these things were created long before i had even heard of either project, so i 
can only speculate on their history.  i would guess that argv/argvlen made it 
more difficult to do what most people actually want -- pass argc/argv to the 
main function.  and so argc/argn were born.

all i really know is that argc/argn/argnlen are labeled as "the new approach" 
in a few places, and as such, it is what the Blackfin port supports.

it also seems like the syscall handling intended to handle argv at some point, 
but someone didnt get around to implementing it.  so i could flesh that out 
too so that i could take the Blackfin argn/argc code and move it to 
common/syscall.c in the sim.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


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