# LLDB - am I able to set breakpoint at a function if I did not set -g when compiling?

**URL:** <https://forums.kodeco.com/t/lldb-am-i-able-to-set-breakpoint-at-a-function-if-i-did-not-set-g-when-compiling/112534>\
**Category:** Advanced Apple Debugging\
**Created:** [June 18, 2020, 4:16pm UTC](https://forums.kodeco.com/t/lldb-am-i-able-to-set-breakpoint-at-a-function-if-i-did-not-set-g-when-compiling/112534 "2020-06-18T16:16:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![junxiang99](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/junxiang99/32/81494_2.png) [@junxiang99](https://forums.kodeco.com/u/junxiang99)\
**Post date:** [June 18, 2020, 4:16pm UTC](https://forums.kodeco.com/t/lldb-am-i-able-to-set-breakpoint-at-a-function-if-i-did-not-set-g-when-compiling/112534/1 "2020-06-18T16:16:43Z")

</div>

LLDB - am I able to set breakpoint at a function in a process, if the executable was not compiled with -g (ie no debugging info)?

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [June 18, 2020, 7:04pm UTC](https://forums.kodeco.com/t/lldb-am-i-able-to-set-breakpoint-at-a-function-if-i-did-not-set-g-when-compiling/112534/2 "2020-06-18T19:04:52Z")

</div>

@lolgrep Can you please help with this when you get a chance? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![lolgrep](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lolgrep/32/106950_2.png) [@lolgrep](https://forums.kodeco.com/u/lolgrep)\
**Post date:** [June 19, 2020, 9:30pm UTC](https://forums.kodeco.com/t/lldb-am-i-able-to-set-breakpoint-at-a-function-if-i-did-not-set-g-when-compiling/112534/3 "2020-06-19T21:30:27Z")

</div>

Yes, you can set a breakpoint on a address if no symbol information is available to you.

---

<div class="post-metadata">

**Author:** ![junxiang99](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/junxiang99/32/81494_2.png) [@junxiang99](https://forums.kodeco.com/u/junxiang99)\
**Post date:** [June 20, 2020, 5:55am UTC](https://forums.kodeco.com/t/lldb-am-i-able-to-set-breakpoint-at-a-function-if-i-did-not-set-g-when-compiling/112534/4 "2020-06-20T05:55:02Z")

</div>

> [@lolgrep](#):
>
> breakpoint on a address if no symbol information is available to you.

Yea, but I meant was, can I do something like

breakpoint set -n main

on an executable that was _not_ compiled with -g flag?

No right? There’s no way at all to do that right?

(2)  
And a separated but related question - if the -g flag was not used, I won’t be able to inspect and see source code lines as well right? I can only see assembly right?

---

<div class="post-metadata">

**Author:** ![lolgrep](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/lolgrep/32/106950_2.png) [@lolgrep](https://forums.kodeco.com/u/lolgrep)\
**Post date:** [June 27, 2020, 6:59am UTC](https://forums.kodeco.com/t/lldb-am-i-able-to-set-breakpoint-at-a-function-if-i-did-not-set-g-when-compiling/112534/5 "2020-06-27T06:59:57Z")

</div>

There’s no way LLDB can do that. Once it starts up, it’ll look for dSYM for a module. If it can find one (or if symbol table info is available for that address) then it will associate a function name to an address. If no, you’ll see the usual `lldb_unammedFooBar123` naming for a function.

However even though there’s no naming, lldb can figure a function is there via the Mach-O `LC_FUNCTION_STARTS` load command, which contains a compact format for all functions compiled into the binary

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [December 2, 2020, 8:16am UTC](https://forums.kodeco.com/t/lldb-am-i-able-to-set-breakpoint-at-a-function-if-i-did-not-set-g-when-compiling/112534/6 "2020-12-02T08:16:45Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
