This is the mail archive of the gdb-patches@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: FW: [PATCH] Commandline Support for the H8300 Simulator.



2003-02-22 D.Venkatasubramanian <dvenkat at noida dot hcltech dot com>

* compile.c: Added #define SET_CMDLINE_LOCATION to set the location of 8-bit (256 locations) where the
Command Line arguments would be stored.
(decode): Added a TRAP to 0xcc for Commandline processing using pseudo opcode O_SYS_CMDLINE.
(sim_resume): Added handling of O_SYS_CMDLINE Trap.
(sim_create_inferior): Setting a pointer to Commandline Args array.
* inst.h: Added a new variable ptr_CommandLine for
storing pointer to Commandline array.




*** sim/h8300/inst.h.original Wed Feb 19 15:28:24 2003
--- sim/h8300/inst.h.modified Sat Feb 22 19:50:51 2003
*************** enum h8300_sim_state {
*** 66,71 ****
--- 66,74 ----
SIM_STATE_RUNNING, SIM_STATE_EXITED, SIM_STATE_SIGNALLED, SIM_STATE_STOPPED
};
+ /* For Command Line. */
+ char **ptr_CommandLine; /* Pointer to command Line Arguments. */

Please call the variable:


ptr_command_line

(gnu coding standards don't like edit case variables)

  typedef struct
  {
    enum h8300_sim_state state;



*** sim/h8300/compile.c.original Wed Feb 19 15:28:09 2003
--- sim/h8300/compile.c.modified Sat Feb 22 19:50:43 2003
*************** void sim_set_simcache_size PARAMS ((int)
*** 119,124 ****
--- 119,132 ----
#define UEXTSHORT(x) ((x) & 0xffff)
#define SEXTSHORT(x) ((short) (x))
+ #define SET_CMDLINE_LOCATION \
+ if (h8300smode) \
+ addr_cmdline = 0xffff00L; \
+ else if (h8300hmode) \
+ addr_cmdline = 0x2ff00L; \
+ else \
+ addr_cmdline = 0xff00L;
+

Please write the above as a function cmdline_location() that returns the address.


+ ptr_CommandLine = argv;

I'd change that to strdup (argv) (freeing the old value if necessary). that way the code can't run foul of GDB freeing up the parameter.


Otherwize, approved.

Andrew


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