@@ -85,7 +85,7 @@ function getIncludeDir(llvmConfig) {
8585 * undefined, the shared library will be searched from the global search paths
8686 * @param {string } lldbExe Path to the corresponding lldb executable
8787 * @param {string|undefined } llvmConfig Path to llvm-config, if it's installed
88- * @returns {{dir:string, name:string} }
88+ * @returns {{dir:string|undefined , name:string, so: string|undefined } }
8989 */
9090function getLib ( lldbExe , llvmConfig ) {
9191 // First look for the libraries in the directory returned by
@@ -95,7 +95,7 @@ function getLib(lldbExe, llvmConfig) {
9595 llvmConfig , [ '--libdir' ]
9696 ) . toString ( ) . trim ( ) ;
9797 if ( fs . existsSync ( path . join ( libDir , 'liblldb.so' ) ) ) {
98- return { dir : libDir , name : 'lldb' } ;
98+ return { dir : libDir , name : 'lldb' , so : undefined } ;
9999 }
100100 }
101101
@@ -106,13 +106,13 @@ function getLib(lldbExe, llvmConfig) {
106106 'ldd' , [ lldbExe ]
107107 ) . toString ( ) . trim ( ) ;
108108 } catch ( err ) {
109- return { dir : undefined , name : 'lldb' } ;
109+ return { dir : undefined , name : 'lldb' , so : undefined } ;
110110 }
111111
112112 const lib = libs . split ( / \s / ) . find (
113113 line => line . includes ( 'liblldb' ) && line . startsWith ( '/' ) ) ;
114114 if ( ! lib ) {
115- return { dir : undefined , name : 'lldb' } ;
115+ return { dir : undefined , name : 'lldb' , so : undefined } ;
116116 }
117117
118118 console . log ( `From ldd: ${ lldbExe } loads ${ lib } ` ) ;
@@ -121,20 +121,22 @@ function getLib(lldbExe, llvmConfig) {
121121 // On Ubuntu the libraries are suffixed and installed globally
122122 const libName = path . basename ( lib ) . match ( / l i b ( l l d b .* ?) \. s o / ) [ 1 ] ;
123123
124- // TODO(joyeecheung): on RedHat there might not be a non-versioned liblldb.so
124+ // On RedHat there might not be a non-versioned liblldb.so
125125 // in the system. It's fine in the case of plugins since the lldb executable
126126 // will load the library before loading the plugin, but we will have to link
127127 // to the versioned library file for addons.
128- if ( ! fs . existsSync ( path . join ( libDir , `lib${ libName } .so` ) ) ) {
128+ if ( fs . existsSync ( path . join ( libDir , `lib${ libName } .so` ) ) ) {
129129 return {
130- dir : undefined ,
131- name : libName
130+ dir : libDir ,
131+ name : libName ,
132+ so : undefined
132133 } ;
133134 }
134135
135136 return {
136- dir : libDir ,
137- name : libName
137+ dir : undefined ,
138+ name : libName ,
139+ so : lib
138140 } ;
139141}
140142
@@ -181,7 +183,9 @@ function getLldbInstallation() {
181183 const lib = getLib ( lldbExe , llvmConfig ) ;
182184 if ( ! lib . dir ) {
183185 console . log ( `Could not find non-versioned lib${ lib . name } .so in the system` ) ;
184- console . log ( `Symbols will be resolved by the lldb executable at runtime` ) ;
186+ console . log ( 'Plugin symbols will be resolved by the lldb executable ' +
187+ 'at runtime' ) ;
188+ console . log ( `Addon will be linked to ${ lib . so } ` ) ;
185189 } else {
186190 console . log ( `Found lib${ lib . name } .so in ${ lib . dir } ` ) ;
187191 }
@@ -191,7 +195,8 @@ function getLldbInstallation() {
191195 version : lldbVersion ,
192196 includeDir : includeDir ,
193197 libDir : lib . dir ,
194- libName : lib . name
198+ libName : lib . name ,
199+ libPath : lib . so
195200 } ;
196201}
197202
0 commit comments