mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 00:10:10 +00:00
(dl_main): Support additional args in --list mode for debugging: look them up as symbol names and print values.
This commit is contained in:
parent
1d8dc4293f
commit
fd86137937
@ -59,6 +59,7 @@ cp crti.s-new crtn.s-new");
|
|||||||
|
|
||||||
/* Append the .init prologue to crti.s-new. */
|
/* Append the .init prologue to crti.s-new. */
|
||||||
asm ("cat >> crti.s-new <<\\EOF.crti.init");
|
asm ("cat >> crti.s-new <<\\EOF.crti.init");
|
||||||
|
|
||||||
SECTION (".init")
|
SECTION (".init")
|
||||||
void
|
void
|
||||||
_init (void)
|
_init (void)
|
||||||
@ -69,10 +70,13 @@ _init (void)
|
|||||||
gcrt1.o to reference a symbol which would be defined by some library
|
gcrt1.o to reference a symbol which would be defined by some library
|
||||||
module which has a constructor; but then user code's constructors
|
module which has a constructor; but then user code's constructors
|
||||||
would come first, and not be profiled. */
|
would come first, and not be profiled. */
|
||||||
extern void __gmon_start__ (void) __attribute__ ((weak));
|
extern volatile void __gmon_start__ (void) __attribute__ ((weak));
|
||||||
|
/* This volatile variable is necessary to avoid GCC optimizing
|
||||||
|
out the test. */
|
||||||
|
register volatile void (*g) (void) = &__gmon_start__;
|
||||||
weak_symbol (__gmon_start__)
|
weak_symbol (__gmon_start__)
|
||||||
if (&__gmon_start__)
|
if (g)
|
||||||
__gmon_start__ ();
|
(*g) ();
|
||||||
|
|
||||||
/* End the here document containing the .init prologue code.
|
/* End the here document containing the .init prologue code.
|
||||||
Then fetch the .section directive just written and append that
|
Then fetch the .section directive just written and append that
|
||||||
|
21
elf/rtld.c
21
elf/rtld.c
@ -300,6 +300,8 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
functions we call below for output may no longer work properly
|
functions we call below for output may no longer work properly
|
||||||
after relocation. */
|
after relocation. */
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
if (! _dl_loaded->l_info[DT_NEEDED])
|
if (! _dl_loaded->l_info[DT_NEEDED])
|
||||||
_dl_sysdep_message ("\t", "statically linked\n", NULL);
|
_dl_sysdep_message ("\t", "statically linked\n", NULL);
|
||||||
else
|
else
|
||||||
@ -314,6 +316,25 @@ of this helper program; chances are you did not intend to run this program.\n",
|
|||||||
" (0x", bp, ")\n", NULL);
|
" (0x", bp, ")\n", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 1; i < _dl_argc; ++i)
|
||||||
|
{
|
||||||
|
const Elf32_Sym *ref = NULL;
|
||||||
|
Elf32_Addr loadbase = _dl_lookup_symbol (_dl_argv[i], &ref,
|
||||||
|
_dl_loaded, "argument",
|
||||||
|
1);
|
||||||
|
char buf[20], *bp;
|
||||||
|
buf[sizeof buf - 1] = '\0';
|
||||||
|
bp = _itoa (ref->st_value, &buf[sizeof buf - 1], 16, 0);
|
||||||
|
while (&buf[sizeof buf - 1] - bp < sizeof loadbase * 2)
|
||||||
|
*--bp = '0';
|
||||||
|
_dl_sysdep_message (_dl_argv[i], " found at 0x", bp, NULL);
|
||||||
|
buf[sizeof buf - 1] = '\0';
|
||||||
|
bp = _itoa (loadbase, &buf[sizeof buf - 1], 16, 0);
|
||||||
|
while (&buf[sizeof buf - 1] - bp < sizeof loadbase * 2)
|
||||||
|
*--bp = '0';
|
||||||
|
_dl_sysdep_message (" in object at 0x", bp, "\n", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
_exit (0);
|
_exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ getttynam(tty)
|
|||||||
return (t);
|
return (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *skip __P((char *)), *value __P((char *));
|
||||||
|
|
||||||
struct ttyent *
|
struct ttyent *
|
||||||
getttyent()
|
getttyent()
|
||||||
{
|
{
|
||||||
@ -65,7 +67,6 @@ getttyent()
|
|||||||
register char *p;
|
register char *p;
|
||||||
#define MAXLINELENGTH 100
|
#define MAXLINELENGTH 100
|
||||||
static char line[MAXLINELENGTH];
|
static char line[MAXLINELENGTH];
|
||||||
static char *skip(), *value();
|
|
||||||
|
|
||||||
if (!tf && !setttyent())
|
if (!tf && !setttyent())
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user