Changeset 609 for branches/GNU/src/binutils/bfd/cisco-core.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/cisco-core.c
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r608 r609 1 1 /* BFD back-end for CISCO crash dumps. 2 3 Copyright 1994, 1997, 1999, 2000Free Software Foundation, Inc.2 Copyright 1994, 1997, 1999, 2000, 2001, 2002 3 Free Software Foundation, Inc. 4 4 5 5 This file is part of BFD, the Binary File Descriptor library. … … 68 68 } crashinfo_external; 69 69 70 71 70 struct cisco_core_struct 72 71 { 73 72 int sig; 74 73 }; 74 75 76 77 78 79 75 80 76 81 … … 92 97 sec_ptr asect; 93 98 struct stat statbuf; 94 95 if (bfd_seek (abfd, crash_info_loc, SEEK_SET) != 0) 99 bfd_size_type amt; 100 101 if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0) 96 102 return NULL; 97 103 98 nread = bfd_ read (buf, 1,4, abfd);104 nread = bfd_ 4, abfd); 99 105 if (nread != 4) 100 106 { … … 105 111 crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf)); 106 112 107 if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0)113 if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0) 108 114 { 109 115 /* Most likely we failed because of a bogus (huge) offset */ … … 112 118 } 113 119 114 nread = bfd_ read (&crashinfo, 1,sizeof (crashinfo), abfd);120 nread = bfd_ sizeof (crashinfo), abfd); 115 121 if (nread != sizeof (crashinfo)) 116 122 { … … 151 157 /* OK, we believe you. You're a core file. */ 152 158 153 abfd->tdata.cisco_core_data = 154 ((struct cisco_core_struct *) 155 bfd_zmalloc (sizeof (struct cisco_core_struct))); 159 amt = sizeof (struct cisco_core_struct); 160 abfd->tdata.cisco_core_data = (struct cisco_core_struct *) bfd_zmalloc (amt); 156 161 if (abfd->tdata.cisco_core_data == NULL) 157 162 return NULL; … … 236 241 } 237 242 238 abfd->sections = NULL; 239 abfd->section_count = 0; 243 /* Create a ".data" section that maps the entire file, which is 244 essentially a dump of the target system's RAM. */ 245 246 asect = bfd_make_section_anyway (abfd, ".data"); 247 if (asect == NULL) 248 goto error_return; 249 asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS; 250 /* The size of memory is the size of the core file itself. */ 251 asect->_raw_size = statbuf.st_size; 252 asect->vma = rambase; 253 asect->filepos = 0; 254 255 /* Create a ".crash" section to allow access to the saved 256 crash information. */ 257 258 asect = bfd_make_section_anyway (abfd, ".crash"); 259 if (asect == NULL) 260 goto error_return; 261 asect->flags = SEC_HAS_CONTENTS; 262 asect->vma = 0; 263 asect->filepos = crashinfo_offset; 264 asect->_raw_size = sizeof (crashinfo); 240 265 241 266 /* Create a ".reg" section to allow access to the saved 242 267 registers. */ 243 268 244 asect = (asection *) bfd_zmalloc (sizeof (asection));269 asect = ); 245 270 if (asect == NULL) 246 271 goto error_return; 247 asect->name = ".reg";248 272 asect->flags = SEC_HAS_CONTENTS; 249 273 asect->vma = 0; … … 254 278 nread = statbuf.st_size - asect->filepos; 255 279 asect->_raw_size = (nread < 1024) ? nread : 1024; 256 asect->next = abfd->sections;257 abfd->sections = asect;258 ++abfd->section_count;259 260 /* Create a ".crash" section to allow access to the saved261 crash information. */262 263 asect = (asection *) bfd_zmalloc (sizeof (asection));264 if (asect == NULL)265 goto error_return;266 asect->name = ".crash";267 asect->flags = SEC_HAS_CONTENTS;268 asect->vma = 0;269 asect->filepos = crashinfo_offset;270 asect->_raw_size = sizeof (crashinfo);271 asect->next = abfd->sections;272 abfd->sections = asect;273 ++abfd->section_count;274 275 /* Create a ".data" section that maps the entire file, which is276 essentially a dump of the target system's RAM. */277 278 asect = (asection *) bfd_zmalloc (sizeof (asection));279 if (asect == NULL)280 goto error_return;281 asect->name = ".data";282 asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;283 /* The size of memory is the size of the core file itself. */284 asect->_raw_size = statbuf.st_size;285 asect->vma = rambase;286 asect->filepos = 0;287 asect->next = abfd->sections;288 abfd->sections = asect;289 ++abfd->section_count;290 280 291 281 return abfd->xvec; … … 295 285 296 286 error_return: 297 { 298 sec_ptr nextsect; 299 for (asect = abfd->sections; asect != NULL;) 300 { 301 nextsect = asect->next; 302 free (asect); 303 asect = nextsect; 304 } 305 free (abfd->tdata.cisco_core_data); 306 return NULL; 307 } 287 bfd_release (abfd, abfd->tdata.any); 288 abfd->tdata.any = NULL; 289 bfd_section_list_clear (abfd); 290 return NULL; 308 291 } 309 292 … … 326 309 char * 327 310 cisco_core_file_failing_command (abfd) 328 bfd *abfd ;311 bfd *abfd; 329 312 { 330 313 return NULL; … … 333 316 int 334 317 cisco_core_file_failing_signal (abfd) 335 bfd *abfd ;318 bfd *abfd; 336 319 { 337 320 return abfd->tdata.cisco_core_data->sig; 338 321 } 339 322 340 b oolean323 boolean 341 324 cisco_core_file_matches_executable_p (core_bfd, exec_bfd) 342 bfd *core_bfd ;343 bfd *exec_bfd ;344 { 345 return true;325 bfd *core_bfd; 326 bfd *exec_bfd; 327 { 328 return ; 346 329 } 347 330 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
