17 Comments

  1. Pingback: Step-thru debugging an opensource project.
  2. Hi,
    I have found the above commands you have suggested quite useful but i would like to know how can i use this command when there are mutiple files of code to be executed and I am interested in the assembly code of only one of those files ?

    1. You can use the same method to generate the source-assembly list from several source files. Note that the line numbers are followed with source file names like “1:fun1.c”. You may only check the parts that you are interested in.

  3. Hi Sir,

    Thank you very much for your explanation.
    I have one query, So from the above option we can get the list of source file but is it possible that “Can we get to know what and particular source file is going to be used for particular executable file (In case when source code generate two or more executable’s)” ..?
    Lets say:
    We have 5 source file, and 3 source files are used for “a.out” and rest 2 source files are used for “b.out” then “How can we get to know it that which source files is used for which “executable file”..?

    Thanks in advance

  4. great post,

    Is their any tool to identify what are all different register used in assembly code generated by gcc or any other compiler? or is their any way we can find out which registers are used in assembly code and total access count of these registers.

    1. Different compilers may generate different instruction flows for the same program. It may not be easy to do a side-by-side comparison. There are only a small number of registers in the common CPU ISAs. To get best performance, compilers usually generate instructions to use as registers as much as possible.

      The total access count of the registers used may be counted during runtime and may be different with different input to the programs. If you need such info, you may use some techniques like those used in JIT compilers or virtual machines to “record” the instructions executed and count the register usage. But I am not aware of any existing tools doing this.

  5. This is very helpful. Could you please post also information what are corresponding compiler options for g++?

  6. getting errors at the end

    d:/progs/gcc_riscv_v12/bin/../lib/gcc/riscv-none-elf/12.2.0/../../../../riscv-none-elf/bin/ld.exe: warning: cannot find entry symbol _start; defaulting to 0000000000010094
    d:/progs/gcc_riscv_v12/bin/../lib/gcc/riscv-none-elf/12.2.0/../../../../riscv-none-elf/bin/ld.exe: C:\Users\mrx23dot\AppData\Local\Temp\cc8KCAnd.o: in function `adc_filter_task’:
    D:\DRIVE\Projects\FW_ch32v003_template\build/..\src\adcFilter/adcFilter.c:45: undefined reference to `adc_read’
    d:/progs/gcc_riscv_v12/bin/../lib/gcc/riscv-none-elf/12.2.0/../../../../riscv-none-elf/bin/ld.exe: C:\Users\mrx23dot\AppData\Local\Temp\cc8KCAnd.o: in function `adc_readFilt’:
    D:\DRIVE\Projects\FW_ch32v003_template\build/..\src\adcFilter/adcFilter.c:61: undefined reference to `assert_halt’
    collect2.exe: error: ld returned 1 exit status

    Tries to do more than asm?

Leave a Reply

Your email address will not be published. Required fields are marked *