Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Side by Side Diff: gdb/bfin-tdep.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/bfin-tdep.h ('k') | gdb/block.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Target-dependent code for Analog Devices Blackfin processor, for GDB. 1 /* Target-dependent code for Analog Devices Blackfin processor, for GDB.
2 2
3 Copyright (C) 2005-2012 Free Software Foundation, Inc. 3 Copyright (C) 2005-2013 Free Software Foundation, Inc.
4 4
5 Contributed by Analog Devices, Inc. 5 Contributed by Analog Devices, Inc.
6 6
7 This file is part of GDB. 7 This file is part of GDB.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details. 17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 21
22 #include "defs.h" 22 #include "defs.h"
23 #include "gdb_string.h" 23 #include <string.h>
24 #include "inferior.h" 24 #include "inferior.h"
25 #include "gdbcore.h" 25 #include "gdbcore.h"
26 #include "arch-utils.h" 26 #include "arch-utils.h"
27 #include "regcache.h" 27 #include "regcache.h"
28 #include "frame.h" 28 #include "frame.h"
29 #include "frame-unwind.h" 29 #include "frame-unwind.h"
30 #include "frame-base.h" 30 #include "frame-base.h"
31 #include "trad-frame.h" 31 #include "trad-frame.h"
32 #include "dis-asm.h" 32 #include "dis-asm.h"
33 #include "gdb_assert.h" 33 #include "gdb_assert.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 struct regcache *regcache, 496 struct regcache *regcache,
497 CORE_ADDR bp_addr, 497 CORE_ADDR bp_addr,
498 int nargs, 498 int nargs,
499 struct value **args, 499 struct value **args,
500 CORE_ADDR sp, 500 CORE_ADDR sp,
501 int struct_return, 501 int struct_return,
502 CORE_ADDR struct_addr) 502 CORE_ADDR struct_addr)
503 { 503 {
504 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); 504 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
505 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 505 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
506 char buf[4]; 506 gdb_byte buf[4];
507 int i; 507 int i;
508 long reg_r0, reg_r1, reg_r2; 508 long reg_r0, reg_r1, reg_r2;
509 int total_len = 0; 509 int total_len = 0;
510 enum bfin_abi abi = bfin_abi (gdbarch); 510 enum bfin_abi abi = bfin_abi (gdbarch);
511 CORE_ADDR func_addr = find_function_addr (function, NULL); 511 CORE_ADDR func_addr = find_function_addr (function, NULL);
512 512
513 for (i = nargs - 1; i >= 0; i--) 513 for (i = nargs - 1; i >= 0; i--)
514 { 514 {
515 struct type *value_type = value_enclosing_type (args[i]); 515 struct type *value_type = value_enclosing_type (args[i]);
516 int len = TYPE_LENGTH (value_type);
517 516
518 total_len += (len + 3) & ~3; 517 total_len += (TYPE_LENGTH (value_type) + 3) & ~3;
519 } 518 }
520 519
521 /* At least twelve bytes of stack space must be allocated for the function's 520 /* At least twelve bytes of stack space must be allocated for the function's
522 arguments, even for functions that have less than 12 bytes of argument 521 arguments, even for functions that have less than 12 bytes of argument
523 data. */ 522 data. */
524 523
525 if (total_len < 12) 524 if (total_len < 12)
526 sp -= 12 - total_len; 525 sp -= 12 - total_len;
527 526
528 /* Push arguments in reverse order. */ 527 /* Push arguments in reverse order. */
529 528
530 for (i = nargs - 1; i >= 0; i--) 529 for (i = nargs - 1; i >= 0; i--)
531 { 530 {
532 struct type *value_type = value_enclosing_type (args[i]); 531 struct type *value_type = value_enclosing_type (args[i]);
533 struct type *arg_type = check_typedef (value_type); 532 struct type *arg_type = check_typedef (value_type);
534 int len = TYPE_LENGTH (value_type); 533 int container_len = (TYPE_LENGTH (value_type) + 3) & ~3;
535 int container_len = (len + 3) & ~3;
536 534
537 sp -= container_len; 535 sp -= container_len;
538 write_memory (sp, value_contents_writeable (args[i]), container_len); 536 write_memory (sp, value_contents_writeable (args[i]), container_len);
539 } 537 }
540 538
541 /* Initialize R0, R1, and R2 to the first 3 words of parameters. */ 539 /* Initialize R0, R1, and R2 to the first 3 words of parameters. */
542 540
543 reg_r0 = read_memory_integer (sp, 4, byte_order); 541 reg_r0 = read_memory_integer (sp, 4, byte_order);
544 regcache_cooked_write_unsigned (regcache, BFIN_R0_REGNUM, reg_r0); 542 regcache_cooked_write_unsigned (regcache, BFIN_R0_REGNUM, reg_r0);
545 reg_r1 = read_memory_integer (sp + 4, 4, byte_order); 543 reg_r1 = read_memory_integer (sp + 4, 4, byte_order);
(...skipping 23 matching lines...) Expand all
569 567
570 static int 568 static int
571 bfin_reg_to_regnum (struct gdbarch *gdbarch, int reg) 569 bfin_reg_to_regnum (struct gdbarch *gdbarch, int reg)
572 { 570 {
573 if (reg > ARRAY_SIZE (map_gcc_gdb)) 571 if (reg > ARRAY_SIZE (map_gcc_gdb))
574 return 0; 572 return 0;
575 573
576 return map_gcc_gdb[reg]; 574 return map_gcc_gdb[reg];
577 } 575 }
578 576
579 /* This function implements the BREAKPOINT_FROM_PC macro. It returns 577 /* This function implements the 'breakpoint_from_pc' gdbarch method.
580 a pointer to a string of bytes that encode a breakpoint instruction, 578 It returns a pointer to a string of bytes that encode a breakpoint
581 stores the length of the string to *lenptr, and adjusts the program 579 instruction, stores the length of the string to *lenptr, and
582 counter (if necessary) to point to the actual memory location where 580 adjusts the program counter (if necessary) to point to the actual
583 the breakpoint should be inserted. */ 581 memory location where the breakpoint should be inserted. */
584 582
585 static const unsigned char * 583 static const unsigned char *
586 bfin_breakpoint_from_pc (struct gdbarch *gdbarch, 584 bfin_breakpoint_from_pc (struct gdbarch *gdbarch,
587 CORE_ADDR *pcptr, int *lenptr) 585 CORE_ADDR *pcptr, int *lenptr)
588 { 586 {
589 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); 587 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
590 unsigned short iw; 588 unsigned short iw;
591 static unsigned char bfin_breakpoint[] = {0xa1, 0x00, 0x00, 0x00}; 589 static unsigned char bfin_breakpoint[] = {0xa1, 0x00, 0x00, 0x00};
592 static unsigned char bfin_sim_breakpoint[] = {0x25, 0x00, 0x00, 0x00}; 590 static unsigned char bfin_sim_breakpoint[] = {0x25, 0x00, 0x00, 0x00};
593 591
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 } 859 }
862 860
863 /* Provide a prototype to silence -Wmissing-prototypes. */ 861 /* Provide a prototype to silence -Wmissing-prototypes. */
864 extern initialize_file_ftype _initialize_bfin_tdep; 862 extern initialize_file_ftype _initialize_bfin_tdep;
865 863
866 void 864 void
867 _initialize_bfin_tdep (void) 865 _initialize_bfin_tdep (void)
868 { 866 {
869 register_gdbarch_init (bfd_arch_bfin, bfin_gdbarch_init); 867 register_gdbarch_init (bfd_arch_bfin, bfin_gdbarch_init);
870 } 868 }
OLDNEW
« no previous file with comments | « gdb/bfin-tdep.h ('k') | gdb/block.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698