forked from Imagelibrary/binutils-gdb
* gdbcore.h: New variable gnutarget.
* core.c: Add commands to set and show it. * Callers to bfd_*open*: Pass gnutarget instead of NULL as target. * environ.c (set_in_environ): For GNUTARGET, use set_gnutarget not putenv. * symtab.c (decode_line_1): Give error on unmatched single quote.
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
Mon Aug 9 09:53:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||||
|
|
||||||
|
* gdbcore.h: New variable gnutarget.
|
||||||
|
* core.c: Add commands to set and show it.
|
||||||
|
* Callers to bfd_*open*: Pass gnutarget instead of NULL as target.
|
||||||
|
* environ.c (set_in_environ): For GNUTARGET, use set_gnutarget not
|
||||||
|
putenv.
|
||||||
|
|
||||||
|
* symtab.c (decode_line_1): Give error on unmatched single quote.
|
||||||
|
|
||||||
Sun Aug 8 13:59:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
Sun Aug 8 13:59:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||||
|
|
||||||
* ser-unix.c (hardwire_send_break) [HAVE_SGTTY]: Use select not usleep.
|
* ser-unix.c (hardwire_send_break) [HAVE_SGTTY]: Use select not usleep.
|
||||||
|
|||||||
46
gdb/core.c
46
gdb/core.c
@@ -231,6 +231,39 @@ read_memory_unsigned_integer (memaddr, len)
|
|||||||
return extract_unsigned_integer (buf, len);
|
return extract_unsigned_integer (buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The current default bfd target. Points to storage allocated for
|
||||||
|
gnutarget_string. */
|
||||||
|
char *gnutarget;
|
||||||
|
|
||||||
|
/* Same thing, except it is "auto" not NULL for the default case. */
|
||||||
|
static char *gnutarget_string;
|
||||||
|
|
||||||
|
static void set_gnutarget_command
|
||||||
|
PARAMS ((char *, int, struct cmd_list_element *));
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_gnutarget_command (ignore, from_tty, c)
|
||||||
|
char *ignore;
|
||||||
|
int from_tty;
|
||||||
|
struct cmd_list_element *c;
|
||||||
|
{
|
||||||
|
if (STREQ (gnutarget_string, "auto"))
|
||||||
|
gnutarget = NULL;
|
||||||
|
else
|
||||||
|
gnutarget = gnutarget_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the gnutarget. */
|
||||||
|
void
|
||||||
|
set_gnutarget (newtarget)
|
||||||
|
char *newtarget;
|
||||||
|
{
|
||||||
|
if (gnutarget_string != NULL)
|
||||||
|
free (gnutarget_string);
|
||||||
|
gnutarget_string = savestring (newtarget, strlen (newtarget));
|
||||||
|
set_gnutarget_command (NULL, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_core()
|
_initialize_core()
|
||||||
{
|
{
|
||||||
@@ -240,4 +273,17 @@ _initialize_core()
|
|||||||
No arg means have no core file. This command has been superseded by the\n\
|
No arg means have no core file. This command has been superseded by the\n\
|
||||||
`target core' and `detach' commands.", &cmdlist);
|
`target core' and `detach' commands.", &cmdlist);
|
||||||
c->completer = filename_completer;
|
c->completer = filename_completer;
|
||||||
|
|
||||||
|
c = add_set_cmd ("gnutarget", class_files, var_string_noescape,
|
||||||
|
(char *) &gnutarget_string,
|
||||||
|
"Set the current BFD target.\n\
|
||||||
|
Use `set gnutarget auto' to specify automatic detection.",
|
||||||
|
&setlist);
|
||||||
|
c->function.sfunc = set_gnutarget_command;
|
||||||
|
add_show_from_set (c, &showlist);
|
||||||
|
|
||||||
|
if (getenv ("GNUTARGET"))
|
||||||
|
set_gnutarget (getenv ("GNUTARGET"));
|
||||||
|
else
|
||||||
|
set_gnutarget ("auto");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ core_open (filename, from_tty)
|
|||||||
if (scratch_chan < 0)
|
if (scratch_chan < 0)
|
||||||
perror_with_name (filename);
|
perror_with_name (filename);
|
||||||
|
|
||||||
temp_bfd = bfd_fdopenr (filename, NULL, scratch_chan);
|
temp_bfd = bfd_fdopenr (filename, gnutarget, scratch_chan);
|
||||||
if (temp_bfd == NULL)
|
if (temp_bfd == NULL)
|
||||||
{
|
{
|
||||||
perror_with_name (filename);
|
perror_with_name (filename);
|
||||||
|
|||||||
@@ -73,13 +73,13 @@ init_environ (e)
|
|||||||
(e->allocated + 1) * sizeof (char *));
|
(e->allocated + 1) * sizeof (char *));
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) memcpy (e->vector, environ, (i + 1) * sizeof (char *));
|
memcpy (e->vector, environ, (i + 1) * sizeof (char *));
|
||||||
|
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
{
|
{
|
||||||
register int len = strlen (e->vector[i]);
|
register int len = strlen (e->vector[i]);
|
||||||
register char *new = (char *) xmalloc (len + 1);
|
register char *new = (char *) xmalloc (len + 1);
|
||||||
(void) memcpy (new, e->vector[i], len + 1);
|
memcpy (new, e->vector[i], len + 1);
|
||||||
e->vector[i] = new;
|
e->vector[i] = new;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,8 +106,7 @@ get_in_environ (e, var)
|
|||||||
register char *s;
|
register char *s;
|
||||||
|
|
||||||
for (; (s = *vector) != NULL; vector++)
|
for (; (s = *vector) != NULL; vector++)
|
||||||
if (!strncmp (s, var, len)
|
if (STREQN (s, var, len) && s[len] == '=')
|
||||||
&& s[len] == '=')
|
|
||||||
return &s[len + 1];
|
return &s[len + 1];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -127,8 +126,7 @@ set_in_environ (e, var, value)
|
|||||||
register char *s;
|
register char *s;
|
||||||
|
|
||||||
for (i = 0; (s = vector[i]) != NULL; i++)
|
for (i = 0; (s = vector[i]) != NULL; i++)
|
||||||
if (!strncmp (s, var, len)
|
if (STREQN (s, var, len) && s[len] == '=')
|
||||||
&& s[len] == '=')
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (s == 0)
|
if (s == 0)
|
||||||
@@ -152,14 +150,25 @@ set_in_environ (e, var, value)
|
|||||||
vector[i] = s;
|
vector[i] = s;
|
||||||
|
|
||||||
/* Certain variables get exported back to the parent (e.g. our)
|
/* Certain variables get exported back to the parent (e.g. our)
|
||||||
environment, too. */
|
environment, too. FIXME: this is a hideous hack and should not be
|
||||||
if (!strcmp(var, "PATH") /* Object file location */
|
allowed to live. What if we want to change the environment we pass to
|
||||||
|| !strcmp (var, "G960BASE") /* Intel 960 downloads */
|
the program without affecting GDB's behavior? */
|
||||||
|| !strcmp (var, "G960BIN") /* Intel 960 downloads */
|
if (STREQ(var, "PATH") /* Object file location */
|
||||||
|| !strcmp (var, "GNUTARGET") /* BFD object file type */
|
|| STREQ (var, "G960BASE") /* Intel 960 downloads */
|
||||||
) {
|
|| STREQ (var, "G960BIN") /* Intel 960 downloads */
|
||||||
putenv (strsave (s));
|
)
|
||||||
}
|
{
|
||||||
|
putenv (strsave (s));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is a compatibility hack, since GDB 4.10 and older didn't have
|
||||||
|
`set gnutarget'. Eventually it should go away, so that (for example)
|
||||||
|
you can debug objdump's handling of GNUTARGET without affecting GDB's
|
||||||
|
behavior. */
|
||||||
|
if (STREQ (var, "GNUTARGET"))
|
||||||
|
{
|
||||||
|
set_gnutarget (value);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,13 +184,18 @@ unset_in_environ (e, var)
|
|||||||
register char *s;
|
register char *s;
|
||||||
|
|
||||||
for (; (s = *vector) != NULL; vector++)
|
for (; (s = *vector) != NULL; vector++)
|
||||||
if (!strncmp (s, var, len)
|
{
|
||||||
&& s[len] == '=')
|
if (STREQN (s, var, len) && s[len] == '=')
|
||||||
{
|
{
|
||||||
free (s);
|
free (s);
|
||||||
(void) memcpy (vector, vector + 1,
|
/* Walk through the vector, shuffling args down by one, including
|
||||||
(e->allocated - (vector - e->vector)) * sizeof (char *));
|
the NULL terminator. Can't use memcpy() here since the regions
|
||||||
e->vector[e->allocated - 1] = 0;
|
overlap, and memmove() might not be available. */
|
||||||
return;
|
while ((vector[0] = vector[1]) != NULL)
|
||||||
}
|
{
|
||||||
|
vector++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ hms_load (args, fromtty)
|
|||||||
|
|
||||||
dcache_flush ();
|
dcache_flush ();
|
||||||
inferior_pid = 0;
|
inferior_pid = 0;
|
||||||
abfd = bfd_openr (args, 0);
|
abfd = bfd_openr (args, gnutarget);
|
||||||
if (!abfd)
|
if (!abfd)
|
||||||
{
|
{
|
||||||
printf_filtered ("Unable to open file %s\n", args);
|
printf_filtered ("Unable to open file %s\n", args);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ int fromtty;
|
|||||||
asection *s;
|
asection *s;
|
||||||
|
|
||||||
inferior_pid = 0;
|
inferior_pid = 0;
|
||||||
abfd = bfd_openr(args, (char*)0);
|
abfd = bfd_openr (args, (char*)gnutarget);
|
||||||
|
|
||||||
if (!abfd)
|
if (!abfd)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1038,7 +1038,7 @@ download(load_arg_string, from_tty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pbfd = bfd_openr (filename, 0);
|
pbfd = bfd_openr (filename, gnutarget);
|
||||||
|
|
||||||
if (!pbfd)
|
if (!pbfd)
|
||||||
perror_with_name (filename);
|
perror_with_name (filename);
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
Mon Aug 9 10:13:34 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||||
|
|
||||||
|
* gdb.t10/crossload.exp: Add `set gnutarget auto' at end of tests.
|
||||||
|
|
||||||
Sun Aug 8 14:21:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
Sun Aug 8 14:21:29 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||||
|
|
||||||
* gdb.t20/inherit.exp: Change message for "print tagless struct"
|
* gdb.t20/inherit.exp: Change message for "print tagless struct"
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ char *filename;
|
|||||||
if (scratch_chan < 0)
|
if (scratch_chan < 0)
|
||||||
perror_with_name(filename);
|
perror_with_name(filename);
|
||||||
|
|
||||||
exec_bfd = bfd_fdopenr(scratch_pathname, NULL, scratch_chan);
|
exec_bfd = bfd_fdopenr(scratch_pathname, gnutarget, scratch_chan);
|
||||||
if (!exec_bfd)
|
if (!exec_bfd)
|
||||||
error("Could not open `%s' as an executable file: %s"
|
error("Could not open `%s' as an executable file: %s"
|
||||||
, scratch_pathname, bfd_errmsg(bfd_error));
|
, scratch_pathname, bfd_errmsg(bfd_error));
|
||||||
@@ -426,9 +426,9 @@ add_vmap(ldi)
|
|||||||
if (ldi->ldinfo_fd < 0)
|
if (ldi->ldinfo_fd < 0)
|
||||||
/* Note that this opens it once for every member; a possible
|
/* Note that this opens it once for every member; a possible
|
||||||
enhancement would be to only open it once for every object. */
|
enhancement would be to only open it once for every object. */
|
||||||
bfd = bfd_openr (objname, NULL);
|
bfd = bfd_openr (objname, gnutarget);
|
||||||
else
|
else
|
||||||
bfd = bfd_fdopenr(objname, NULL, ldi->ldinfo_fd);
|
bfd = bfd_fdopenr(objname, gnutarget, ldi->ldinfo_fd);
|
||||||
if (!bfd)
|
if (!bfd)
|
||||||
error("Could not open `%s' as an executable file: %s",
|
error("Could not open `%s' as an executable file: %s",
|
||||||
objname, bfd_errmsg(bfd_error));
|
objname, bfd_errmsg(bfd_error));
|
||||||
|
|||||||
Reference in New Issue
Block a user