Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

344
Vistas
in gdb, can we set a variable as an expression?

In the u-boot C code, the value "gd" is declared like this. (arm)

register volatile gd_t *gd asm ("r9")  

and register r9 contains the pointer to the struct global_data. (typedef'd to gd_t)

While debugging/analying, to see gd->malloc_base in the C code, typing "p gd->malloc_base" doesn't work. it says Missing ELF symbol "gd".
I later learned that I should do "p ((gd_t *)$r9)->malloc_base" to see the value. I'm typing this kind of command many times a day. Isn't there a way that I can assign a variable in gdb that represents ((gd_t *)$r9)? and why doesn't gdb recognize the value gd in the code?
What I want to do is make a variable representing ((gd_t *)$r9) so that I can use it like gd->ram_top or gd->env_has_init, etc. according to the value I'm curious about.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

This is the comment of @ssbssa to my quetion (thanks @ssbssa). I asked him to put his answer but he doesn't. so I add the answer myself.
You can define macro like macro define gd ((gd_t *)$r0) and then you can later use p /x gd->reloc_off or p /x gd->flags. Of course you can put this macro define command in the command file and start gdb like this arm-none-eabi-gdb u-boot -x gdb_command.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda