Re: flag to know that we are compiling GDB for an arm target

Zied Guermazi <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
hi Simon,

I am extending btrace for armv7 and armv8. In armv7, due to some 
limitations in the debug HW, GDB requires the current program status 
register CPSR to know in which ISA mode it is, so that it can set 
breakpoints properly and calculate the "landing" address for next, 
nexti, step commands

When we use the traces in replay mode we need to know and provide the 
cpsr at any instruction.

there is a data structure (btrace_insn in btrace.h) that was extended to 
holds cpsr register and possibly other registers (paving the way for 
data tracing). currently it is a vector of registers, that will be 
(currently) empty of all architectures except ARMv7 (see the struct 
below). We have typically thousands to millions instances of this structure.


struct btrace_insn
{
   /* The address of this instruction.  */
   CORE_ADDR pc;

   /* The size of this instruction in bytes.  */
   gdb_byte size;

/* A vector of registers.  */
   std::vector<record_btrace_reg_entry> registers;

   /* The instruction class of this instruction.  */
   enum btrace_insn_class iclass;

   /* A bit vector of BTRACE_INSN_FLAGS.  */
   btrace_insn_flags flags;
};


the empty vector was judged to be a big overhead for Intel PT for 
example. I am looking for a way to inhibit it, when we are not building 
GDB for armv7.

do you have any proposal for solving such a situation?


On 22.03.21 03:26, Simon Marchi wrote:
>
> On 2021-03-21 10:21 p.m., Zied Guermazi wrote:
>> hi,
>>
>> is it possible to know, at compile time, whether we are compiling gdb for an armv7 target ( e.g arm-linux, arm-none-eabi ... ) or not? for example a define that gets propagated to source/header files.
>>
>> Kind Regards
>>
>> Zied Guermazi
>>
>>
> Not really, since one GDB can be configured for multiple target
> architectures (you can include all possible target architectures with
> --enable-targets=all when running configure).
>
> What are you trying to achieve?
>
> Simon
-- 

*Zied Guermazi*
founder

Trande UG
Leuschnerstraße 2
69469 Weinheim/Germany

Mobile: +491722645127
mailto:[email protected]

*Trande UG*
Leuschnerstraße 2, D-69469 Weinheim; Telefon: +491722645127
Sitz der Gesellschaft: Weinheim- Registergericht: AG Mannheim HRB 736209 
- Geschäftsführung: Zied Guermazi

*Confidentiality Note*
This message is intended only for the use of the named recipient(s) and 
may contain confidential and/or privileged information. If you are not 
the intended recipient, please contact the sender and delete the 
message. Any unauthorized use of the information contained in this 
message is prohibited.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.