home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / d / gdb / gdb-4.001 / gdb-4.14.elf.1.diff
Encoding:
Text File  |  1995-07-08  |  10.5 KB  |  355 lines

  1. diff -c gnu/gdb/bfd/elfcode.h:1.1.1.2 gnu/gdb/bfd/elfcode.h:1.2
  2. *** gnu/gdb/bfd/elfcode.h:1.1.1.2    Mon Jun 12 20:09:28 1995
  3. --- gnu/gdb/bfd/elfcode.h    Mon Jun 12 20:09:28 1995
  4. ***************
  5. *** 3541,3547 ****
  6.   
  7.     if (core_prpsinfo (core_bfd))
  8.       {
  9. !       corename = (((struct prpsinfo *) core_prpsinfo (core_bfd))->pr_fname);
  10.       }
  11.     else
  12.       {
  13. --- 3541,3547 ----
  14.   
  15.     if (core_prpsinfo (core_bfd))
  16.       {
  17. !       corename = (((prpsinfo_t *) core_prpsinfo (core_bfd))->pr_fname);
  18.       }
  19.     else
  20.       {
  21. diff -c gnu/gdb/bfd/hosts/i386linux.h:1.1.1.1 gnu/gdb/bfd/hosts/i386linux.h:1.2
  22. *** gnu/gdb/bfd/hosts/i386linux.h:1.1.1.1    Mon Jun 12 20:09:30 1995
  23. --- gnu/gdb/bfd/hosts/i386linux.h    Mon Jun 12 20:09:30 1995
  24. ***************
  25. *** 15,17 ****
  26. --- 15,19 ----
  27.      the end.  */
  28.   
  29.   #define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096
  30. + #define HAVE_PROCFS    /* Used for core file stuff only */
  31. diff -c /dev/null gnu/gdb/gdb/core-linux.c:1.2
  32. *** /dev/null    Mon Jun 12 20:09:33 1995
  33. --- gnu/gdb/gdb/core-linux.c    Mon Jun 12 20:09:33 1995
  34. ***************
  35. *** 0 ****
  36. --- 1,181 ----
  37. + /* Support for Linux ELF core files for GDB.
  38. +    Copyright 1995 Free Software Foundation, Inc.
  39. + This file is part of GDB.
  40. + This program is free software; you can redistribute it and/or modify
  41. + it under the terms of the GNU General Public License as published by
  42. + the Free Software Foundation; either version 2 of the License, or
  43. + (at your option) any later version.
  44. + This program is distributed in the hope that it will be useful,
  45. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  46. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  47. + GNU General Public License for more details.
  48. + You should have received a copy of the GNU General Public License
  49. + along with this program; if not, write to the Free Software
  50. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  51. + #include "defs.h"
  52. + #include <sys/procfs.h>
  53. + #include <sys/user.h>
  54. + #include <sys/ptrace.h>
  55. + #include "inferior.h"
  56. + #include "target.h"
  57. + #include "command.h"
  58. + #include "gdbcore.h"
  59. + extern void supply_gregset PARAMS ((gregset_t *gregsetp));
  60. + /*
  61. + LOCAL FUNCTION
  62. +     fetch_elf_core_registers -- fetch current registers from
  63. +         ELF core file data
  64. + SYNOPSIS
  65. +     void fetch_elf_core_registers (char *core_reg_sect, unsigned core_reg_size,
  66. +                    int which, unsigned in reg_addr)
  67. + DESCRIPTION
  68. +     Read the values of either the general register set (WHICH equals 0)
  69. +     or the floating point register set (WHICH equals 2) from the core
  70. +     file data (pointed to by CORE_REG_SECT), and update gdb's idea of
  71. +     their current values.  The CORE_REG_SIZE parameter is ignored.
  72. + NOTES
  73. +     Use the indicated sizes to validate the gregset and fpregset
  74. +     structures.
  75. + */
  76. + static void
  77. + fetch_elf_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
  78. +      char *core_reg_sect;
  79. +      unsigned core_reg_size;
  80. +      int which;
  81. +      unsigned int reg_addr;    /* Unused in this version */
  82. + {
  83. +   gregset_t gregset;
  84. +   fpregset_t fpregset;
  85. +   if (which == 0)
  86. +     {
  87. +       if (core_reg_size != sizeof (gregset))
  88. +     {
  89. +       warning ("wrong size gregset struct in core file");
  90. +     }
  91. +       else
  92. +     {
  93. +       memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset));
  94. +       supply_gregset (&gregset);
  95. +     }
  96. +     }
  97. +   else if (which == 2)
  98. +     {
  99. +       if (core_reg_size != sizeof (fpregset))
  100. +     {
  101. +       warning ("wrong size fpregset struct in core file");
  102. +     }
  103. +       else
  104. +     {
  105. +       memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
  106. + #if defined (FP0_REGNUM)
  107. +       supply_fpregset (&fpregset);
  108. + #endif
  109. +     }
  110. +     }
  111. + }
  112. + #define CORE_REGISTER_ADDR(regno, regptr) register_addr(regno, regptr)
  113. + /* Return the address in the core dump or inferior of register REGNO.
  114. +    BLOCKEND is the address of the end of the user structure.  */
  115. + unsigned int
  116. + register_addr (regno, blockend)
  117. +      int regno;
  118. +      int blockend;
  119. + {
  120. +   int addr;
  121. +   if (regno < 0 || regno >= ARCH_NUM_REGS)
  122. +     error ("Invalid register number %d.", regno);
  123. +   REGISTER_U_ADDR (addr, blockend, regno);
  124. +   return addr;
  125. + }
  126. + /* Extract the register values out of the core file and store
  127. +    them where `read_register' will find them.
  128. +    CORE_REG_SECT points to the register values themselves, read into memory.
  129. +    CORE_REG_SIZE is the size of that area.
  130. +    WHICH says which set of registers we are handling (0 = int, 2 = float
  131. +          on machines where they are discontiguous).
  132. +    REG_ADDR is the offset from u.u_ar0 to the register values relative to
  133. +             core_reg_sect.  This is used with old-fashioned core files to
  134. +         locate the registers in a large upage-plus-stack ".reg" section.
  135. +         Original upage address X is at location core_reg_sect+x+reg_addr.
  136. +  */
  137. + static void
  138. + fetch_aout_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
  139. +      char *core_reg_sect;
  140. +      unsigned core_reg_size;
  141. +      int which;
  142. +      unsigned reg_addr;
  143. + {
  144. +   register int regno;
  145. +   register unsigned int addr;
  146. +   int bad_reg = -1;
  147. +   register reg_ptr = -reg_addr;        /* Original u.u_ar0 is -reg_addr. */
  148. +   int numregs = ARCH_NUM_REGS;
  149. +   /* If u.u_ar0 was an absolute address in the core file, relativize it now,
  150. +      so we can use it as an offset into core_reg_sect.  When we're done,
  151. +      "register 0" will be at core_reg_sect+reg_ptr, and we can use
  152. +      CORE_REGISTER_ADDR to offset to the other registers.  If this is a modern
  153. +      core file without a upage, reg_ptr will be zero and this is all a big
  154. +      NOP.  */
  155. +   if (reg_ptr > core_reg_size)
  156. +     reg_ptr -= KERNEL_U_ADDR;
  157. +   for (regno = 0; regno < numregs; regno++)
  158. +     {
  159. +       addr = CORE_REGISTER_ADDR (regno, reg_ptr);
  160. +       if (addr >= core_reg_size) {
  161. +     if (bad_reg < 0)
  162. +       bad_reg = regno;
  163. +       } else {
  164. +     supply_register (regno, core_reg_sect + addr);
  165. +       }
  166. +     }
  167. +   if (bad_reg >= 0)
  168. +     {
  169. +       error ("Register %s not found in core file.", reg_names[bad_reg]);
  170. +     }
  171. + }
  172. + /* Ikky, but it seems like the cleanest way */
  173. + void
  174. + fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
  175. +      char *core_reg_sect;
  176. +      unsigned core_reg_size;
  177. +      int which;
  178. +      unsigned int reg_addr;
  179. + {
  180. +   if (core_bfd->xvec->flavour == bfd_target_elf_flavour)
  181. +       fetch_elf_core_registers(core_reg_sect, core_reg_size, which, reg_addr);
  182. +   else
  183. +       fetch_aout_core_registers(core_reg_sect, core_reg_size, which, reg_addr);
  184. + }
  185. diff -c /dev/null gnu/gdb/gdb/i386lnx-nat.c:1.1
  186. *** /dev/null    Mon Jun 12 20:09:33 1995
  187. --- gnu/gdb/gdb/i386lnx-nat.c    Mon Jun 12 20:09:33 1995
  188. ***************
  189. *** 0 ****
  190. --- 1,58 ----
  191. + /* Intel 386 native support for Linux.
  192. +    Copyright 1995 Free Software Foundation, Inc.
  193. + This file is part of GDB.
  194. + This program is free software; you can redistribute it and/or modify
  195. + it under the terms of the GNU General Public License as published by
  196. + the Free Software Foundation; either version 2 of the License, or
  197. + (at your option) any later version.
  198. + This program is distributed in the hope that it will be useful,
  199. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  200. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  201. + GNU General Public License for more details.
  202. + You should have received a copy of the GNU General Public License
  203. + along with this program; if not, write to the Free Software
  204. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  205. + #include "defs.h"
  206. + #include <sys/procfs.h>
  207. + #include <sys/user.h>
  208. + #include <sys/ptrace.h>
  209. + #include "inferior.h"
  210. + #include "target.h"
  211. + #include "command.h"
  212. + #include "gdbcore.h"
  213. + /* This is a duplicate of the table in i386-xdep.c. */
  214. + static int regmap[] = 
  215. + {
  216. +   EAX, ECX, EDX, EBX,
  217. +   UESP, EBP, ESI, EDI,
  218. +   EIP, EFL, CS, SS,
  219. +   DS, ES, FS, GS,
  220. + };
  221. + /*  Given a pointer to a general register set in /proc format (gregset_t *),
  222. +     unpack the register contents and supply them as gdb's idea of the current
  223. +     register values. Copied from tm-i386v4.h */
  224. + void
  225. + supply_gregset (gregsetp)
  226. +      gregset_t *gregsetp;
  227. + {
  228. +   register int regi;
  229. +   register greg_t *regp = (greg_t *) gregsetp;
  230. +   for (regi = 0 ; regi < NUM_REGS ; regi++)
  231. +     {
  232. +       supply_register (regi, (char *) (regp + regmap[regi]));
  233. +     }
  234. + }
  235. diff -c gnu/gdb/gdb/config/i386/linux.mh:1.1.1.1 gnu/gdb/gdb/config/i386/linux.mh:1.4
  236. *** gnu/gdb/gdb/config/i386/linux.mh:1.1.1.1    Mon Jun 12 20:09:36 1995
  237. --- gnu/gdb/gdb/config/i386/linux.mh    Mon Jun 12 20:09:36 1995
  238. ***************
  239. *** 3,10 ****
  240.   XM_FILE= xm-linux.h
  241.   XDEPFILES= 
  242.   
  243. ! # Needed for frexp() in libiberty.
  244. ! XM_CLIBS= -lm
  245.   
  246.   NAT_FILE= nm-linux.h
  247. ! NATDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o i386v-nat.o corelow.o
  248. --- 3,15 ----
  249.   XM_FILE= xm-linux.h
  250.   XDEPFILES= 
  251.   
  252. ! # Needed for frexp() in libiberty. Not needed any more.
  253. ! # XM_CLIBS= -lm
  254.   
  255.   NAT_FILE= nm-linux.h
  256. ! NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o core-linux.o \
  257. !     i386v-nat.o corelow.o i386lnx-nat.o
  258. ! # We don't want to use MMALLOC in gdb because the native one is better.
  259. ! MMALLOC =
  260. ! MMALLOC_DISABLE = -DNO_MMALLOC
  261. diff -c gnu/gdb/gdb/config/i386/linux.mt:1.1.1.1 gnu/gdb/gdb/config/i386/linux.mt:1.2
  262. *** gnu/gdb/gdb/config/i386/linux.mt:1.1.1.1    Mon Jun 12 20:09:36 1995
  263. --- gnu/gdb/gdb/config/i386/linux.mt    Mon Jun 12 20:09:36 1995
  264. ***************
  265. *** 1,3 ****
  266. ! # Target: Intel 386 with a.out
  267.   TDEPFILES= i386-tdep.o i387-tdep.o
  268.   TM_FILE= tm-linux.h
  269. --- 1,3 ----
  270. ! # Target: Intel 386 with a.out and ELF
  271.   TDEPFILES= i386-tdep.o i387-tdep.o
  272.   TM_FILE= tm-linux.h
  273. diff -c gnu/gdb/gdb/config/i386/tm-linux.h:1.1.1.1 gnu/gdb/gdb/config/i386/tm-linux.h:1.2
  274. *** gnu/gdb/gdb/config/i386/tm-linux.h:1.1.1.1    Mon Jun 12 20:09:36 1995
  275. --- gnu/gdb/gdb/config/i386/tm-linux.h    Mon Jun 12 20:09:36 1995
  276. ***************
  277. *** 24,26 ****
  278. --- 24,32 ----
  279.   #define START_INFERIOR_TRAPS_EXPECTED 2
  280.   
  281.   #include "i386/tm-i386v.h"
  282. + /*
  283. +  * We need this file for the SOLIB_TRAMPOLINE stuff.
  284. +  */
  285. + #include "tm-sysv4.h"
  286. diff -c gnu/gdb/gdb/config/i386/xm-linux.h:1.1.1.1 gnu/gdb/gdb/config/i386/xm-linux.h:1.2
  287. *** gnu/gdb/gdb/config/i386/xm-linux.h:1.1.1.1    Mon Jun 12 20:09:36 1995
  288. --- gnu/gdb/gdb/config/i386/xm-linux.h    Mon Jun 12 20:09:36 1995
  289. ***************
  290. *** 30,32 ****
  291. --- 30,41 ----
  292.   
  293.   /* Need R_OK etc, but USG isn't defined.  */
  294.   #include <unistd.h>
  295. + /*
  296. +  * We define this because with ELF we use SVR4 style shared libraries.
  297. +  */
  298. + #include "solib.h"    /* Support for shared libraries. */
  299. + #define SVR4_SHARED_LIBS
  300.