Hello @DavidSpickett,
(I apologize for a long post
but I wanted to make sure that I provide all the details)
So l am trying to follow the method you described for program flow
to learn/understand a target’s source code. I am trying to investigate lets say Frame handling in AVR (I am choosing AVR because it seems to be much smaller target in terms of number of files as compared to Sparc/MIPS etc). I am doing the following:
The approach I am taking is that: I try to learn about source code of a target (Frame handling in AVR in this case) by creating a small C code file and run LLDB on the command that generates Assembly file and then (in the LLDB session) I put a break point on a line in target source code (“AVRFrameLowering.cpp” in this case) and investigate what were the functions called up to this point.
NOTE1: Actually I am not sure if my approach described above (i.e. use LLDB breakpoints on target’s source file while using command that generates target Assembly) is correct to begin with?? So please feel free to comment and let me know if there is a better way to learn a target’s source code
NOTE2: Please note that the steps I am doing below might not be the best way to do them. So please feel free to suggest me better options 
Step1 (Initial Setup):
I am using Linux for my development.
I download LLVM source and place it at:
/home/uhdesign/llvm_work/llvm_download/
I create a build directory at:
/home/uhdesign/llvm_work/llvm_build/
Then I build it using:
$> cd /home/uhdesign/llvm_work/llvm_build/
$> /home/uhdesign/llvm_work/cmake_build/bin/cmake -DCMAKE_C_COMPILER=/home/uhdesign/llvm_work/gcc_13_build/bin/gcc -DCMAKE_CXX_COMPILER=/home/uhdesign/llvm_work/gcc_13_build/bin/g++ -DLLVM_TARGETS_TO_BUILD="X86;Sparc;AVR" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_ENABLE_ASSERTIONS="ON" -DCMAKE_INSTALL_PREFIX=/home/uhdesign/llvm_work/llvm_build /home/uhdesign/llvm_work/llvm_download/llvm-project/llvm
I install LLDB at standard location via command:
$> sudo apt install lldb
Step2 (Write a simple C program and generate AVR Assembly):
I write a simple C program as:
$> cat test_add.c
int gl_a;
int gl_b;
int my_func(int c, int d)
{
int out;
out = gl_a + gl_b + c + d;
return out;
}
I place the above code at a new location:
/home/uhdesign/llvm_work/my_tests/
Then I generate Assembly for AVR by:
$> cd /home/uhdesign/llvm_work/my_tests/
$> /home/uhdesign/llvm_work/llvm_build/bin/clang --target=avr -S test_add.c
The above command throws this message on terminal (so I am not sure what I am missing):
$> clang: warning: no target microcontroller specified on command line, cannot link standard libraries, please pass -mmcu=<mcu name> [-Wavr-rtlib-linking-quirks]
But it (i.e. the above command) does generate an Assembly file test_add.s as below:
.text
.set __tmp_reg__, 0
.set __zero_reg__, 1
.set __SREG__, 63
.set __SP_H__, 62
.set __SP_L__, 61
.file "test_add.c"
.globl my_func ; -- Begin function my_func
.p2align 1
.type my_func,@function
my_func: ; @my_func
; %bb.0: ; %entry
push r28
push r29
in r28, 61
in r29, 62
sbiw r28, 6
in r0, 63
cli
out 62, r29
out 63, r0
out 61, r28
std Y+6, r25
std Y+5, r24
std Y+4, r23
std Y+3, r22
lds r24, gl_a
lds r25, gl_a+1
lds r18, gl_b
lds r19, gl_b+1
add r24, r18
adc r25, r19
ldd r18, Y+5
ldd r19, Y+6
add r24, r18
adc r25, r19
ldd r18, Y+3
ldd r19, Y+4
add r24, r18
adc r25, r19
std Y+2, r25
std Y+1, r24
ldd r24, Y+1
ldd r25, Y+2
adiw r28, 6
in r0, 63
cli
out 62, r29
out 63, r0
out 61, r28
pop r29
pop r28
ret
.Lfunc_end0:
.size my_func, .Lfunc_end0-my_func
; -- End function
; Declaring this symbol tells the CRT that it should
;clear the zeroed data section on startup
.globl __do_clear_bss
.type gl_a,@object ; @gl_a
.section .bss,"aw",@nobits
.globl gl_a
gl_a:
.short 0 ; 0x0
.size gl_a, 2
.type gl_b,@object ; @gl_b
.globl gl_b
gl_b:
.short 0 ; 0x0
.size gl_b, 2
.addrsig
.addrsig_sym gl_a
.addrsig_sym gl_b
Since I see that the assembly file is generated so I take that the command mentioned in this step to generate Assembly works.
Step3 (Run LLDB and set breakpoint):
Now I want to rerun the command from Step2 but this time I want to use LLDB and insert a breakpoint at Line 97 of AVRFrameLowering.cpp
I chose line 97 because it has the following code which I think could be useful to learn about Frame handling:
const MachineFrameInfo &MFI = MF.getFrameInfo(); // Line 97
So I run LLDB on the command from Step2 and provide the breakpoint at Line number 97 and provide full path to the AVR’s source code file (I found the command to specify breakpoint at a specific line number in a file through the internet):
$> cd /home/uhdesign/llvm_work/my_tests/
$> lldb /home/uhdesign/llvm_work/llvm_build/bin/clang -- --target=avr -S test_add.c
(lldb) target create "/home/uhdesign/llvm_work/llvm_build/bin/clang"
Current executable set to '/home/uhdesign/llvm_work/llvm_build/bin/clang' (x86_64).
(lldb) settings set -- target.run-args "--target=avr" "-S" "test_add.c"
(lldb) breakpoint set --file /home/uhdesign/llvm_work/llvm_download/llvm-project/llvm/lib/Target/AVR/AVRFrameLowering.cpp --line 97
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb)
The above step fails to place breakpoint 
Questions:
So can you please answer the following:
Q1) What am I doing wrong with Step3?
Q2) Is my whole approach (i.e. to learn a target’s source code by generating Assembly and using breakpoints at certain locations in source code) correct?
Q3) For some reason when I ran the commands that you provided for clang --version then instead of LLDB pointing me to the source code, it showed me some assembly dump (please see below). Any idea why that might be happening?? I would like LLDB to point me to source code similar to what you got (instead of showing assembly dump)
$> cd /home/uhdesign/llvm_work/my_tests/
$> lldb /home/uhdesign/llvm_work/llvm_build/bin/clang -- --version
(lldb) target create "/home/uhdesign/llvm_work/llvm_build/bin/clang"
Current executable set to '/home/uhdesign/llvm_work/llvm_build/bin/clang' (x86_64).
(lldb) settings set -- target.run-args "--version"
(lldb) b Driver::PrintVersion
Breakpoint 1: where = clang`clang::driver::Driver::PrintVersion(clang::driver::Compilation const&, llvm::raw_ostream&) const [clone .localalias], address = 0x000000000384b548
(lldb) run
Process 28649 launched: '/home/uhdesign/llvm_work/llvm_build/bin/clang' (x86_64)
Process 28649 stopped
* thread #1: tid = 28649, 0x000000000384b548 clang`clang::driver::Driver::PrintVersion(clang::driver::Compilation const&, llvm::raw_ostream&) const [clone .localalias], name = 'clang', stop reason = breakpoint 1.1
frame #0: 0x000000000384b548 clang`clang::driver::Driver::PrintVersion(clang::driver::Compilation const&, llvm::raw_ostream&) const [clone .localalias]
clang`clang::driver::Driver::PrintVersion:
-> 0x384b548 <+0>: pushq %rbp
0x384b549 <+1>: movq %rsp, %rbp
0x384b54c <+4>: pushq %rbx
0x384b54d <+5>: subq $0x128, %rsp ; imm = 0x128
(lldb)
Thank you very much again for all your input and reading this with great patience 
Best Regards