aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2010-05-14 23:41:05 +0000
committerMichael Snyder <msnyder@vmware.com>2010-05-14 23:41:05 +0000
commite0881a8e0fbb8bd5d4d14683390269b97e4e90d7 (patch)
tree60fe317865c5f6a2e987df4e590cf170bee3360f
parentabbb1732a91accadee3e1c00b75fc0a3f418fae7 (diff)
downloadgdb-e0881a8e0fbb8bd5d4d14683390269b97e4e90d7.zip
gdb-e0881a8e0fbb8bd5d4d14683390269b97e4e90d7.tar.gz
gdb-e0881a8e0fbb8bd5d4d14683390269b97e4e90d7.tar.bz2
2010-05-14 Michael Snyder <msnyder@vmware.com>
* jv-lang.c: White space. * jv-typeprint.c: White space. * jv-valprint.c: White space. * language.c: White space. * libunwind-frame.c: White space. * linespec.c: White space. * linux-nat.c: White space. * linux-record.c: White space. * linux-thread-db.c: White space.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/jv-lang.c22
-rw-r--r--gdb/jv-typeprint.c3
-rw-r--r--gdb/jv-valprint.c6
-rw-r--r--gdb/language.c9
-rw-r--r--gdb/libunwind-frame.c2
-rw-r--r--gdb/linespec.c14
-rw-r--r--gdb/linux-nat.c127
-rw-r--r--gdb/linux-record.c41
-rw-r--r--gdb/linux-thread-db.c13
10 files changed, 178 insertions, 69 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d0ffd21..1d06726 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
2010-05-14 Michael Snyder <msnyder@vmware.com>
+ * jv-lang.c: White space.
+ * jv-typeprint.c: White space.
+ * jv-valprint.c: White space.
+ * language.c: White space.
+ * libunwind-frame.c: White space.
+ * linespec.c: White space.
+ * linux-nat.c: White space.
+ * linux-record.c: White space.
+ * linux-thread-db.c: White space.
+
* infcall.c: White space.
* inf-child.c: White space.
* infcmd.c: White space.
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index e8d12cd..2e700e3 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -120,6 +120,7 @@ get_java_class_symtab (struct gdbarch *gdbarch)
struct objfile *objfile = get_dynamics_objfile (gdbarch);
struct blockvector *bv;
struct block *bl;
+
class_symtab = allocate_symtab ("<java-classes>", objfile);
class_symtab->language = language_java;
bv = (struct blockvector *)
@@ -149,6 +150,7 @@ add_class_symtab_symbol (struct symbol *sym)
struct symtab *symtab
= get_java_class_symtab (get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile));
struct blockvector *bv = BLOCKVECTOR (symtab);
+
dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym);
}
@@ -156,6 +158,7 @@ static struct symbol *
add_class_symbol (struct type *type, CORE_ADDR addr)
{
struct symbol *sym;
+
sym = (struct symbol *)
obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
@@ -183,11 +186,13 @@ struct type *
java_lookup_class (char *name)
{
struct symbol *sym;
+
sym = lookup_symbol (name, expression_context_block, STRUCT_DOMAIN, NULL);
if (sym != NULL)
return SYMBOL_TYPE (sym);
#if 0
CORE_ADDR addr;
+
if (called from parser)
{
call lookup_class (or similar) in inferior;
@@ -199,6 +204,7 @@ java_lookup_class (char *name)
else
addr = 0;
struct type *type;
+
type = alloc_type (objfile);
TYPE_CODE (type) = TYPE_CODE_STRUCT;
INIT_CPLUS_SPECIFIC (type);
@@ -222,6 +228,7 @@ get_java_utf8_name (struct obstack *obstack, struct value *name)
struct value *temp = name;
int name_length;
CORE_ADDR data_addr;
+
temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
name_length = (int) value_as_long (temp);
data_addr = value_address (temp) + TYPE_LENGTH (value_type (temp));
@@ -253,6 +260,7 @@ java_class_is_primitive (struct value *clas)
{
struct value *vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
CORE_ADDR i = value_as_address (vtable);
+
return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
}
@@ -297,6 +305,7 @@ type_from_class (struct gdbarch *gdbarch, struct value *clas)
if (java_class_is_primitive (clas))
{
struct value *sig;
+
temp = clas;
sig = value_struct_elt (&temp, NULL, "method_count", NULL, "structure");
return java_primitive_type (gdbarch, value_as_long (sig));
@@ -325,6 +334,7 @@ type_from_class (struct gdbarch *gdbarch, struct value *clas)
{
char *signature = name;
int namelen = java_demangled_signature_length (signature);
+
if (namelen > strlen (name))
name = obstack_alloc (&objfile->objfile_obstack, namelen + 1);
java_demangled_signature_copy (name, signature);
@@ -446,6 +456,7 @@ java_link_class_type (struct gdbarch *gdbarch,
{
int accflags;
int boffset;
+
if (fields == NULL)
{
temp = clas;
@@ -456,6 +467,7 @@ java_link_class_type (struct gdbarch *gdbarch,
{ /* Re-use field value for next field. */
CORE_ADDR addr
= value_address (field) + TYPE_LENGTH (value_type (field));
+
set_value_address (field, addr);
set_value_lazy (field, 1);
}
@@ -493,6 +505,7 @@ java_link_class_type (struct gdbarch *gdbarch,
else
{
struct type *ftype;
+
temp = field;
temp = value_struct_elt (&temp, NULL, "type", NULL, "structure");
ftype = type_from_class (gdbarch, temp);
@@ -518,6 +531,7 @@ java_link_class_type (struct gdbarch *gdbarch,
{
char *mname;
int k;
+
if (methods == NULL)
{
temp = clas;
@@ -528,6 +542,7 @@ java_link_class_type (struct gdbarch *gdbarch,
{ /* Re-use method value for next method. */
CORE_ADDR addr
= value_address (method) + TYPE_LENGTH (value_type (method));
+
set_value_address (method, addr);
set_value_lazy (method, 1);
}
@@ -559,6 +574,7 @@ java_link_class_type (struct gdbarch *gdbarch,
if (strcmp (mname, fn_fieldlists[j].name) == 0)
{ /* Found an existing method with the same name. */
int l;
+
if (mname != unqualified_name)
obstack_free (&objfile->objfile_obstack, mname);
mname = fn_fieldlists[j].name;
@@ -619,6 +635,7 @@ get_java_object_type (void)
if (java_object_type == NULL)
{
struct symbol *sym;
+
sym = lookup_symbol ("java.lang.Object", NULL, STRUCT_DOMAIN, NULL);
if (sym == NULL)
error (_("cannot find java.lang.Object"));
@@ -631,6 +648,7 @@ int
get_java_object_header_size (struct gdbarch *gdbarch)
{
struct type *objtype = get_java_object_type ();
+
if (objtype == NULL)
return (2 * gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
else
@@ -774,6 +792,7 @@ static int
java_demangled_signature_length (char *signature)
{
int array = 0;
+
for (; *signature == '['; signature++)
array += 2; /* Two chars for "[]". */
switch (signature[0])
@@ -794,6 +813,7 @@ java_demangled_signature_copy (char *result, char *signature)
int array = 0;
char *ptr;
int i;
+
while (*signature == '[')
{
array++;
@@ -835,6 +855,7 @@ java_demangle_type_signature (char *signature)
{
int length = java_demangled_signature_length (signature);
char *result = xmalloc (length + 1);
+
java_demangled_signature_copy (result, signature);
result[length] = '\0';
return result;
@@ -911,6 +932,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp,
struct value *arg1;
struct value *arg2;
struct type *type;
+
switch (op)
{
case UNOP_IND:
diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c
index 6132576..7e96b4d 100644
--- a/gdb/jv-typeprint.c
+++ b/gdb/jv-typeprint.c
@@ -90,8 +90,8 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
int len;
char *mangled_name;
char *demangled_name;
- QUIT;
+ QUIT;
wrap_here (" ");
if (type == NULL)
@@ -122,6 +122,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
if (TYPE_TAG_NAME (type) != NULL && TYPE_TAG_NAME (type)[0] == '[')
{ /* array type */
char *name = java_demangle_type_signature (TYPE_TAG_NAME (type));
+
fputs_filtered (name, stream);
xfree (name);
break;
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index d53a8e3..165f14e 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -79,6 +79,7 @@ java_value_print (struct value *val, struct ui_file *stream,
int reps;
struct type *el_type
= java_primitive_type_from_name (gdbarch, name, i - 2);
+
i = 0;
read_memory (address + get_java_object_header_size (gdbarch), buf4, 4);
@@ -319,6 +320,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
if (field_is_static (&TYPE_FIELD (type, i)))
{
char *name = TYPE_FIELD_NAME (type, i);
+
if (!options->static_field_print)
continue;
if (name != NULL && strcmp (name, "class") == 0)
@@ -412,12 +414,14 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
else if (field_is_static (&TYPE_FIELD (type, i)))
{
struct value *v = value_static_field (type, i);
+
if (v == NULL)
fputs_filtered ("<optimized out>", stream);
else
{
struct value_print_options opts;
struct type *t = check_typedef (value_type (v));
+
if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
v = value_addr (v);
opts = *options;
@@ -431,6 +435,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
else
{
struct value_print_options opts = *options;
+
opts.deref_ref = 0;
val_print (TYPE_FIELD_TYPE (type, i),
valaddr + TYPE_FIELD_BITPOS (type, i) / 8, 0,
@@ -522,6 +527,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
if (options->format || options->output_format)
{
struct value_print_options opts = *options;
+
opts.format = (options->format ? options->format
: options->output_format);
print_scalar_formatted (valaddr, type, &opts, 0, stream);
diff --git a/gdb/language.c b/gdb/language.c
index aba8a9e..c20d7c0 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -773,8 +773,8 @@ void
type_error (const char *string,...)
{
va_list args;
- va_start (args, string);
+ va_start (args, string);
switch (type_check)
{
case type_check_warn:
@@ -799,8 +799,8 @@ void
range_error (const char *string,...)
{
va_list args;
- va_start (args, string);
+ va_start (args, string);
switch (range_check)
{
case range_check_warn:
@@ -981,6 +981,7 @@ skip_language_trampoline (struct frame_info *frame, CORE_ADDR pc)
if (languages[i]->skip_trampoline)
{
CORE_ADDR real_pc = (languages[i]->skip_trampoline) (frame, pc);
+
if (real_pc)
return real_pc;
}
@@ -1298,6 +1299,7 @@ language_string_char_type (const struct language_defn *la,
{
struct language_gdbarch *ld = gdbarch_data (gdbarch,
language_gdbarch_data);
+
return ld->arch_info[la->la_language].string_char_type;
}
@@ -1311,11 +1313,13 @@ language_bool_type (const struct language_defn *la,
if (ld->arch_info[la->la_language].bool_type_symbol)
{
struct symbol *sym;
+
sym = lookup_symbol (ld->arch_info[la->la_language].bool_type_symbol,
NULL, VAR_DOMAIN, NULL);
if (sym)
{
struct type *type = SYMBOL_TYPE (sym);
+
if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
return type;
}
@@ -1332,6 +1336,7 @@ language_lookup_primitive_type_by_name (const struct language_defn *la,
struct language_gdbarch *ld = gdbarch_data (gdbarch,
language_gdbarch_data);
struct type *const *p;
+
for (p = ld->arch_info[la->la_language].primitive_type_vector;
(*p) != NULL;
p++)
diff --git a/gdb/libunwind-frame.c b/gdb/libunwind-frame.c
index 481b6b2..231d909 100644
--- a/gdb/libunwind-frame.c
+++ b/gdb/libunwind-frame.c
@@ -101,6 +101,7 @@ libunwind_descr_init (struct gdbarch *gdbarch)
{
struct libunwind_descr *descr = GDBARCH_OBSTACK_ZALLOC (gdbarch,
struct libunwind_descr);
+
return descr;
}
@@ -201,6 +202,7 @@ void
libunwind_frame_dealloc_cache (struct frame_info *self, void *this_cache)
{
struct libunwind_frame_cache *cache = this_cache;
+
if (cache->as)
unw_destroy_addr_space_p (cache->as);
}
diff --git a/gdb/linespec.c b/gdb/linespec.c
index d9721b4..378c6c9 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -150,11 +150,13 @@ cplusplus_error (const char *name, const char *fmt, ...)
{
struct ui_file *tmp_stream;
char *message;
+
tmp_stream = mem_fileopen ();
make_cleanup_ui_file_delete (tmp_stream);
{
va_list args;
+
va_start (args, fmt);
vfprintf_unfiltered (tmp_stream, fmt, args);
va_end (args);
@@ -767,6 +769,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
{
struct symtabs_and_lines values;
+
values = decode_objc (argptr, funfirstline, NULL,
canonical, saved_arg);
if (values.sals != NULL)
@@ -1034,6 +1037,7 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
if (p[0] == '<')
{
char *temp_end = find_template_name_end (p);
+
if (!temp_end)
error (_("malformed template specification in command"));
p = temp_end;
@@ -1074,6 +1078,7 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
if (*is_quote_enclosed)
{
char *closing_quote = strchr (p - 1, '"');
+
if (closing_quote && closing_quote[1] == '\0')
*closing_quote = '\0';
}
@@ -1339,6 +1344,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
{
/* At this point argptr->"fun". */
char *a;
+
p = *argptr;
while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':'
&& *p != '(')
@@ -1372,6 +1378,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
if (*p && current_language->la_language == language_java)
{
struct type *type;
+
p2 = p;
while (*p2)
++p2;
@@ -1508,9 +1515,11 @@ lookup_prefix_sym (char **argptr, char *p)
using VAR_DOMAIN (where typedefs live) and double-check that we
found a struct/class type. */
struct symbol *s = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
+
if (s != NULL)
{
struct type *t = SYMBOL_TYPE (s);
+
CHECK_TYPEDEF (t);
if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
return s;
@@ -1566,10 +1575,12 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
if (strchr (saved_arg, '(') != NULL)
{
int i;
+
for (i = 0; i < i1; ++i)
{
char *name = saved_arg;
char *canon = cp_canonicalize_string (name);
+
if (canon != NULL)
name = canon;
@@ -1776,6 +1787,7 @@ decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab,
{
/* We have a value history reference. */
struct value *val_history;
+
sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index);
val_history = access_value_history ((copy[1] == '$') ? -index : index);
if (TYPE_CODE (value_type (val_history)) != TYPE_CODE_INT)
@@ -1836,7 +1848,6 @@ decode_variable (char *copy, int funfirstline, char ***canonical,
struct symtab *file_symtab, int *not_found_ptr)
{
struct symbol *sym;
-
struct minimal_symbol *msymbol;
sym = lookup_symbol (copy,
@@ -1898,6 +1909,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy,
{
struct blockvector *bv = BLOCKVECTOR (SYMBOL_SYMTAB (sym));
struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+
if (lookup_block_symbol (b, copy, VAR_DOMAIN) != NULL)
build_canonical_line_spec (values.sals, copy, canonical);
}
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 2c791dc..8180248 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -368,6 +368,7 @@ static void
add_to_pid_list (struct simple_pid_list **listp, int pid, int status)
{
struct simple_pid_list *new_pid = xmalloc (sizeof (struct simple_pid_list));
+
new_pid->pid = pid;
new_pid->status = status;
new_pid->next = *listp;
@@ -383,6 +384,7 @@ pull_pid_from_list (struct simple_pid_list **listp, int pid, int *status)
if ((*p)->pid == pid)
{
struct simple_pid_list *next = (*p)->next;
+
*status = (*p)->status;
xfree (*p);
*p = next;
@@ -1646,6 +1648,7 @@ get_pending_status (struct lwp_info *lp, int *status)
else if (non_stop && !is_executing (lp->ptid))
{
struct thread_info *tp = find_thread_ptid (lp->ptid);
+
signo = tp->stop_signal;
}
else if (!non_stop)
@@ -1658,6 +1661,7 @@ get_pending_status (struct lwp_info *lp, int *status)
if (GET_LWP (lp->ptid) == GET_LWP (last_ptid))
{
struct thread_info *tp = find_thread_ptid (lp->ptid);
+
signo = tp->stop_signal;
}
}
@@ -3802,6 +3806,7 @@ linux_nat_kill (struct target_ops *ops)
else
{
ptid_t ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
+
/* Stop all threads before killing them, since ptrace requires
that the thread is stopped to sucessfully PTRACE_KILL. */
iterate_over_lwps (ptid, stop_callback, NULL);
@@ -4340,6 +4345,7 @@ static char *
linux_spu_make_corefile_notes (bfd *obfd, char *note_data, int *note_size)
{
struct linux_spu_corefile_data args;
+
args.obfd = obfd;
args.note_data = note_data;
args.note_size = note_size;
@@ -4496,6 +4502,7 @@ linux_nat_info_proc_cmd (char *args, int from_tty)
if ((procfile = fopen (fname1, "r")) != NULL)
{
struct cleanup *cleanup = make_cleanup_fclose (procfile);
+
if (fgets (buffer, sizeof (buffer), procfile))
printf_filtered ("cmdline = '%s'\n", buffer);
else
@@ -4591,6 +4598,7 @@ linux_nat_info_proc_cmd (char *args, int from_tty)
if ((procfile = fopen (fname1, "r")) != NULL)
{
struct cleanup *cleanup = make_cleanup_fclose (procfile);
+
while (fgets (buffer, sizeof (buffer), procfile) != NULL)
puts_filtered (buffer);
do_cleanups (cleanup);
@@ -4921,8 +4929,8 @@ linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigse
static LONGEST
linux_nat_xfer_osdata (struct target_ops *ops, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
/* We make the process list snapshot when the object starts to be
read. */
@@ -4942,7 +4950,7 @@ linux_nat_xfer_osdata (struct target_ops *ops, enum target_object object,
if (offset == 0)
{
if (len_avail != -1 && len_avail != 0)
- obstack_free (&obstack, NULL);
+ obstack_free (&obstack, NULL);
len_avail = 0;
buf = NULL;
obstack_init (&obstack);
@@ -4950,60 +4958,63 @@ linux_nat_xfer_osdata (struct target_ops *ops, enum target_object object,
dirp = opendir ("/proc");
if (dirp)
- {
- struct dirent *dp;
- while ((dp = readdir (dirp)) != NULL)
- {
- struct stat statbuf;
- char procentry[sizeof ("/proc/4294967295")];
-
- if (!isdigit (dp->d_name[0])
- || NAMELEN (dp) > sizeof ("4294967295") - 1)
- continue;
-
- sprintf (procentry, "/proc/%s", dp->d_name);
- if (stat (procentry, &statbuf) == 0
- && S_ISDIR (statbuf.st_mode))
- {
- char *pathname;
- FILE *f;
- char cmd[MAXPATHLEN + 1];
- struct passwd *entry;
-
- pathname = xstrprintf ("/proc/%s/cmdline", dp->d_name);
- entry = getpwuid (statbuf.st_uid);
-
- if ((f = fopen (pathname, "r")) != NULL)
- {
- size_t len = fread (cmd, 1, sizeof (cmd) - 1, f);
- if (len > 0)
- {
- int i;
- for (i = 0; i < len; i++)
- if (cmd[i] == '\0')
- cmd[i] = ' ';
- cmd[len] = '\0';
-
- obstack_xml_printf (
- &obstack,
- "<item>"
- "<column name=\"pid\">%s</column>"
- "<column name=\"user\">%s</column>"
- "<column name=\"command\">%s</column>"
- "</item>",
- dp->d_name,
- entry ? entry->pw_name : "?",
- cmd);
- }
- fclose (f);
- }
-
- xfree (pathname);
- }
- }
-
- closedir (dirp);
- }
+ {
+ struct dirent *dp;
+
+ while ((dp = readdir (dirp)) != NULL)
+ {
+ struct stat statbuf;
+ char procentry[sizeof ("/proc/4294967295")];
+
+ if (!isdigit (dp->d_name[0])
+ || NAMELEN (dp) > sizeof ("4294967295") - 1)
+ continue;
+
+ sprintf (procentry, "/proc/%s", dp->d_name);
+ if (stat (procentry, &statbuf) == 0
+ && S_ISDIR (statbuf.st_mode))
+ {
+ char *pathname;
+ FILE *f;
+ char cmd[MAXPATHLEN + 1];
+ struct passwd *entry;
+
+ pathname = xstrprintf ("/proc/%s/cmdline", dp->d_name);
+ entry = getpwuid (statbuf.st_uid);
+
+ if ((f = fopen (pathname, "r")) != NULL)
+ {
+ size_t len = fread (cmd, 1, sizeof (cmd) - 1, f);
+
+ if (len > 0)
+ {
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (cmd[i] == '\0')
+ cmd[i] = ' ';
+ cmd[len] = '\0';
+
+ obstack_xml_printf (
+ &obstack,
+ "<item>"
+ "<column name=\"pid\">%s</column>"
+ "<column name=\"user\">%s</column>"
+ "<column name=\"command\">%s</column>"
+ "</item>",
+ dp->d_name,
+ entry ? entry->pw_name : "?",
+ cmd);
+ }
+ fclose (f);
+ }
+
+ xfree (pathname);
+ }
+ }
+
+ closedir (dirp);
+ }
obstack_grow_str0 (&obstack, "</osdata>\n");
buf = obstack_finish (&obstack);
@@ -5478,6 +5489,7 @@ linux_nat_core_of_thread_1 (ptid_t ptid)
for (;;)
{
int n;
+
content = xrealloc (content, content_read + 1024);
n = fread (content + content_read, 1, 1024, f);
content_read += n;
@@ -5513,6 +5525,7 @@ int
linux_nat_core_of_thread (struct target_ops *ops, ptid_t ptid)
{
struct lwp_info *info = find_lwp_pid (ptid);
+
if (info)
return info->core;
return -1;
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 6692ec1..1311f001 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -240,6 +240,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_exit:
{
int q;
+
target_terminal_ours ();
q = yquery (_("The next instruction is syscall exit. "
"It will make the program exit. "
@@ -256,6 +257,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_read:
{
ULONGEST addr, count;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &addr);
regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
if (record_arch_list_add_mem ((CORE_ADDR) addr, (int) count))
@@ -654,6 +656,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_readlink:
{
ULONGEST len;
+
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
@@ -669,11 +672,11 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_reboot:
{
int q;
+
target_terminal_ours ();
- q =
- yquery (_("The next instruction is syscall reboot. "
- "It will restart the computer. "
- "Do you want to stop the program?"));
+ q = yquery (_("The next instruction is syscall reboot. "
+ "It will restart the computer. "
+ "Do you want to stop the program?"));
target_terminal_inferior ();
if (q)
return 1;
@@ -745,6 +748,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_getpeername:
{
ULONGEST len;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
@@ -755,6 +759,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_recvfrom:
{
ULONGEST len;
+
regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
@@ -763,6 +768,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_recv:
{
ULONGEST size;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
@@ -788,6 +794,7 @@ record_linux_system_call (enum gdb_syscall syscall,
{
ULONGEST optvalp;
gdb_byte *optlenp = alloca (tdep->size_int);
+
if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
tdep->size_int))
{
@@ -857,6 +864,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case RECORD_SYS_SOCKETPAIR:
{
gdb_byte *a = alloca (tdep->size_ulong);
+
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
if (tmpulongest)
@@ -1133,6 +1141,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_msgrcv:
{
ULONGEST msgp;
+
regcache_raw_read_signed (regcache, tdep->arg3, &tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg2, &msgp);
tmpint = (int) tmpulongest + tdep->size_long;
@@ -1166,6 +1175,7 @@ record_linux_system_call (enum gdb_syscall syscall,
{
ULONGEST second;
ULONGEST ptr;
+
regcache_raw_read_signed (regcache, tdep->arg3, &second);
regcache_raw_read_unsigned (regcache, tdep->arg5, &ptr);
tmpint = (int) second + tdep->size_long;
@@ -1221,6 +1231,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest == 0 || tmpulongest == 2)
{
ULONGEST ptr, bytecount;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &ptr);
regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
if (record_arch_list_add_mem ((CORE_ADDR) ptr, (int) bytecount))
@@ -1319,6 +1330,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_getdents:
{
ULONGEST count;
+
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
@@ -1450,6 +1462,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST nfds;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tdep->size_pollfd * nfds))
@@ -1462,6 +1475,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest == 7 || tmpulongest == 8)
{
int rsize;
+
if (tmpulongest == 7)
rsize = tdep->size_NFS_FHSIZE;
else
@@ -1534,6 +1548,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST sigsetsize;
+
regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) sigsetsize))
@@ -1557,6 +1572,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST count;
+
regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) count))
return -1;
@@ -1572,6 +1588,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST size;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
return -1;
@@ -1644,6 +1661,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST gidsetsize;
+
regcache_raw_read_unsigned (regcache, tdep->arg1,
&gidsetsize);
tmpint = tdep->size_gid_t * (int) gidsetsize;
@@ -1705,6 +1723,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_getdents64:
{
ULONGEST count;
+
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
@@ -1747,6 +1766,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST size;
+
regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
return -1;
@@ -1760,6 +1780,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST size;
+
regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) size))
return -1;
@@ -1788,6 +1809,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST len;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
return -1;
@@ -1821,6 +1843,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST nr;
+
regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
nr * tdep->size_io_event))
@@ -1875,6 +1898,7 @@ record_linux_system_call (enum gdb_syscall syscall,
case gdb_sys_exit_group:
{
int q;
+
target_terminal_ours ();
q = yquery (_("The next instruction is syscall exit_group. "
"It will make the program exit. "
@@ -1890,6 +1914,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST len;
+
regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) len))
return -1;
@@ -1905,6 +1930,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST maxevents;
+
regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
maxevents * tdep->size_epoll_event))
@@ -1985,6 +2011,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST maxnode;
+
regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
maxnode * tdep->size_long))
@@ -2003,6 +2030,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST msg_len;
+
regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) msg_len))
@@ -2051,6 +2079,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST buflen;
+
regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) buflen))
@@ -2090,6 +2119,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST bufsiz;
+
regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, (int) bufsiz))
return -1;
@@ -2124,6 +2154,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST nfds;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tdep->size_pollfd * nfds))
@@ -2169,6 +2200,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST nr_pages;
+
regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest,
nr_pages * tdep->size_int))
@@ -2194,6 +2226,7 @@ record_linux_system_call (enum gdb_syscall syscall,
if (tmpulongest)
{
ULONGEST maxevents;
+
regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
tmpint = (int) maxevents * tdep->size_epoll_event;
if (record_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 006ba41..2b1fb70 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -324,6 +324,7 @@ static int
have_threads_callback (struct thread_info *thread, void *args)
{
int pid = * (int *) args;
+
if (ptid_get_pid (thread->ptid) != pid)
return 0;
@@ -601,10 +602,10 @@ thread_db_find_new_threads_silently (ptid_t ptid)
}
if (except.reason < 0 && info_verbose)
- {
- exception_fprintf (gdb_stderr, except,
- "Warning: thread_db_find_new_threads_silently: ");
- }
+ {
+ exception_fprintf (gdb_stderr, except,
+ "Warning: thread_db_find_new_threads_silently: ");
+ }
}
/* Lookup a library in which given symbol resides.
@@ -794,12 +795,15 @@ thread_db_load_search (void)
while (*search_path)
{
const char *end = strchr (search_path, ':');
+
if (end)
{
size_t len = end - search_path;
+
if (len + 1 + strlen (LIBTHREAD_DB_SO) + 1 > sizeof (path))
{
char *cp = xmalloc (len + 1);
+
memcpy (cp, search_path, len);
cp[len] = '\0';
warning (_("libthread_db_search_path component too long,"
@@ -1329,6 +1333,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
if (info->need_stale_parent_threads_check)
{
int tgid = linux_proc_get_tgid (ti.ti_lid);
+
if (tgid != -1 && tgid != info->pid)
return 0;
}