Merge lp:~christophe-lyon/gdb-linaro/merge-from-gdb-7.5.1 into lp:gdb-linaro/7.5

Proposed by Christophe Lyon
Status: Merged
Merged at revision: 39070
Proposed branch: lp:~christophe-lyon/gdb-linaro/merge-from-gdb-7.5.1
Merge into: lp:gdb-linaro/7.5
Diff against target: 1454 lines (+607/-141)
35 files modified
ChangeLog.linaro (+12/-0)
gdb/ChangeLog (+111/-0)
gdb/amd64-tdep.c (+0/-3)
gdb/auto-load.c (+100/-17)
gdb/cli/cli-decode.c (+4/-1)
gdb/common/linux-ptrace.c (+88/-17)
gdb/defs.h (+1/-0)
gdb/doc/ChangeLog (+4/-0)
gdb/doc/gdb.texinfo (+7/-0)
gdb/dwarf2read.c (+7/-8)
gdb/frame.c (+7/-1)
gdb/gdbserver/ChangeLog (+9/-0)
gdb/gdbserver/gdbreplay.c (+2/-0)
gdb/gdbserver/linux-crisv32-low.c (+11/-12)
gdb/gdbserver/server.h (+1/-0)
gdb/i386-tdep.c (+0/-11)
gdb/i386-tdep.h (+0/-8)
gdb/infcmd.c (+5/-0)
gdb/infrun.c (+31/-15)
gdb/linespec.c (+20/-2)
gdb/main.c (+0/-4)
gdb/ppc-linux-tdep.c (+3/-2)
gdb/python/py-auto-load.c (+0/-4)
gdb/python/python.h (+4/-0)
gdb/symfile.c (+2/-2)
gdb/testsuite/ChangeLog (+60/-0)
gdb/testsuite/gdb.base/valgrind-infcall.exp (+0/-1)
gdb/testsuite/gdb.java/jmisc.exp (+2/-2)
gdb/testsuite/gdb.java/jprint.exp (+2/-2)
gdb/testsuite/gdb.linespec/ls-errs.exp (+1/-1)
gdb/testsuite/lib/gdb.exp (+94/-22)
gdb/value.c (+5/-1)
gdb/version.in (+1/-1)
libiberty/ChangeLog (+5/-0)
libiberty/md5.c (+8/-4)
To merge this branch: bzr merge lp:~christophe-lyon/gdb-linaro/merge-from-gdb-7.5.1
Reviewer Review Type Date Requested Status
Linaro Toolchain Developers Pending
Review via email: mp+138723@code.launchpad.net

Description of the change

Update to gdb-7.5.1, merge request to exercise the validation on ARM.

To post a comment you must log in.
Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild has taken a snapshot of this branch at r39070 and queued it for build.

The diff against the ancestor r39069 is available at:
 http://builds.linaro.org/toolchain/snapshots/gdb-linaro-7.4+bzr39070~christophe-lyon~merge-from-gdb-7.5.1.diff

and will be built on the following builders:
 a9hf-builder i686 x86_64

You can track the build queue at:
 http://ex.seabright.co.nz/helpers/scheduler

cbuild-snapshot: gdb-linaro-7.4+bzr39070~christophe-lyon~merge-from-gdb-7.5.1
cbuild-ancestor: lp:gdb-linaro+bzr39069
cbuild-state: check

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog.linaro'
--- ChangeLog.linaro 2012-09-13 14:19:38 +0000
+++ ChangeLog.linaro 2012-12-13 13:30:32 +0000
@@ -1,3 +1,15 @@
12012-12-07 Christophe Lyon <christophe.lyon@linaro.org>
2
3 gdb/
4 * version.in: Bump version.
5
62012-12-07 Christophe Lyon <christophe.lyon@linaro.org>
7
8 GDB Linaro 7.5-2012.12 released.
9
10 gdb/
11 * version.in: Update.
12
12012-09-13 Ulrich Weigand <ulrich.weigand@linaro.org>132012-09-13 Ulrich Weigand <ulrich.weigand@linaro.org>
214
3 gdb/15 gdb/
416
=== modified file 'gdb/ChangeLog'
--- gdb/ChangeLog 2012-08-17 18:42:07 +0000
+++ gdb/ChangeLog 2012-12-13 13:30:32 +0000
@@ -1,3 +1,114 @@
12012-11-29 Joel Brobecker <brobecker@adacore.com>
2
3 * version.in: Set version to 7.5.1.20121129-cvs.
4
52012-11-29 Joel Brobecker <brobecker@adacore.com>
6
7 * version.in: Update GDB version number to 7.5.1.
8
92012-11-15 Luis Machado <lgustavo@codesourcery.com>
10
11 * value.c (value_actual_type): Check for TYPE_CODE_STRUCT
12 target types.
13
142012-11-10 H.J. Lu <hongjiu.lu@intel.com>
15
16 PR backtrace/14646
17 PR gdb/14647
18 * i386-tdep.h (gdbarch_tdep): Remove sp_regnum_from_eax and
19 pc_regnum_from_eax.
20 * i386-tdep.c (i386_gdbarch_init): Don't use sp_regnum_from_eax
21 nor pc_regnum_from_eax.
22 * amd64-tdep.c (amd64_x32_init_abi): Don't set sp_regnum_from_eax
23 nor pc_regnum_from_eax.
24
252012-10-11 Doug Evans <dje@google.com>
26
27 PR breakpoints/14643.
28 * linespec.c (struct ls_parser): New member keyword_ok.
29 (linespec_lexer_lex_string): Add comment.
30 (linespec_lexer_lex_one): Ignore keywords if it's the wrong place
31 for one.
32 (parse_linespec): Set keyword_ok.
33
342012-10-06 Jan Kratochvil <jan.kratochvil@redhat.com>
35
36 Fix crash during stepping on ppc32.
37 * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Test NULL
38 SYM.
39
402012-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
41
42 * common/linux-ptrace.c: Change __i386__ to __i386__ || __x86_64__.
43 (linux_ptrace_test_ret_to_nx): Extend comment for x86_64. Change
44 __i386__ to __i386__ || __x86_64__. Extend code also for __x86_64__.
45 Extend code also for PaX support. Convert all gdb_assert to warning
46 calls.
47
482012-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
49
50 Implement auto-load user conveniences suggested by Doug Evans.
51 * auto-load.c: Include top.h.
52 (file_is_auto_load_safe): New variable advice_printed. Print advice.
53 (_initialize_auto_load): New variable scripts_directory_help. Mention
54 GDBPY_AUTO_FILE_NAME and GDB_AUTO_FILE_NAME for set auto-load
55 scripts-directory. Document in online help one can use also files for
56 set auto-load safe-path.
57 * python/py-auto-load.c: (GDBPY_AUTO_FILE_NAME): Move it from here ...
58 * python/python.h (GDBPY_AUTO_FILE_NAME): ... to here.
59
602012-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
61
62 PR 14119
63 * frame.c (skip_inlined_frames): Skip also TAILCALL_FRAME frames.
64 (frame_pop): Drop also TAILCALL_FRAME frames.
65 * infcmd.c (finish_command): Ignore also TAILCALL_FRAME frames.
66
672012-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
68 Pedro Alves <palves@redhat.com>
69
70 PR 14548
71 * infrun.c (handle_inferior_event): Do not reverse-continue back to the
72 function start if we are already at function start. Both for
73 reverse-next and for reverse-step into function without line number
74 info.
75
762012-08-29 Doug Evans <dje@google.com>
77
78 * main.c (print_gdb_help): Remove reference to
79 --use-deprecated-index-sections.
80
812012-08-27 Eli Zaretskii <eliz@gnu.org>
82 Jan Kratochvil <jan.kratochvil@redhat.com>
83
84 * auto-load.c (auto_load_objfile_script): Rename to ...
85 (auto_load_objfile_script_1): ... here, change variable realname to
86 parameter realname, document it, add return value, add variable retval.
87 (auto_load_objfile_script): New function.
88
892012-08-27 Jan Kratochvil <jan.kratochvil@redhat.com>
90
91 * cli/cli-decode.c (print_doc_line): Keep skipping '.' and ',' not
92 followed by a whitespace.
93
942012-08-27 Jan Kratochvil <jan.kratochvil@redhat.com>
95
96 PR gdb/14494.
97 * dwarf2read.c (dwarf2_locate_sections): Move variable aflag here.
98 Move the SEC_HAS_CONTENTS check here - for any NAMES use.
99 (dwarf2_locate_sections) <eh_frame>: Move the variable and check from
100 here.
101
1022012-08-22 Keith Seitz <keiths@redhat.com>
103
104 * defs.h: Include build-gnulib/config.h
105
1062012-08-21 Pierre Muller <muller@ics.u-strasbg.fr>
107
108 * symfile.c (allocate_symtab): Use host_address_to_string
109 function instead of cast of pointer to long which is not
110 compatible with x86_64-w64-mingw32 build.
111
12012-08-17 Joel Brobecker <brobecker@adacore.com>1122012-08-17 Joel Brobecker <brobecker@adacore.com>
2113
3 * version.in: Set version to 7.5.0.20120817-cvs.114 * version.in: Set version to 7.5.0.20120817-cvs.
4115
=== modified file 'gdb/amd64-tdep.c'
--- gdb/amd64-tdep.c 2012-07-04 20:46:18 +0000
+++ gdb/amd64-tdep.c 2012-12-13 13:30:32 +0000
@@ -2946,9 +2946,6 @@
2946 tdesc = tdesc_x32;2946 tdesc = tdesc_x32;
2947 tdep->tdesc = tdesc;2947 tdep->tdesc = tdesc;
29482948
2949 tdep->sp_regnum_from_eax = AMD64_RSP_REGNUM;
2950 tdep->pc_regnum_from_eax = AMD64_RIP_REGNUM;
2951
2952 tdep->num_dword_regs = 17;2949 tdep->num_dword_regs = 17;
2953 set_tdesc_pseudo_register_type (gdbarch, amd64_x32_pseudo_register_type);2950 set_tdesc_pseudo_register_type (gdbarch, amd64_x32_pseudo_register_type);
29542951
29552952
=== modified file 'gdb/auto-load.c'
--- gdb/auto-load.c 2012-07-02 10:57:31 +0000
+++ gdb/auto-load.c 2012-12-13 13:30:32 +0000
@@ -37,6 +37,7 @@
37#include "completer.h"37#include "completer.h"
38#include "observer.h"38#include "observer.h"
39#include "fnmatch.h"39#include "fnmatch.h"
40#include "top.h"
4041
41/* The suffix of per-objfile scripts to auto-load as non-Python command files.42/* The suffix of per-objfile scripts to auto-load as non-Python command files.
42 E.g. When the program loads libfoo.so, look for libfoo-gdb.gdb. */43 E.g. When the program loads libfoo.so, look for libfoo-gdb.gdb. */
@@ -441,6 +442,7 @@
441{442{
442 char *filename_real = NULL;443 char *filename_real = NULL;
443 struct cleanup *back_to;444 struct cleanup *back_to;
445 static int advice_printed = 0;
444446
445 if (debug_auto_load)447 if (debug_auto_load)
446 {448 {
@@ -470,6 +472,30 @@
470 "`auto-load safe-path' set to \"%s\"."),472 "`auto-load safe-path' set to \"%s\"."),
471 filename_real, auto_load_safe_path);473 filename_real, auto_load_safe_path);
472474
475 if (!advice_printed)
476 {
477 const char *homedir = getenv ("HOME");
478 char *homeinit;
479
480 if (homedir == NULL)
481 homedir = "$HOME";
482 homeinit = xstrprintf ("%s/%s", homedir, gdbinit);
483 make_cleanup (xfree, homeinit);
484
485 printf_filtered (_("\
486To enable execution of this file add\n\
487\tadd-auto-load-safe-path %s\n\
488line to your configuration file \"%s\".\n\
489To completely disable this security protection add\n\
490\tset auto-load safe-path /\n\
491line to your configuration file \"%s\".\n\
492For more information about this security protection see the\n\
493\"Auto-loading safe path\" section in the GDB manual. E.g., run from the shell:\n\
494\tinfo \"(gdb)Auto-loading safe path\"\n"),
495 filename_real, homeinit, homeinit);
496 advice_printed = 1;
497 }
498
473 do_cleanups (back_to);499 do_cleanups (back_to);
474 return 0;500 return 0;
475}501}
@@ -693,27 +719,25 @@
693 }719 }
694}720}
695721
696/* Look for the auto-load script in LANGUAGE associated with OBJFILE and load722/* Look for the auto-load script in LANGUAGE associated with OBJFILE where
697 it. */723 OBJFILE's gdb_realpath is REALNAME and load it. Return 1 if we found any
724 matching script, return 0 otherwise. */
698725
699void726static int
700auto_load_objfile_script (struct objfile *objfile,727auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
701 const struct script_language *language)728 const struct script_language *language)
702{729{
703 char *realname;
704 char *filename, *debugfile;730 char *filename, *debugfile;
705 int len;731 int len, retval;
706 FILE *input;732 FILE *input;
707 struct cleanup *cleanups;733 struct cleanup *cleanups;
708734
709 realname = gdb_realpath (objfile->name);
710 len = strlen (realname);735 len = strlen (realname);
711 filename = xmalloc (len + strlen (language->suffix) + 1);736 filename = xmalloc (len + strlen (language->suffix) + 1);
712 memcpy (filename, realname, len);737 memcpy (filename, realname, len);
713 strcpy (filename + len, language->suffix);738 strcpy (filename + len, language->suffix);
714739
715 cleanups = make_cleanup (xfree, filename);740 cleanups = make_cleanup (xfree, filename);
716 make_cleanup (xfree, realname);
717741
718 input = fopen (filename, "r");742 input = fopen (filename, "r");
719 debugfile = filename;743 debugfile = filename;
@@ -768,6 +792,44 @@
768 and these scripts are required to be idempotent under multiple792 and these scripts are required to be idempotent under multiple
769 loads anyway. */793 loads anyway. */
770 language->source_script_for_objfile (objfile, input, debugfile);794 language->source_script_for_objfile (objfile, input, debugfile);
795
796 retval = 1;
797 }
798 else
799 retval = 0;
800
801 do_cleanups (cleanups);
802 return retval;
803}
804
805/* Look for the auto-load script in LANGUAGE associated with OBJFILE and load
806 it. */
807
808void
809auto_load_objfile_script (struct objfile *objfile,
810 const struct script_language *language)
811{
812 char *realname = gdb_realpath (objfile->name);
813 struct cleanup *cleanups = make_cleanup (xfree, realname);
814
815 if (!auto_load_objfile_script_1 (objfile, realname, language))
816 {
817 /* For Windows/DOS .exe executables, strip the .exe suffix, so that
818 FOO-gdb.gdb could be used for FOO.exe, and try again. */
819
820 size_t len = strlen (realname);
821 const size_t lexe = sizeof (".exe") - 1;
822
823 if (len > lexe && strcasecmp (realname + len - lexe, ".exe") == 0)
824 {
825 len -= lexe;
826 realname[len] = '\0';
827 if (debug_auto_load)
828 fprintf_unfiltered (gdb_stdlog, _("auto-load: Stripped .exe suffix, "
829 "retrying with \"%s\".\n"),
830 realname);
831 auto_load_objfile_script_1 (objfile, realname, language);
832 }
771 }833 }
772834
773 do_cleanups (cleanups);835 do_cleanups (cleanups);
@@ -1130,6 +1192,7 @@
1130_initialize_auto_load (void)1192_initialize_auto_load (void)
1131{1193{
1132 struct cmd_list_element *cmd;1194 struct cmd_list_element *cmd;
1195 char *scripts_directory_help;
11331196
1134 auto_load_pspace_data1197 auto_load_pspace_data
1135 = register_program_space_data_with_cleanup (auto_load_pspace_data_cleanup);1198 = register_program_space_data_with_cleanup (auto_load_pspace_data_cleanup);
@@ -1172,30 +1235,50 @@
1172 auto_load_info_cmdlist_get ());1235 auto_load_info_cmdlist_get ());
11731236
1174 auto_load_dir = xstrdup (AUTO_LOAD_DIR);1237 auto_load_dir = xstrdup (AUTO_LOAD_DIR);
1238 scripts_directory_help = xstrprintf (
1239#ifdef HAVE_PYTHON
1240 _("\
1241Automatically loaded Python scripts (named OBJFILE%s) and GDB scripts\n\
1242(named OBJFILE%s) are located in one of the directories listed by this\n\
1243option.\n\
1244%s"),
1245 GDBPY_AUTO_FILE_NAME,
1246#else
1247 _("\
1248Automatically loaded GDB scripts (named OBJFILE%s) are located in one\n\
1249of the directories listed by this option.\n\
1250%s"),
1251#endif
1252 GDB_AUTO_FILE_NAME,
1253 _("\
1254This option is ignored for the kinds of scripts \
1255having 'set auto-load ... off'.\n\
1256Directories listed here need to be present also \
1257in the 'set auto-load safe-path'\n\
1258option."));
1175 add_setshow_optional_filename_cmd ("scripts-directory", class_support,1259 add_setshow_optional_filename_cmd ("scripts-directory", class_support,
1176 &auto_load_dir, _("\1260 &auto_load_dir, _("\
1177Set the list of directories from which to load auto-loaded scripts."), _("\1261Set the list of directories from which to load auto-loaded scripts."), _("\
1178Show the list of directories from which to load auto-loaded scripts."), _("\1262Show the list of directories from which to load auto-loaded scripts."),
1179Automatically loaded Python scripts and GDB scripts are located in one of the\n\1263 scripts_directory_help,
1180directories listed by this option. This option is ignored for the kinds of\n\
1181scripts having 'set auto-load ... off'. Directories listed here need to be\n\
1182present also in the 'set auto-load safe-path' option."),
1183 set_auto_load_dir, show_auto_load_dir,1264 set_auto_load_dir, show_auto_load_dir,
1184 auto_load_set_cmdlist_get (),1265 auto_load_set_cmdlist_get (),
1185 auto_load_show_cmdlist_get ());1266 auto_load_show_cmdlist_get ());
1267 xfree (scripts_directory_help);
11861268
1187 auto_load_safe_path = xstrdup (AUTO_LOAD_SAFE_PATH);1269 auto_load_safe_path = xstrdup (AUTO_LOAD_SAFE_PATH);
1188 auto_load_safe_path_vec_update ();1270 auto_load_safe_path_vec_update ();
1189 add_setshow_optional_filename_cmd ("safe-path", class_support,1271 add_setshow_optional_filename_cmd ("safe-path", class_support,
1190 &auto_load_safe_path, _("\1272 &auto_load_safe_path, _("\
1191Set the list of directories from which it is safe to auto-load files."), _("\1273Set the list of files and directories that are safe for auto-loading."), _("\
1192Show the list of directories from which it is safe to auto-load files."), _("\1274Show the list of files and directories that are safe for auto-loading."), _("\
1193Various files loaded automatically for the 'set auto-load ...' options must\n\1275Various files loaded automatically for the 'set auto-load ...' options must\n\
1194be located in one of the directories listed by this option. Warning will be\n\1276be located in one of the directories listed by this option. Warning will be\n\
1195printed and file will not be used otherwise.\n\1277printed and file will not be used otherwise.\n\
1278You can mix both directory and filename entries.\n\
1196Setting this parameter to an empty list resets it to its default value.\n\1279Setting this parameter to an empty list resets it to its default value.\n\
1197Setting this parameter to '/' (without the quotes) allows any file\n\1280Setting this parameter to '/' (without the quotes) allows any file\n\
1198for the 'set auto-load ...' options. Each directory can be also shell\n\1281for the 'set auto-load ...' options. Each path entry can be also shell\n\
1199wildcard pattern; '*' does not match directory separator.\n\1282wildcard pattern; '*' does not match directory separator.\n\
1200This option is ignored for the kinds of files having 'set auto-load ... off'.\n\1283This option is ignored for the kinds of files having 'set auto-load ... off'.\n\
1201This options has security implications for untrusted inferiors."),1284This options has security implications for untrusted inferiors."),
12021285
=== modified file 'gdb/cli/cli-decode.c'
--- gdb/cli/cli-decode.c 2012-06-13 15:47:13 +0000
+++ gdb/cli/cli-decode.c 2012-12-13 13:30:32 +0000
@@ -1003,8 +1003,11 @@
1003 line_buffer = (char *) xmalloc (line_size);1003 line_buffer = (char *) xmalloc (line_size);
1004 }1004 }
10051005
1006 /* Keep printing '.' or ',' not followed by a whitespace for embedded strings
1007 like '.gdbinit'. */
1006 p = str;1008 p = str;
1007 while (*p && *p != '\n' && *p != '.' && *p != ',')1009 while (*p && *p != '\n'
1010 && ((*p != '.' && *p != ',') || (p[1] && !isspace (p[1]))))
1008 p++;1011 p++;
1009 if (p - str > line_size - 1)1012 if (p - str > line_size - 1)
1010 {1013 {
10111014
=== modified file 'gdb/common/linux-ptrace.c'
--- gdb/common/linux-ptrace.c 2012-07-07 12:13:56 +0000
+++ gdb/common/linux-ptrace.c 2012-12-13 13:30:32 +0000
@@ -49,7 +49,7 @@
49 (int) pid);49 (int) pid);
50}50}
5151
52#ifdef __i386__52#if defined __i386__ || defined __x86_64__
5353
54/* Address of the 'ret' instruction in asm code block below. */54/* Address of the 'ret' instruction in asm code block below. */
55extern void (linux_ptrace_test_ret_to_nx_instr) (void);55extern void (linux_ptrace_test_ret_to_nx_instr) (void);
@@ -60,15 +60,17 @@
60#include <sys/wait.h>60#include <sys/wait.h>
61#include <stdint.h>61#include <stdint.h>
6262
63#endif /* __i386__ */63#endif /* defined __i386__ || defined __x86_64__ */
6464
65/* Test broken off-trunk Linux kernel patchset for NX support on i386. It was65/* Test broken off-trunk Linux kernel patchset for NX support on i386. It was
66 removed in Fedora kernel 88fa1f0332d188795ed73d7ac2b1564e11a0b4cd. */66 removed in Fedora kernel 88fa1f0332d188795ed73d7ac2b1564e11a0b4cd.
67
68 Test also x86_64 arch for PaX support. */
6769
68static void70static void
69linux_ptrace_test_ret_to_nx (void)71linux_ptrace_test_ret_to_nx (void)
70{72{
71#ifdef __i386__73#if defined __i386__ || defined __x86_64__
72 pid_t child, got_pid;74 pid_t child, got_pid;
73 gdb_byte *return_address, *pc;75 gdb_byte *return_address, *pc;
74 long l;76 long l;
@@ -101,39 +103,105 @@
101 strerror (errno));103 strerror (errno));
102 else104 else
103 {105 {
106#if defined __i386__
104 asm volatile ("pushl %0;"107 asm volatile ("pushl %0;"
105 ".globl linux_ptrace_test_ret_to_nx_instr;"108 ".globl linux_ptrace_test_ret_to_nx_instr;"
106 "linux_ptrace_test_ret_to_nx_instr:"109 "linux_ptrace_test_ret_to_nx_instr:"
107 "ret"110 "ret"
108 : : "r" (return_address) : "%esp", "memory");111 : : "r" (return_address) : "%esp", "memory");
112#elif defined __x86_64__
113 asm volatile ("pushq %0;"
114 ".globl linux_ptrace_test_ret_to_nx_instr;"
115 "linux_ptrace_test_ret_to_nx_instr:"
116 "ret"
117 : : "r" (return_address) : "%rsp", "memory");
118#else
119# error "!__i386__ && !__x86_64__"
120#endif
109 gdb_assert_not_reached ("asm block did not terminate");121 gdb_assert_not_reached ("asm block did not terminate");
110 }122 }
111123
112 _exit (1);124 _exit (1);
113 }125 }
114126
127 errno = 0;
115 got_pid = waitpid (child, &status, 0);128 got_pid = waitpid (child, &status, 0);
116 gdb_assert (got_pid == child);129 if (got_pid != child)
117 gdb_assert (WIFSTOPPED (status));130 {
131 warning (_("linux_ptrace_test_ret_to_nx: waitpid returned %ld: %s"),
132 (long) got_pid, strerror (errno));
133 return;
134 }
135
136 if (WIFSIGNALED (status))
137 {
138 if (WTERMSIG (status) != SIGKILL)
139 warning (_("linux_ptrace_test_ret_to_nx: WTERMSIG %d is not SIGKILL!"),
140 (int) WTERMSIG (status));
141 else
142 warning (_("Cannot call inferior functions, Linux kernel PaX "
143 "protection forbids return to non-executable pages!"));
144 return;
145 }
146
147 if (!WIFSTOPPED (status))
148 {
149 warning (_("linux_ptrace_test_ret_to_nx: status %d is not WIFSTOPPED!"),
150 status);
151 return;
152 }
118153
119 /* We may get SIGSEGV due to missing PROT_EXEC of the return_address. */154 /* We may get SIGSEGV due to missing PROT_EXEC of the return_address. */
120 gdb_assert (WSTOPSIG (status) == SIGTRAP || WSTOPSIG (status) == SIGSEGV);155 if (WSTOPSIG (status) != SIGTRAP && WSTOPSIG (status) != SIGSEGV)
156 {
157 warning (_("linux_ptrace_test_ret_to_nx: "
158 "WSTOPSIG %d is neither SIGTRAP nor SIGSEGV!"),
159 (int) WSTOPSIG (status));
160 return;
161 }
121162
122 errno = 0;163 errno = 0;
164#if defined __i386__
123 l = ptrace (PTRACE_PEEKUSER, child, (void *) (uintptr_t) (EIP * 4), NULL);165 l = ptrace (PTRACE_PEEKUSER, child, (void *) (uintptr_t) (EIP * 4), NULL);
124 gdb_assert (errno == 0);166#elif defined __x86_64__
167 l = ptrace (PTRACE_PEEKUSER, child, (void *) (uintptr_t) (RIP * 8), NULL);
168#else
169# error "!__i386__ && !__x86_64__"
170#endif
171 if (errno != 0)
172 {
173 warning (_("linux_ptrace_test_ret_to_nx: Cannot PTRACE_PEEKUSER: %s"),
174 strerror (errno));
175 return;
176 }
125 pc = (void *) (uintptr_t) l;177 pc = (void *) (uintptr_t) l;
126178
127 if (ptrace (PTRACE_KILL, child, NULL, NULL) != 0)179 if (ptrace (PTRACE_KILL, child, NULL, NULL) != 0)
128 warning (_("linux_ptrace_test_ret_to_nx: Cannot PTRACE_KILL: %s"),180 {
129 strerror (errno));181 warning (_("linux_ptrace_test_ret_to_nx: Cannot PTRACE_KILL: %s"),
182 strerror (errno));
183 return;
184 }
130 else185 else
131 {186 {
132 int kill_status;187 int kill_status;
133188
189 errno = 0;
134 got_pid = waitpid (child, &kill_status, 0);190 got_pid = waitpid (child, &kill_status, 0);
135 gdb_assert (got_pid == child);191 if (got_pid != child)
136 gdb_assert (WIFSIGNALED (kill_status));192 {
193 warning (_("linux_ptrace_test_ret_to_nx: "
194 "PTRACE_KILL waitpid returned %ld: %s"),
195 (long) got_pid, strerror (errno));
196 return;
197 }
198 if (!WIFSIGNALED (kill_status))
199 {
200 warning (_("linux_ptrace_test_ret_to_nx: "
201 "PTRACE_KILL status %d is not WIFSIGNALED!"),
202 status);
203 return;
204 }
137 }205 }
138206
139 /* + 1 is there as x86* stops after the 'int3' instruction. */207 /* + 1 is there as x86* stops after the 'int3' instruction. */
@@ -150,11 +218,14 @@
150 return;218 return;
151 }219 }
152220
153 gdb_assert ((void (*) (void)) pc == &linux_ptrace_test_ret_to_nx_instr);221 if ((void (*) (void)) pc != &linux_ptrace_test_ret_to_nx_instr)
154222 warning (_("linux_ptrace_test_ret_to_nx: PC %p is neither near return "
155 warning (_("Cannot call inferior functions, you have broken "223 "address %p nor is the return instruction %p!"),
156 "Linux kernel i386 NX (non-executable pages) support!"));224 pc, return_address, &linux_ptrace_test_ret_to_nx_instr);
157#endif /* __i386__ */225 else
226 warning (_("Cannot call inferior functions, you have broken "
227 "Linux kernel i386 NX (non-executable pages) support!"));
228#endif /* defined __i386__ || defined __x86_64__ */
158}229}
159230
160/* Display possible problems on this system. Display them only once per GDB231/* Display possible problems on this system. Display them only once per GDB
161232
=== modified file 'gdb/defs.h'
--- gdb/defs.h 2012-07-02 10:57:31 +0000
+++ gdb/defs.h 2012-12-13 13:30:32 +0000
@@ -27,6 +27,7 @@
27#endif27#endif
2828
29#include "config.h" /* Generated by configure. */29#include "config.h" /* Generated by configure. */
30#include "build-gnulib/config.h"
3031
31#include <sys/types.h>32#include <sys/types.h>
32#include <stdio.h>33#include <stdio.h>
3334
=== modified file 'gdb/doc/ChangeLog'
--- gdb/doc/ChangeLog 2012-08-07 16:51:51 +0000
+++ gdb/doc/ChangeLog 2012-12-13 13:30:32 +0000
@@ -1,3 +1,7 @@
12012-08-27 Jan Kratochvil <jan.kratochvil@redhat.com>
2
3 * gdb.texinfo (objfile-gdb.py file): New paragraph for .exe stripping.
4
12012-08-07 Jan Kratochvil <jan.kratochvil@redhat.com>52012-08-07 Jan Kratochvil <jan.kratochvil@redhat.com>
26
3 * gdbint.texinfo (Debugging GDB): In section7 * gdbint.texinfo (Debugging GDB): In section
48
=== modified file 'gdb/doc/gdb.texinfo'
--- gdb/doc/gdb.texinfo 2012-07-20 17:59:04 +0000
+++ gdb/doc/gdb.texinfo 2012-12-13 13:30:32 +0000
@@ -25785,6 +25785,13 @@
25785Note that loading of this script file also requires accordingly configured25785Note that loading of this script file also requires accordingly configured
25786@code{auto-load safe-path} (@pxref{Auto-loading safe path}).25786@code{auto-load safe-path} (@pxref{Auto-loading safe path}).
2578725787
25788For object files using @file{.exe} suffix @value{GDBN} tries to load first the
25789scripts normally according to its @file{.exe} filename. But if no scripts are
25790found @value{GDBN} also tries script filenames matching the object file without
25791its @file{.exe} suffix. This @file{.exe} stripping is case insensitive and it
25792is attempted on any platform. This makes the script filenames compatible
25793between Unix and MS-Windows hosts.
25794
25788@table @code25795@table @code
25789@anchor{set auto-load scripts-directory}25796@anchor{set auto-load scripts-directory}
25790@kindex set auto-load scripts-directory25797@kindex set auto-load scripts-directory
2579125798
=== modified file 'gdb/dwarf2read.c'
--- gdb/dwarf2read.c 2012-07-20 17:59:04 +0000
+++ gdb/dwarf2read.c 2012-12-13 13:30:32 +0000
@@ -1691,13 +1691,17 @@
1691dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames)1691dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames)
1692{1692{
1693 const struct dwarf2_debug_sections *names;1693 const struct dwarf2_debug_sections *names;
1694 flagword aflag = bfd_get_section_flags (abfd, sectp);
16941695
1695 if (vnames == NULL)1696 if (vnames == NULL)
1696 names = &dwarf2_elf_names;1697 names = &dwarf2_elf_names;
1697 else1698 else
1698 names = (const struct dwarf2_debug_sections *) vnames;1699 names = (const struct dwarf2_debug_sections *) vnames;
16991700
1700 if (section_is_p (sectp->name, &names->info))1701 if ((aflag & SEC_HAS_CONTENTS) == 0)
1702 {
1703 }
1704 else if (section_is_p (sectp->name, &names->info))
1701 {1705 {
1702 dwarf2_per_objfile->info.asection = sectp;1706 dwarf2_per_objfile->info.asection = sectp;
1703 dwarf2_per_objfile->info.size = bfd_get_section_size (sectp);1707 dwarf2_per_objfile->info.size = bfd_get_section_size (sectp);
@@ -1744,13 +1748,8 @@
1744 }1748 }
1745 else if (section_is_p (sectp->name, &names->eh_frame))1749 else if (section_is_p (sectp->name, &names->eh_frame))
1746 {1750 {
1747 flagword aflag = bfd_get_section_flags (abfd, sectp);1751 dwarf2_per_objfile->eh_frame.asection = sectp;
17481752 dwarf2_per_objfile->eh_frame.size = bfd_get_section_size (sectp);
1749 if (aflag & SEC_HAS_CONTENTS)
1750 {
1751 dwarf2_per_objfile->eh_frame.asection = sectp;
1752 dwarf2_per_objfile->eh_frame.size = bfd_get_section_size (sectp);
1753 }
1754 }1753 }
1755 else if (section_is_p (sectp->name, &names->ranges))1754 else if (section_is_p (sectp->name, &names->ranges))
1756 {1755 {
17571756
=== modified file 'gdb/frame.c'
--- gdb/frame.c 2012-03-01 20:48:50 +0000
+++ gdb/frame.c 2012-12-13 13:30:32 +0000
@@ -309,7 +309,8 @@
309static struct frame_info *309static struct frame_info *
310skip_inlined_frames (struct frame_info *frame)310skip_inlined_frames (struct frame_info *frame)
311{311{
312 while (get_frame_type (frame) == INLINE_FRAME)312 while (get_frame_type (frame) == INLINE_FRAME
313 || get_frame_type (frame) == TAILCALL_FRAME)
313 frame = get_prev_frame (frame);314 frame = get_prev_frame (frame);
314315
315 return frame;316 return frame;
@@ -814,6 +815,11 @@
814 if (!prev_frame)815 if (!prev_frame)
815 error (_("Cannot pop the initial frame."));816 error (_("Cannot pop the initial frame."));
816817
818 /* Ignore TAILCALL_FRAME type frames, they were executed already before
819 entering THISFRAME. */
820 while (get_frame_type (prev_frame) == TAILCALL_FRAME)
821 prev_frame = get_prev_frame (prev_frame);
822
817 /* Make a copy of all the register values unwound from this frame.823 /* Make a copy of all the register values unwound from this frame.
818 Save them in a scratch buffer so that there isn't a race between824 Save them in a scratch buffer so that there isn't a race between
819 trying to extract the old values from the current regcache while825 trying to extract the old values from the current regcache while
820826
=== modified file 'gdb/gdbserver/ChangeLog'
--- gdb/gdbserver/ChangeLog 2012-08-02 15:53:42 +0000
+++ gdb/gdbserver/ChangeLog 2012-12-13 13:30:32 +0000
@@ -1,3 +1,12 @@
12012-09-05 Michael Brandt <michael.brandt@axis.com>
2
3 * linux-crisv32-low.c: Fix compile errors.
4
52012-08-22 Keith Seitz <keiths@redhat.com>
6
7 * server.h: Include build-gnulib-gbserver/config.h.
8 * gdbreplay.c: Likewise.
9
12012-08-02 Ulrich Weigand <ulrich.weigand@linaro.org>102012-08-02 Ulrich Weigand <ulrich.weigand@linaro.org>
211
3 * hostio.c (handle_pread): If pread fails, fall back to attempting12 * hostio.c (handle_pread): If pread fails, fall back to attempting
413
=== modified file 'gdb/gdbserver/gdbreplay.c'
--- gdb/gdbserver/gdbreplay.c 2012-01-04 08:16:51 +0000
+++ gdb/gdbserver/gdbreplay.c 2012-12-13 13:30:32 +0000
@@ -19,6 +19,8 @@
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
2020
21#include "config.h"21#include "config.h"
22#include "build-gnulib-gdbserver/config.h"
23
22#include <stdio.h>24#include <stdio.h>
23#if HAVE_SYS_FILE_H25#if HAVE_SYS_FILE_H
24#include <sys/file.h>26#include <sys/file.h>
2527
=== modified file 'gdb/gdbserver/linux-crisv32-low.c'
--- gdb/gdbserver/linux-crisv32-low.c 2012-03-28 18:30:01 +0000
+++ gdb/gdbserver/linux-crisv32-low.c 2012-12-13 13:30:32 +0000
@@ -231,6 +231,7 @@
231 unsigned long bp_ctrl;231 unsigned long bp_ctrl;
232 unsigned long start, end;232 unsigned long start, end;
233 struct regcache *regcache;233 struct regcache *regcache;
234 unsigned long bp_d_regs[12];
234235
235 /* Breakpoint/watchpoint types:236 /* Breakpoint/watchpoint types:
236 0 = memory breakpoint for instructions237 0 = memory breakpoint for instructions
@@ -259,8 +260,6 @@
259 single switch (addr) as there may be several watchpoints with260 single switch (addr) as there may be several watchpoints with
260 the same start address for example. */261 the same start address for example. */
261262
262 unsigned long bp_d_regs[12];
263
264 /* Get all range registers to simplify search. */263 /* Get all range registers to simplify search. */
265 collect_register_by_name (regcache, "s3", &bp_d_regs[0]);264 collect_register_by_name (regcache, "s3", &bp_d_regs[0]);
266 collect_register_by_name (regcache, "s4", &bp_d_regs[1]);265 collect_register_by_name (regcache, "s4", &bp_d_regs[1]);
@@ -321,8 +320,9 @@
321cris_stopped_by_watchpoint (void)320cris_stopped_by_watchpoint (void)
322{321{
323 unsigned long exs;322 unsigned long exs;
323 struct regcache *regcache = get_thread_regcache (current_inferior, 1);
324324
325 collect_register_by_name ("exs", &exs);325 collect_register_by_name (regcache, "exs", &exs);
326326
327 return (((exs & 0xff00) >> 8) == 0xc);327 return (((exs & 0xff00) >> 8) == 0xc);
328}328}
@@ -331,47 +331,46 @@
331cris_stopped_data_address (void)331cris_stopped_data_address (void)
332{332{
333 unsigned long eda;333 unsigned long eda;
334 struct regcache *regcache = get_thread_regcache (current_inferior, 1);
334335
335 collect_register_by_name ("eda", &eda);336 collect_register_by_name (regcache, "eda", &eda);
336337
337 /* FIXME: Possibly adjust to match watched range. */338 /* FIXME: Possibly adjust to match watched range. */
338 return eda;339 return eda;
339}340}
340341
341static void342static void
342cris_fill_gregset (void *buf)343cris_fill_gregset (struct regcache *regcache, void *buf)
343{344{
344 int i;345 int i;
345346
346 for (i = 0; i < cris_num_regs; i++)347 for (i = 0; i < cris_num_regs; i++)
347 {348 {
348 if (cris_regmap[i] != -1)349 if (cris_regmap[i] != -1)
349 collect_register (i, ((char *) buf) + cris_regmap[i]);350 collect_register (regcache, i, ((char *) buf) + cris_regmap[i]);
350 }351 }
351}352}
352353
353static void354static void
354cris_store_gregset (const void *buf)355cris_store_gregset (struct regcache *regcache, const void *buf)
355{356{
356 int i;357 int i;
357358
358 for (i = 0; i < cris_num_regs; i++)359 for (i = 0; i < cris_num_regs; i++)
359 {360 {
360 if (cris_regmap[i] != -1)361 if (cris_regmap[i] != -1)
361 supply_register (i, ((char *) buf) + cris_regmap[i]);362 supply_register (regcache, i, ((char *) buf) + cris_regmap[i]);
362 }363 }
363}364}
364365
365typedef unsigned long elf_gregset_t[cris_num_regs];
366
367struct regset_info target_regsets[] = {366struct regset_info target_regsets[] = {
368 { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),367 { PTRACE_GETREGS, PTRACE_SETREGS, 0, cris_num_regs * 4,
369 GENERAL_REGS, cris_fill_gregset, cris_store_gregset },368 GENERAL_REGS, cris_fill_gregset, cris_store_gregset },
370 { 0, 0, 0, -1, -1, NULL, NULL }369 { 0, 0, 0, -1, -1, NULL, NULL }
371};370};
372371
373struct linux_target_ops the_low_target = {372struct linux_target_ops the_low_target = {
374 init_register_crisv32,373 init_registers_crisv32,
375 -1,374 -1,
376 NULL,375 NULL,
377 NULL,376 NULL,
378377
=== modified file 'gdb/gdbserver/server.h'
--- gdb/gdbserver/server.h 2012-04-29 06:28:30 +0000
+++ gdb/gdbserver/server.h 2012-12-13 13:30:32 +0000
@@ -21,6 +21,7 @@
21#define SERVER_H21#define SERVER_H
2222
23#include "config.h"23#include "config.h"
24#include "build-gnulib-gdbserver/config.h"
2425
25#ifdef __MINGW32CE__26#ifdef __MINGW32CE__
26#include "wincecompat.h"27#include "wincecompat.h"
2728
=== modified file 'gdb/i386-tdep.c'
--- gdb/i386-tdep.c 2012-07-04 20:46:18 +0000
+++ gdb/i386-tdep.c 2012-12-13 13:30:32 +0000
@@ -7805,9 +7805,6 @@
7805 tdep->num_mmx_regs = 8;7805 tdep->num_mmx_regs = 8;
7806 tdep->num_ymm_regs = 0;7806 tdep->num_ymm_regs = 0;
78077807
7808 tdep->sp_regnum_from_eax = -1;
7809 tdep->pc_regnum_from_eax = -1;
7810
7811 tdesc_data = tdesc_data_alloc ();7808 tdesc_data = tdesc_data_alloc ();
78127809
7813 set_gdbarch_relocate_instruction (gdbarch, i386_relocate_instruction);7810 set_gdbarch_relocate_instruction (gdbarch, i386_relocate_instruction);
@@ -7852,14 +7849,6 @@
7852 /* Support dword pseudo-register if it hasn't been disabled. */7849 /* Support dword pseudo-register if it hasn't been disabled. */
7853 tdep->eax_regnum = ymm0_regnum;7850 tdep->eax_regnum = ymm0_regnum;
7854 ymm0_regnum += tdep->num_dword_regs;7851 ymm0_regnum += tdep->num_dword_regs;
7855 if (tdep->sp_regnum_from_eax != -1)
7856 set_gdbarch_sp_regnum (gdbarch,
7857 (tdep->eax_regnum
7858 + tdep->sp_regnum_from_eax));
7859 if (tdep->pc_regnum_from_eax != -1)
7860 set_gdbarch_pc_regnum (gdbarch,
7861 (tdep->eax_regnum
7862 + tdep->pc_regnum_from_eax));
7863 }7852 }
7864 else7853 else
7865 tdep->eax_regnum = -1;7854 tdep->eax_regnum = -1;
78667855
=== modified file 'gdb/i386-tdep.h'
--- gdb/i386-tdep.h 2012-07-04 20:46:18 +0000
+++ gdb/i386-tdep.h 2012-12-13 13:30:32 +0000
@@ -149,14 +149,6 @@
149 of pseudo dword register support. */149 of pseudo dword register support. */
150 int eax_regnum;150 int eax_regnum;
151151
152 /* Register number for SP, relative to %eax. Set this to -1 to
153 indicate the absence of pseudo SP register support. */
154 int sp_regnum_from_eax;
155
156 /* Register number for PC, relative to %eax. Set this to -1 to
157 indicate the absence of pseudo PC register support. */
158 int pc_regnum_from_eax;
159
160 /* Number of core registers. */152 /* Number of core registers. */
161 int num_core_regs;153 int num_core_regs;
162154
163155
=== modified file 'gdb/infcmd.c'
--- gdb/infcmd.c 2012-06-29 22:46:42 +0000
+++ gdb/infcmd.c 2012-12-13 13:30:32 +0000
@@ -1777,6 +1777,11 @@
1777 return;1777 return;
1778 }1778 }
17791779
1780 /* Ignore TAILCALL_FRAME type frames, they were executed already before
1781 entering THISFRAME. */
1782 while (get_frame_type (frame) == TAILCALL_FRAME)
1783 frame = get_prev_frame (frame);
1784
1780 /* Find the function we will return from. */1785 /* Find the function we will return from. */
17811786
1782 function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));1787 function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
17831788
=== modified file 'gdb/infrun.c'
--- gdb/infrun.c 2012-07-01 10:37:02 +0000
+++ gdb/infrun.c 2012-12-13 13:30:32 +0000
@@ -4896,14 +4896,22 @@
48964896
4897 if (execution_direction == EXEC_REVERSE)4897 if (execution_direction == EXEC_REVERSE)
4898 {4898 {
4899 struct symtab_and_line sr_sal;4899 /* If we're already at the start of the function, we've either
4900 just stepped backward into a single instruction function,
4901 or stepped back out of a signal handler to the first instruction
4902 of the function. Just keep going, which will single-step back
4903 to the caller. */
4904 if (ecs->stop_func_start != stop_pc)
4905 {
4906 struct symtab_and_line sr_sal;
49004907
4901 /* Normal function call return (static or dynamic). */4908 /* Normal function call return (static or dynamic). */
4902 init_sal (&sr_sal);4909 init_sal (&sr_sal);
4903 sr_sal.pc = ecs->stop_func_start;4910 sr_sal.pc = ecs->stop_func_start;
4904 sr_sal.pspace = get_frame_program_space (frame);4911 sr_sal.pspace = get_frame_program_space (frame);
4905 insert_step_resume_breakpoint_at_sal (gdbarch,4912 insert_step_resume_breakpoint_at_sal (gdbarch,
4906 sr_sal, null_frame_id);4913 sr_sal, null_frame_id);
4914 }
4907 }4915 }
4908 else4916 else
4909 insert_step_resume_breakpoint_at_caller (frame);4917 insert_step_resume_breakpoint_at_caller (frame);
@@ -4973,15 +4981,23 @@
49734981
4974 if (execution_direction == EXEC_REVERSE)4982 if (execution_direction == EXEC_REVERSE)
4975 {4983 {
4976 /* Set a breakpoint at callee's start address.4984 /* If we're already at the start of the function, we've either just
4977 From there we can step once and be back in the caller. */4985 stepped backward into a single instruction function without line
4978 struct symtab_and_line sr_sal;4986 number info, or stepped back out of a signal handler to the first
4987 instruction of the function without line number info. Just keep
4988 going, which will single-step back to the caller. */
4989 if (ecs->stop_func_start != stop_pc)
4990 {
4991 /* Set a breakpoint at callee's start address.
4992 From there we can step once and be back in the caller. */
4993 struct symtab_and_line sr_sal;
49794994
4980 init_sal (&sr_sal);4995 init_sal (&sr_sal);
4981 sr_sal.pc = ecs->stop_func_start;4996 sr_sal.pc = ecs->stop_func_start;
4982 sr_sal.pspace = get_frame_program_space (frame);4997 sr_sal.pspace = get_frame_program_space (frame);
4983 insert_step_resume_breakpoint_at_sal (gdbarch,4998 insert_step_resume_breakpoint_at_sal (gdbarch,
4984 sr_sal, null_frame_id);4999 sr_sal, null_frame_id);
5000 }
4985 }5001 }
4986 else5002 else
4987 /* Set a breakpoint at callee's return address (the address5003 /* Set a breakpoint at callee's return address (the address
49885004
=== modified file 'gdb/linespec.c'
--- gdb/linespec.c 2012-07-30 18:03:53 +0000
+++ gdb/linespec.c 2012-12-13 13:30:32 +0000
@@ -286,6 +286,11 @@
286 /* Is the entire linespec quote-enclosed? */286 /* Is the entire linespec quote-enclosed? */
287 int is_quote_enclosed;287 int is_quote_enclosed;
288288
289 /* Is a keyword syntactically valid at this point?
290 In, e.g., "break thread thread 1", the leading "keyword" must not
291 be interpreted as such. */
292 int keyword_ok;
293
289 /* The state of the parse. */294 /* The state of the parse. */
290 struct linespec_state state;295 struct linespec_state state;
291#define PARSER_STATE(PPTR) (&(PPTR)->state)296#define PARSER_STATE(PPTR) (&(PPTR)->state)
@@ -607,6 +612,10 @@
607 if (isspace (*PARSER_STREAM (parser)))612 if (isspace (*PARSER_STREAM (parser)))
608 {613 {
609 p = skip_spaces (PARSER_STREAM (parser));614 p = skip_spaces (PARSER_STREAM (parser));
615 /* When we get here we know we've found something followed by
616 a space (we skip over parens and templates below).
617 So if we find a keyword now, we know it is a keyword and not,
618 say, a function name. */
610 if (linespec_lexer_lex_keyword (p) != NULL)619 if (linespec_lexer_lex_keyword (p) != NULL)
611 {620 {
612 LS_TOKEN_STOKEN (token).ptr = start;621 LS_TOKEN_STOKEN (token).ptr = start;
@@ -716,8 +725,10 @@
716 /* Skip any whitespace. */725 /* Skip any whitespace. */
717 PARSER_STREAM (parser) = skip_spaces (PARSER_STREAM (parser));726 PARSER_STREAM (parser) = skip_spaces (PARSER_STREAM (parser));
718727
719 /* Check for a keyword. */728 /* Check for a keyword, they end the linespec. */
720 keyword = linespec_lexer_lex_keyword (PARSER_STREAM (parser));729 keyword = NULL;
730 if (parser->keyword_ok)
731 keyword = linespec_lexer_lex_keyword (PARSER_STREAM (parser));
721 if (keyword != NULL)732 if (keyword != NULL)
722 {733 {
723 parser->lexer.current.type = LSTOKEN_KEYWORD;734 parser->lexer.current.type = LSTOKEN_KEYWORD;
@@ -2018,6 +2029,10 @@
2018 }2029 }
2019 }2030 }
20202031
2032 /* A keyword at the start cannot be interpreted as such.
2033 Consider "b thread thread 42". */
2034 parser->keyword_ok = 0;
2035
2021 parser->lexer.saved_arg = *argptr;2036 parser->lexer.saved_arg = *argptr;
2022 parser->lexer.stream = argptr;2037 parser->lexer.stream = argptr;
2023 file_exception.reason = 0;2038 file_exception.reason = 0;
@@ -2092,6 +2107,9 @@
2092 else if (token.type != LSTOKEN_STRING && token.type != LSTOKEN_NUMBER)2107 else if (token.type != LSTOKEN_STRING && token.type != LSTOKEN_NUMBER)
2093 unexpected_linespec_error (parser);2108 unexpected_linespec_error (parser);
20942109
2110 /* Now we can recognize keywords. */
2111 parser->keyword_ok = 1;
2112
2095 /* Shortcut: If the next token is not LSTOKEN_COLON, we know that2113 /* Shortcut: If the next token is not LSTOKEN_COLON, we know that
2096 this token cannot represent a filename. */2114 this token cannot represent a filename. */
2097 token = linespec_lexer_peek_token (parser);2115 token = linespec_lexer_peek_token (parser);
20982116
=== modified file 'gdb/main.c'
--- gdb/main.c 2012-07-20 17:59:04 +0000
+++ gdb/main.c 2012-12-13 13:30:32 +0000
@@ -1083,10 +1083,6 @@
1083"), stream);1083"), stream);
1084#endif1084#endif
1085 fputs_unfiltered (_("\1085 fputs_unfiltered (_("\
1086 --use-deprecated-index-sections\n\
1087 Do not reject deprecated .gdb_index sections.\n\
1088"), stream);
1089 fputs_unfiltered (_("\
1090 --version Print version information and then exit.\n\1086 --version Print version information and then exit.\n\
1091 -w Use a window interface.\n\1087 -w Use a window interface.\n\
1092 --write Set writing into executable and core files.\n\1088 --write Set writing into executable and core files.\n\
10931089
=== modified file 'gdb/ppc-linux-tdep.c'
--- gdb/ppc-linux-tdep.c 2012-07-31 19:51:02 +0000
+++ gdb/ppc-linux-tdep.c 2012-12-13 13:30:32 +0000
@@ -648,8 +648,9 @@
648648
649 /* Check if we are in the resolver. */649 /* Check if we are in the resolver. */
650 sym = lookup_minimal_symbol_by_pc (pc);650 sym = lookup_minimal_symbol_by_pc (pc);
651 if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0)651 if (sym != NULL
652 || (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0))652 && (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0
653 || strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0))
653 return 1;654 return 1;
654655
655 return 0;656 return 0;
656657
=== modified file 'gdb/python/py-auto-load.c'
--- gdb/python/py-auto-load.c 2012-04-17 15:56:20 +0000
+++ gdb/python/py-auto-load.c 2012-12-13 13:30:32 +0000
@@ -31,10 +31,6 @@
3131
32#include "python-internal.h"32#include "python-internal.h"
3333
34/* The suffix of per-objfile scripts to auto-load.
35 E.g. When the program loads libfoo.so, look for libfoo-gdb.py. */
36#define GDBPY_AUTO_FILE_NAME "-gdb.py"
37
38/* The section to look for Python auto-loaded scripts (in file formats that34/* The section to look for Python auto-loaded scripts (in file formats that
39 support sections).35 support sections).
40 Each entry in this section is a byte of value 1, and then the nul-terminated36 Each entry in this section is a byte of value 1, and then the nul-terminated
4137
=== modified file 'gdb/python/python.h'
--- gdb/python/python.h 2012-04-17 15:51:41 +0000
+++ gdb/python/python.h 2012-12-13 13:30:32 +0000
@@ -24,6 +24,10 @@
2424
25struct breakpoint_object;25struct breakpoint_object;
2626
27/* The suffix of per-objfile scripts to auto-load.
28 E.g. When the program loads libfoo.so, look for libfoo-gdb.py. */
29#define GDBPY_AUTO_FILE_NAME "-gdb.py"
30
27extern void finish_python_initialization (void);31extern void finish_python_initialization (void);
2832
29void eval_python_from_control_command (struct command_line *);33void eval_python_from_control_command (struct command_line *);
3034
=== modified file 'gdb/symfile.c'
--- gdb/symfile.c 2012-06-26 20:14:01 +0000
+++ gdb/symfile.c 2012-12-13 13:30:32 +0000
@@ -2889,8 +2889,8 @@
2889 last_objfile_name);2889 last_objfile_name);
2890 }2890 }
2891 fprintf_unfiltered (gdb_stdlog,2891 fprintf_unfiltered (gdb_stdlog,
2892 "Created symtab 0x%lx for module %s.\n",2892 "Created symtab %s for module %s.\n",
2893 (long) symtab, filename);2893 host_address_to_string (symtab), filename);
2894 }2894 }
28952895
2896 return (symtab);2896 return (symtab);
28972897
=== modified file 'gdb/testsuite/ChangeLog'
--- gdb/testsuite/ChangeLog 2012-08-16 17:08:40 +0000
+++ gdb/testsuite/ChangeLog 2012-12-13 13:30:32 +0000
@@ -1,3 +1,63 @@
12012-11-15 Luis Machado <lgustavo@codesourcery.com>
2
3 * gdb.mi/mi-var-create-rtti.c: New file.
4 * gdb.mi/mi-var-create-rtti.exp: New file.
5
62012-10-15 Jan Kratochvil <jan.kratochvil@redhat.com>
7 Doug Evans <dje@google.com>
8
9 Fix recent gdb_breakpoint regression.
10 * gdb.java/jmisc.exp: gdb_breakpoint for $function - remove curly
11 braces from the parameter.
12 * gdb.java/jprint.exp: Likewise.
13
142012-10-15 Doug Evans <dje@google.com>
15
16 * lib/gdb.exp (runto): Fix call to gdb_breakpoint.
17
182012-10-11 Doug Evans <dje@google.com>
19
20 PR breakpoints/14643.
21 * gdb.linespec/ls-errs.exp: Change tests of "b if|task|thread".
22 * gdb.linespec/thread.c: New file.
23 * gdb.linespec/thread.exp: New file.
24
25 * lib/gdb.exp (gdb_breakpoint): Fix varargs scan.
26 Recognize "message" -> print pass and fail. Add eof case.
27 (runto): Recognize message, no-message. Print pass/fail if requested,
28 with same treatment as gdb_breakpoint.
29 (runto_main): Pass no-message to runto.
30 (gdb_internal_error_resync): Add log message.
31
322012-10-06 Jan Kratochvil <jan.kratochvil@redhat.com>
33
34 Fix crash during stepping on ppc32.
35 * gdb.base/step-symless.c: New file.
36 * gdb.base/step-symless.exp: New file.
37
382012-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
39
40 PR 14119
41 * gdb.arch/amd64-tailcall-ret.S: New file.
42 * gdb.arch/amd64-tailcall-ret.c: New file.
43 * gdb.arch/amd64-tailcall-ret.exp: New file.
44 * gdb.reverse/amd64-tailcall-reverse.S: New file.
45 * gdb.reverse/amd64-tailcall-reverse.c: New file.
46 * gdb.reverse/amd64-tailcall-reverse.exp: New file.
47
482012-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
49
50 PR 14548
51 * gdb.reverse/singlejmp-reverse-nodebug.S: New file.
52 * gdb.reverse/singlejmp-reverse-nodebug.c: New file.
53 * gdb.reverse/singlejmp-reverse.S: New file.
54 * gdb.reverse/singlejmp-reverse.c: New file.
55 * gdb.reverse/singlejmp-reverse.exp: New file.
56
572012-09-13 Jan Kratochvil <jan.kratochvil@redhat.com>
58
59 * gdb.base/valgrind-infcall.exp: Remove comment about Ubuntu.
60
12012-08-16 Tom Tromey <tromey@redhat.com>612012-08-16 Tom Tromey <tromey@redhat.com>
262
3 * gdb.python/py-mi.exp: Add test for printer whose children63 * gdb.python/py-mi.exp: Add test for printer whose children
464
=== modified file 'gdb/testsuite/gdb.base/valgrind-infcall.exp'
--- gdb/testsuite/gdb.base/valgrind-infcall.exp 2012-08-07 18:05:39 +0000
+++ gdb/testsuite/gdb.base/valgrind-infcall.exp 2012-12-13 13:30:32 +0000
@@ -96,7 +96,6 @@
96 gdb_test_multiple "continue" "" {96 gdb_test_multiple "continue" "" {
97 -re "Invalid free\\(\\).*: main .*\r\n$gdb_prompt $" {97 -re "Invalid free\\(\\).*: main .*\r\n$gdb_prompt $" {
98 pass $test98 pass $test
99 # In Ubuntu 10.04.4 environments 'break' does not work here.
100 set loop 099 set loop 0
101 }100 }
102 -re "Remote connection closed.*\r\n$gdb_prompt $" {101 -re "Remote connection closed.*\r\n$gdb_prompt $" {
103102
=== modified file 'gdb/testsuite/gdb.java/jmisc.exp'
--- gdb/testsuite/gdb.java/jmisc.exp 2012-06-22 16:44:14 +0000
+++ gdb/testsuite/gdb.java/jmisc.exp 2012-12-13 13:30:32 +0000
@@ -43,8 +43,8 @@
43 # signature.43 # signature.
44 runto_main44 runto_main
45 set function "${testfile}.main(java.lang.String\[\])"45 set function "${testfile}.main(java.lang.String\[\])"
46 gdb_breakpoint "$function" { allow-pending }46 gdb_breakpoint "$function" allow-pending
47 gdb_breakpoint "${function}void" { allow-pending }47 gdb_breakpoint "${function}void" allow-pending
48 gdb_continue_to_breakpoint $function48 gdb_continue_to_breakpoint $function
4949
50 gdb_test_multiple "ptype jmisc" "ptype jmisc" {50 gdb_test_multiple "ptype jmisc" "ptype jmisc" {
5151
=== modified file 'gdb/testsuite/gdb.java/jprint.exp'
--- gdb/testsuite/gdb.java/jprint.exp 2012-06-22 16:44:14 +0000
+++ gdb/testsuite/gdb.java/jprint.exp 2012-12-13 13:30:32 +0000
@@ -43,8 +43,8 @@
43 # signature.43 # signature.
44 runto_main44 runto_main
45 set function "${testfile}.main(java.lang.String\[\])"45 set function "${testfile}.main(java.lang.String\[\])"
46 gdb_breakpoint "$function" { allow-pending }46 gdb_breakpoint "$function" allow-pending
47 gdb_breakpoint "${function}void" { allow-pending }47 gdb_breakpoint "${function}void" allow-pending
48 gdb_continue_to_breakpoint $function48 gdb_continue_to_breakpoint $function
4949
50 gdb_test "p jvclass.addprint(4,5,6)" " = 15" "unambiguous static call"50 gdb_test "p jvclass.addprint(4,5,6)" " = 15" "unambiguous static call"
5151
=== modified file 'gdb/testsuite/gdb.linespec/ls-errs.exp'
--- gdb/testsuite/gdb.linespec/ls-errs.exp 2012-07-30 18:03:53 +0000
+++ gdb/testsuite/gdb.linespec/ls-errs.exp 2012-12-13 13:30:32 +0000
@@ -171,7 +171,7 @@
171}171}
172172
173foreach x {"if" "task" "thread"} {173foreach x {"if" "task" "thread"} {
174 add the_tests $x unexpected_opt "keyword" $x174 add the_tests $x invalid_function $x
175}175}
176176
177add the_tests "'main.c'flubber" unexpected_opt "string" "flubber"177add the_tests "'main.c'flubber" unexpected_opt "string" "flubber"
178178
=== modified file 'gdb/testsuite/lib/gdb.exp'
--- gdb/testsuite/lib/gdb.exp 2012-07-12 16:39:42 +0000
+++ gdb/testsuite/lib/gdb.exp 2012-12-13 13:30:32 +0000
@@ -334,29 +334,44 @@
334334
335# Set a breakpoint at FUNCTION. If there is an additional argument it is335# Set a breakpoint at FUNCTION. If there is an additional argument it is
336# a list of options; the supported options are allow-pending, temporary,336# a list of options; the supported options are allow-pending, temporary,
337# and no-message.337# message, no-message, and passfail.
338# The result is 1 for success, 0 for failure.
339#
340# Note: The handling of message vs no-message is messed up, but it's based
341# on historical usage. By default this function does not print passes,
342# only fails.
343# no-message: turns off printing of fails (and passes, but they're already off)
344# message: turns on printing of passes (and fails, but they're already on)
338345
339proc gdb_breakpoint { function args } {346proc gdb_breakpoint { function args } {
340 global gdb_prompt347 global gdb_prompt
341 global decimal348 global decimal
342349
343 set pending_response n350 set pending_response n
344 if {[lsearch -exact [lindex $args 0] allow-pending] != -1} {351 if {[lsearch -exact $args allow-pending] != -1} {
345 set pending_response y352 set pending_response y
346 }353 }
347354
348 set break_command "break"355 set break_command "break"
349 set break_message "Breakpoint"356 set break_message "Breakpoint"
350 if {[lsearch -exact [lindex $args 0] temporary] != -1} {357 if {[lsearch -exact $args temporary] != -1} {
351 set break_command "tbreak"358 set break_command "tbreak"
352 set break_message "Temporary breakpoint"359 set break_message "Temporary breakpoint"
353 }360 }
354361
355 set no_message 0362 set print_pass 0
356 if {[lsearch -exact [lindex $args 0] no-message] != -1} {363 set print_fail 1
357 set no_message 1364 set no_message_loc [lsearch -exact $args no-message]
365 set message_loc [lsearch -exact $args message]
366 # The last one to appear in args wins.
367 if { $no_message_loc > $message_loc } {
368 set print_fail 0
369 } elseif { $message_loc > $no_message_loc } {
370 set print_pass 1
358 }371 }
359372
373 set test_name "setting breakpoint at $function"
374
360 send_gdb "$break_command $function\n"375 send_gdb "$break_command $function\n"
361 # The first two regexps are what we get with -g, the third is without -g.376 # The first two regexps are what we get with -g, the third is without -g.
362 gdb_expect 30 {377 gdb_expect 30 {
@@ -365,8 +380,8 @@
365 -re "$break_message \[0-9\]* at .*$gdb_prompt $" {}380 -re "$break_message \[0-9\]* at .*$gdb_prompt $" {}
366 -re "$break_message \[0-9\]* \\(.*\\) pending.*$gdb_prompt $" {381 -re "$break_message \[0-9\]* \\(.*\\) pending.*$gdb_prompt $" {
367 if {$pending_response == "n"} {382 if {$pending_response == "n"} {
368 if { $no_message == 0 } {383 if { $print_fail } {
369 fail "setting breakpoint at $function"384 fail $test_name
370 }385 }
371 return 0386 return 0
372 }387 }
@@ -376,23 +391,34 @@
376 exp_continue391 exp_continue
377 }392 }
378 -re "A problem internal to GDB has been detected" {393 -re "A problem internal to GDB has been detected" {
379 fail "setting breakpoint at $function in runto (GDB internal error)"394 if { $print_fail } {
395 fail "$test_name (GDB internal error)"
396 }
380 gdb_internal_error_resync397 gdb_internal_error_resync
381 return 0398 return 0
382 }399 }
383 -re "$gdb_prompt $" {400 -re "$gdb_prompt $" {
384 if { $no_message == 0 } {401 if { $print_fail } {
385 fail "setting breakpoint at $function"402 fail $test_name
403 }
404 return 0
405 }
406 eof {
407 if { $print_fail } {
408 fail "$test_name (eof)"
386 }409 }
387 return 0410 return 0
388 }411 }
389 timeout {412 timeout {
390 if { $no_message == 0 } {413 if { $print_fail } {
391 fail "setting breakpoint at $function (timeout)"414 fail "$test_name (timeout)"
392 }415 }
393 return 0416 return 0
394 }417 }
395 }418 }
419 if { $print_pass } {
420 pass $test_name
421 }
396 return 1;422 return 1;
397} 423}
398424
@@ -400,8 +426,15 @@
400# Since this is the only breakpoint that will be set, if it stops426# Since this is the only breakpoint that will be set, if it stops
401# at a breakpoint, we will assume it is the one we want. We can't427# at a breakpoint, we will assume it is the one we want. We can't
402# just compare to "function" because it might be a fully qualified,428# just compare to "function" because it might be a fully qualified,
403# single quoted C++ function specifier. If there's an additional argument,429# single quoted C++ function specifier.
404# pass it to gdb_breakpoint.430#
431# If there are additional arguments, pass them to gdb_breakpoint.
432# We recognize no-message/message ourselves.
433# The default is no-message.
434# no-message is messed up here, like gdb_breakpoint: to preserve
435# historical usage fails are always printed by default.
436# no-message: turns off printing of fails (and passes, but they're already off)
437# message: turns on printing of passes (and fails, but they're already on)
405438
406proc runto { function args } {439proc runto { function args } {
407 global gdb_prompt440 global gdb_prompt
@@ -409,7 +442,28 @@
409442
410 delete_breakpoints443 delete_breakpoints
411444
412 if ![gdb_breakpoint $function [lindex $args 0]] {445 # Default to "no-message".
446 set args "no-message $args"
447
448 set print_pass 0
449 set print_fail 1
450 set no_message_loc [lsearch -exact $args no-message]
451 set message_loc [lsearch -exact $args message]
452 # The last one to appear in args wins.
453 if { $no_message_loc > $message_loc } {
454 set print_fail 0
455 } elseif { $message_loc > $no_message_loc } {
456 set print_pass 1
457 }
458
459 set test_name "running to $function in runto"
460
461 # We need to use eval here to pass our varargs args to gdb_breakpoint
462 # which is also a varargs function.
463 # But we also have to be careful because $function may have multiple
464 # elements, and we don't want Tcl to move the remaining elements after
465 # the first to $args. That is why $function is wrapped in {}.
466 if ![eval gdb_breakpoint {$function} $args] {
413 return 0;467 return 0;
414 }468 }
415469
@@ -419,30 +473,46 @@
419 # the "in func" output we get without -g.473 # the "in func" output we get without -g.
420 gdb_expect 30 {474 gdb_expect 30 {
421 -re "Break.* at .*:$decimal.*$gdb_prompt $" {475 -re "Break.* at .*:$decimal.*$gdb_prompt $" {
476 if { $print_pass } {
477 pass $test_name
478 }
422 return 1479 return 1
423 }480 }
424 -re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in .*$gdb_prompt $" { 481 -re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in .*$gdb_prompt $" {
482 if { $print_pass } {
483 pass $test_name
484 }
425 return 1485 return 1
426 }486 }
427 -re "The target does not support running in non-stop mode.\r\n$gdb_prompt $" {487 -re "The target does not support running in non-stop mode.\r\n$gdb_prompt $" {
428 unsupported "Non-stop mode not supported"488 if { $print_fail } {
489 unsupported "Non-stop mode not supported"
490 }
429 return 0491 return 0
430 }492 }
431 -re ".*A problem internal to GDB has been detected" {493 -re ".*A problem internal to GDB has been detected" {
432 fail "running to $function in runto (GDB internal error)"494 if { $print_fail } {
495 fail "$test_name (GDB internal error)"
496 }
433 gdb_internal_error_resync497 gdb_internal_error_resync
434 return 0498 return 0
435 }499 }
436 -re "$gdb_prompt $" { 500 -re "$gdb_prompt $" {
437 fail "running to $function in runto"501 if { $print_fail } {
502 fail $test_name
503 }
438 return 0504 return 0
439 }505 }
440 eof { 506 eof {
441 fail "running to $function in runto (end of file)"507 if { $print_fail } {
508 fail "$test_name (eof)"
509 }
442 return 0510 return 0
443 }511 }
444 timeout { 512 timeout {
445 fail "running to $function in runto (timeout)"513 if { $print_fail } {
514 fail "$test_name (timeout)"
515 }
446 return 0516 return 0
447 }517 }
448 }518 }
@@ -455,7 +525,7 @@
455# If you don't want that, use gdb_start_cmd.525# If you don't want that, use gdb_start_cmd.
456526
457proc runto_main { } {527proc runto_main { } {
458 return [runto main]528 return [runto main no-message]
459}529}
460530
461### Continue, and expect to hit a breakpoint.531### Continue, and expect to hit a breakpoint.
@@ -508,6 +578,8 @@
508proc gdb_internal_error_resync {} {578proc gdb_internal_error_resync {} {
509 global gdb_prompt579 global gdb_prompt
510580
581 verbose -log "Resyncing due to internal error."
582
511 set count 0583 set count 0
512 while {$count < 10} {584 while {$count < 10} {
513 gdb_expect {585 gdb_expect {
514586
=== modified file 'gdb/value.c'
--- gdb/value.c 2012-06-13 15:50:18 +0000
+++ gdb/value.c 2012-12-13 13:30:32 +0000
@@ -850,8 +850,12 @@
850 result = value_type (value);850 result = value_type (value);
851 if (opts.objectprint)851 if (opts.objectprint)
852 {852 {
853 if (TYPE_CODE (result) == TYPE_CODE_PTR853 /* If result's target type is TYPE_CODE_STRUCT, proceed to
854 fetch its rtti type. */
855 if ((TYPE_CODE (result) == TYPE_CODE_PTR
854 || TYPE_CODE (result) == TYPE_CODE_REF)856 || TYPE_CODE (result) == TYPE_CODE_REF)
857 && TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (result)))
858 == TYPE_CODE_STRUCT)
855 {859 {
856 struct type *real_type;860 struct type *real_type;
857861
858862
=== modified file 'gdb/version.in'
--- gdb/version.in 2012-09-13 14:19:38 +0000
+++ gdb/version.in 2012-12-13 13:30:32 +0000
@@ -1,1 +1,1 @@
17.5-2012.09-1~bzr17.5-2012.12-1~bzr
22
=== modified file 'libiberty/ChangeLog'
--- libiberty/ChangeLog 2012-07-13 23:39:45 +0000
+++ libiberty/ChangeLog 2012-12-13 13:30:32 +0000
@@ -1,3 +1,8 @@
12012-07-31 Mike Frysinger <vapier@gentoo.org>
2
3 * md5.c (md5_finish_ctx): Declare swap_bytes. Assign SWAP() output
4 to swap_bytes, and then call memcpy to move it to ctx->buffer.
5
12012-07-13 Doug Evans <dje@google.com>62012-07-13 Doug Evans <dje@google.com>
27
3 * filename_cmp.c (filename_hash, filename_eq): New functions.8 * filename_cmp.c (filename_hash, filename_eq): New functions.
49
=== modified file 'libiberty/md5.c'
--- libiberty/md5.c 2011-09-23 20:01:11 +0000
+++ libiberty/md5.c 2012-12-13 13:30:32 +0000
@@ -103,6 +103,7 @@
103{103{
104 /* Take yet unprocessed bytes into account. */104 /* Take yet unprocessed bytes into account. */
105 md5_uint32 bytes = ctx->buflen;105 md5_uint32 bytes = ctx->buflen;
106 md5_uint32 swap_bytes;
106 size_t pad;107 size_t pad;
107108
108 /* Now count remaining bytes. */109 /* Now count remaining bytes. */
@@ -113,10 +114,13 @@
113 pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;114 pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
114 memcpy (&ctx->buffer[bytes], fillbuf, pad);115 memcpy (&ctx->buffer[bytes], fillbuf, pad);
115116
116 /* Put the 64-bit file length in *bits* at the end of the buffer. */117 /* Put the 64-bit file length in *bits* at the end of the buffer.
117 *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);118 Use memcpy to avoid aliasing problems. On most systems, this
118 *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |119 will be optimized away to the same code. */
119 (ctx->total[0] >> 29));120 swap_bytes = SWAP (ctx->total[0] << 3);
121 memcpy (&ctx->buffer[bytes + pad], &swap_bytes, sizeof (swap_bytes));
122 swap_bytes = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
123 memcpy (&ctx->buffer[bytes + pad + 4], &swap_bytes, sizeof (swap_bytes));
120124
121 /* Process last bytes. */125 /* Process last bytes. */
122 md5_process_block (ctx->buffer, bytes + pad + 8, ctx);126 md5_process_block (ctx->buffer, bytes + pad + 8, ctx);

Subscribers

People subscribed via source and target branches